VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
88 
89 VTK_ABI_NAMESPACE_BEGIN
90 class vtkDoubleArray;
92 class vtkIdTypeArray;
93 
94 class VTKFILTERSCORE_EXPORT VTK_MARSHALAUTO vtkMultiObjectMassProperties
95  : public vtkPolyDataAlgorithm
96 {
97 public:
99 
104  void PrintSelf(ostream& os, vtkIndent indent) override;
106 
108 
114  vtkSetMacro(SkipValidityCheck, vtkTypeBool);
115  vtkGetMacro(SkipValidityCheck, vtkTypeBool);
116  vtkBooleanMacro(SkipValidityCheck, vtkTypeBool);
118 
120 
125  vtkSetStdStringFromCharMacro(ObjectIdsArrayName);
126  vtkGetCharFromStdStringMacro(ObjectIdsArrayName);
128 
135  vtkIdType GetNumberOfObjects() { return this->NumberOfObjects; }
136 
141  vtkTypeBool GetAllValid() { return this->AllValid; }
142 
147  double GetTotalVolume() { return this->TotalVolume; }
148 
153  double GetTotalArea() { return this->TotalArea; }
154 
155 protected:
157  ~vtkMultiObjectMassProperties() override;
158 
159  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
160  vtkInformationVector* outputVector) override;
161 
162  // Data members supporting API
165  double TotalVolume;
166  double TotalArea;
167 
168  // Internal data members supporting algorithm execution
169  vtkIdType NumberOfObjects; // number of objects identified
170  vtkIdTypeArray* ObjectIds; // for each input polygon, the object id that the polygon is in
171  std::string ObjectIdsArrayName; // the array name of ObjectIds.
172 
173  vtkUnsignedCharArray* ObjectValidity; // is it a valid object?
174  vtkDoubleArray* ObjectVolumes; // what is the object volume (if valid)?
175  vtkDoubleArray* ObjectAreas; // what is the total object area?
176  vtkDoubleArray* ObjectCentroids; // what is the object centroid
177 
178  vtkIdList* CellNeighbors; // avoid repetitive new/delete
179  vtkIdList* Wave; // processing wave
181 
182  // Connected traversal to identify objects
183  void TraverseAndMark(
184  vtkPolyData* output, vtkIdType* objectIds, vtkDataArray* valid, unsigned char* orient);
185 
186 private:
188  void operator=(const vtkMultiObjectMassProperties&) = delete;
189 };
190 
191 VTK_ABI_NAMESPACE_END
192 #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:363
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:71
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:25
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.
#define VTK_MARSHALAUTO
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.