Skip to main content

DPF Framework 2026 R1

compression:kMeans clustering

Last update: 31.07.2026

Version: 0.0.0

Description

Apply kMeans clustering to group data depending on the data's non-linearity.

Inputs

This table lists the input pins for this operator. Input pins define the data that the operator requires to perform its operation. Some inputs are required, while others are optional and provide additional configuration. Each parameter is detailed in the sections that follow the table.

Pin number Name Status Expected type(s)
0 clusters_number int32
1 formula string
2 fields_container Required fields_container
3 component_number int32

clusters_number (Pin 0)

  • Required: No
  • Expected type(s): int32

number of the clusters (dafault is 3)

formula (Pin 1)

  • Required: No
  • Expected type(s): string

formula ('dist'/'dotprod'), default is 'dist'

fields_container (Pin 2)

an iunput fields container containing the data which will be used for the clustering

component_number (Pin 3)

  • Required: No
  • Expected type(s): int32

component number as an int (default is 0), ex '0' for X-displacement, '1' for Y-displacement,...

Outputs

This table lists the output pins for this operator. Output pins provide the results of the operator's computation and can be connected to inputs of other operators or retrieved for further processing. Each output is detailed in the sections that follow the table.

Pin number Name Expected type(s)
0 scoping_clusters scopings_container

scoping_clusters (Pin 0)

Scopings container with the space scoping (entities' ids) corresponding to each of k-clusters

Configurations

This operator supports configuration options that modify its behavior.

mutex

  • Expected type(s): bool
  • Default value: false

If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads.

Scripting

This operator can be accessed through scripting interfaces using these identifiers.

Category: compression

Plugin: core

Scripting name: kmeans_clustering

Full name: compression.kmeans_clustering

Internal name: kmeans_operator

License: any_dpf_supported_increments

Examples

These examples demonstrate how to use this operator in different programming environments. Each example shows how to instantiate the operator, connect the required inputs, and retrieve the output.

C++
#include "dpf_api.h"

ansys::dpf::Operator op("kmeans_operator"); // operator instantiation
op.connect(0, my_clusters_number);
op.connect(1, my_formula);
op.connect(2, my_fields_container);
op.connect(3, my_component_number);
ansys::dpf::ScopingsContainer my_scoping_clusters = op.getOutput<ansys::dpf::ScopingsContainer>(0);
CPython
import ansys.dpf.core as dpf

op = dpf.operators.compression.kmeans_clustering() # operator instantiation
op.inputs.clusters_number.connect(my_clusters_number)
op.inputs.formula.connect(my_formula)
op.inputs.fields_container.connect(my_fields_container)
op.inputs.component_number.connect(my_component_number)
my_scoping_clusters = op.outputs.scoping_clusters()
IPython
import mech_dpf
import Ans.DataProcessing as dpf

op = dpf.operators.compression.kmeans_clustering() # operator instantiation
op.inputs.clusters_number.Connect(my_clusters_number)
op.inputs.formula.Connect(my_formula)
op.inputs.fields_container.Connect(my_fields_container)
op.inputs.component_number.Connect(my_component_number)
my_scoping_clusters = op.outputs.scoping_clusters.GetData()

Changelog

  • Version 0.0.0: Initial release.

Connect with Ansys