VTK  9.3.1
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:
155  ~vtkMultiObjectMassProperties() override;
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
181  void TraverseAndMark(
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
double GetTotalArea()
Return the summed area of all objects.
compute volume and area of objects in a polygonal mesh
Store vtkAlgorithm input/output information.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkIdType GetNumberOfObjects()
Return the number of objects identified.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:315
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
double GetTotalVolume()
Return the summed volume of all objects.
dynamic, self-adjusting array of double
static vtkPolyDataAlgorithm * New()
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for algorithms that produce only polydata as output.
a simple class to control print indentation
Definition: vtkIndent.h:28
list of point or cell ids
Definition: vtkIdList.h:22
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
dynamic, self-adjusting array of unsigned char
vtkTypeBool GetAllValid()
Return whether all objects are valid or not.
Store zero or more vtkInformation instances.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.