VTK  9.3.1
vtkKMeansDistanceFunctor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef vtkKMeansDistanceFunctor_h
4 #define vtkKMeansDistanceFunctor_h
5 
18 #include "vtkFiltersStatisticsModule.h" // For export macro
19 #include "vtkObject.h"
20 
21 VTK_ABI_NAMESPACE_BEGIN
22 class vtkVariantArray;
23 class vtkAbstractArray;
24 class vtkTable;
25 
26 class VTKFILTERSSTATISTICS_EXPORT vtkKMeansDistanceFunctor : public vtkObject
27 {
28 public:
29  static vtkKMeansDistanceFunctor* New();
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
37  virtual vtkVariantArray* GetEmptyTuple(vtkIdType dimension);
38 
43  virtual void operator()(double&, vtkVariantArray*, vtkVariantArray*);
44 
53  virtual void PairwiseUpdate(vtkTable* clusterCenters, vtkIdType row, vtkVariantArray* data,
54  vtkIdType dataCardinality, vtkIdType totalCardinality);
55 
64  virtual void PerturbElement(vtkTable*, vtkTable*, vtkIdType, vtkIdType, vtkIdType, double);
65 
71  virtual void* AllocateElementArray(vtkIdType size);
72 
76  virtual void DeallocateElementArray(void*);
77 
83  virtual vtkAbstractArray* CreateCoordinateArray();
84 
90  virtual void PackElements(vtkTable* curTable, void* vElements);
91 
93 
98  virtual void UnPackElements(
99  vtkTable* curTable, vtkTable* newTable, void* vLocalElements, void* vGlobalElements, int np);
100  virtual void UnPackElements(
101  vtkTable* curTable, void* vLocalElements, vtkIdType numRows, vtkIdType numCols);
103 
107  virtual int GetDataType();
108 
109 protected:
111  ~vtkKMeansDistanceFunctor() override;
112 
113  vtkVariantArray* EmptyTuple; // Used to quickly initialize Tuple for each datum
114  vtkTable*
115  CenterUpdates; // Used to hold online computation of next iteration's cluster center coords.
116 
117 private:
119  void operator=(const vtkKMeansDistanceFunctor&) = delete;
120 };
121 
122 VTK_ABI_NAMESPACE_END
123 #endif // vtkKMeansDistanceFunctor_h
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
An array holding vtkVariants.
Abstract superclass for all arrays.
int vtkIdType
Definition: vtkType.h:315
a simple class to control print indentation
Definition: vtkIndent.h:28
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
measure distance from k-means cluster centers