VTK  9.3.20240418
vtkMultiObjectMassProperties.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
82 #ifndef vtkMultiObjectMassProperties_h
83 #define vtkMultiObjectMassProperties_h
84 
85 #include "vtkFiltersCoreModule.h" // For export macro
86 #include "vtkPolyDataAlgorithm.h"
87 
88 VTK_ABI_NAMESPACE_BEGIN
89 class vtkDoubleArray;
91 class vtkIdTypeArray;
92 
93 class VTKFILTERSCORE_EXPORT vtkMultiObjectMassProperties : public vtkPolyDataAlgorithm
94 {
95 public:
97 
102  void PrintSelf(ostream& os, vtkIndent indent) override;
104 
106 
112  vtkSetMacro(SkipValidityCheck, vtkTypeBool);
113  vtkGetMacro(SkipValidityCheck, vtkTypeBool);
114  vtkBooleanMacro(SkipValidityCheck, vtkTypeBool);
116 
118 
123  vtkSetStdStringFromCharMacro(ObjectIdsArrayName);
124  vtkGetCharFromStdStringMacro(ObjectIdsArrayName);
126 
133  vtkIdType GetNumberOfObjects() { return this->NumberOfObjects; }
134 
139  vtkTypeBool GetAllValid() { return this->AllValid; }
140 
145  double GetTotalVolume() { return this->TotalVolume; }
146 
151  double GetTotalArea() { return this->TotalArea; }
152 
153 protected:
156 
157  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
158  vtkInformationVector* outputVector) override;
159 
160  // Data members supporting API
163  double TotalVolume;
164  double TotalArea;
165 
166  // Internal data members supporting algorithm execution
167  vtkIdType NumberOfObjects; // number of objects identified
168  vtkIdTypeArray* ObjectIds; // for each input polygon, the object id that the polygon is in
169  std::string ObjectIdsArrayName; // the array name of ObjectIds.
170 
171  vtkUnsignedCharArray* ObjectValidity; // is it a valid object?
172  vtkDoubleArray* ObjectVolumes; // what is the object volume (if valid)?
173  vtkDoubleArray* ObjectAreas; // what is the total object area?
174  vtkDoubleArray* ObjectCentroids; // what is the object centroid
175 
176  vtkIdList* CellNeighbors; // avoid repetitive new/delete
177  vtkIdList* Wave; // processing wave
179 
180  // Connected traversal to identify objects
182  vtkPolyData* output, vtkIdType* objectIds, vtkDataArray* valid, unsigned char* orient);
183 
184 private:
186  void operator=(const vtkMultiObjectMassProperties&) = delete;
187 };
188 
189 VTK_ABI_NAMESPACE_END
190 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:155
dynamic, self-adjusting array of double
list of point or cell ids
Definition: vtkIdList.h:133
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
compute volume and area of objects in a polygonal mesh
vtkSetStdStringFromCharMacro(ObjectIdsArrayName)
Set/Get the name of the ObjectIds array.
static vtkMultiObjectMassProperties * New()
Standard methods for construction, type and printing.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
~vtkMultiObjectMassProperties() override
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for construction, type and printing.
vtkGetCharFromStdStringMacro(ObjectIdsArrayName)
Set/Get the name of the ObjectIds array.
void TraverseAndMark(vtkPolyData *output, vtkIdType *objectIds, vtkDataArray *valid, unsigned char *orient)
double GetTotalArea()
Return the summed area of all objects.
vtkIdType GetNumberOfObjects()
Return the number of objects identified.
double GetTotalVolume()
Return the summed volume of all objects.
vtkTypeBool GetAllValid()
Return whether all objects are valid or not.
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:181
dynamic, self-adjusting array of unsigned char
@ string
Definition: vtkX3D.h:490
int vtkTypeBool
Definition: vtkABI.h:64
int vtkIdType
Definition: vtkType.h:315