VTK: Filters/Sources/vtkHyperTreeGridSource.h Source File

| VTK 9.3.1

vtkHyperTreeGridSource.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
45 #ifndef vtkHyperTreeGridSource_h
46 #define vtkHyperTreeGridSource_h
47
48 #include "vtkFiltersSourcesModule.h" // For export macro
49 #include "vtkHyperTreeGridAlgorithm.h"
50
51 #include <map> // STL Header
52 #include <string> // STL Header
53 #include <vector> // STL Header
54
55 VTK_ABI_NAMESPACE_BEGIN
56 class vtkBitArray;
57 class vtkDataArray;
58 class vtkHyperTreeGridNonOrientedCursor;
59 class vtkIdTypeArray;
60 class vtkImplicitFunction;
61 class vtkHyperTreeGrid;
62 class vtkQuadric;
63
64 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
65 {
66 public:
67 vtkTypeMacro(vtkHyperTreeGridSource, vtkHyperTreeGridAlgorithm);
68 void PrintSelf(ostream& os, vtkIndent indent) override;
69
70 static vtkHyperTreeGridSource* New();
71
76 unsigned int GetMaxDepth();
77
84 void SetMaxDepth(unsigned int levels);
85
87
90 vtkSetVector3Macro(Origin, double);
91 vtkGetVector3Macro(Origin, double);
93
95
98 vtkSetVector3Macro(GridScale, double);
99 vtkGetVector3Macro(GridScale, double);
100 void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
102
104
107 void SetDimensions(const unsigned int* dims);
108 void SetDimensions(unsigned int, unsigned int, unsigned int);
109 vtkGetVector3Macro(Dimensions, unsigned int);
111
113
117 vtkSetMacro(TransposedRootIndexing, bool);
118 vtkGetMacro(TransposedRootIndexing, bool);
119 void SetIndexingModeToKJI();
120 void SetIndexingModeToIJK();
122
124
127 vtkGetMacro(Orientation, unsigned int);
129
131
134 vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
135 vtkGetMacro(BranchFactor, unsigned int);
137
139
144 vtkSetMacro(UseDescriptor, bool);
145 vtkGetMacro(UseDescriptor, bool);
146 vtkBooleanMacro(UseDescriptor, bool);
148
150
155 vtkSetMacro(UseMask, bool);
156 vtkGetMacro(UseMask, bool);
157 vtkBooleanMacro(UseMask, bool);
159
161
166 vtkSetMacro(GenerateInterfaceFields, bool);
167 vtkGetMacro(GenerateInterfaceFields, bool);
168 vtkBooleanMacro(GenerateInterfaceFields, bool);
170
172
175 vtkSetStringMacro(Descriptor);
176 vtkGetStringMacro(Descriptor);
178
180
183 vtkSetStringMacro(Mask);
184 vtkGetStringMacro(Mask);
186
188
191 virtual void SetDescriptorBits(vtkBitArray*);
192 vtkGetObjectMacro(DescriptorBits, vtkBitArray);
194
198 virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray*);
199
201
204 virtual void SetMaskBits(vtkBitArray*);
205 vtkGetObjectMacro(MaskBits, vtkBitArray);
207
209
212 virtual void SetQuadric(vtkQuadric*);
213 vtkGetObjectMacro(Quadric, vtkQuadric);
215
217
220 void SetQuadricCoefficients(double[10]);
221 void GetQuadricCoefficients(double[10]);
222 double* GetQuadricCoefficients();
224
228 vtkMTimeType GetMTime() override;
229
231
234 vtkBitArray* ConvertDescriptorStringToBitArray(const std::string&);
235 vtkBitArray* ConvertMaskStringToBitArray(const std::string&);
237
238 protected:
239 vtkHyperTreeGridSource();
240 ~vtkHyperTreeGridSource() override;
241
242 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
243
244 int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
245
246 int FillOutputPortInformation(int, vtkInformation*) override;
247
251 int ProcessTrees(vtkHyperTreeGrid*, vtkDataObject*) override;
252
256 int InitializeFromStringDescriptor();
257
261 int InitializeFromBitsDescriptor();
262
266 void InitTreeFromDescriptor(
267 vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
268
272 void SubdivideFromStringDescriptor(vtkHyperTreeGrid* output,
273 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
274 int idx[3], int parentPos);
275
279 void SubdivideFromBitsDescriptor(vtkHyperTreeGrid* output,
280 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
281 int idx[3], int parentPos);
282
286 void SubdivideFromQuadric(vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor,
287 unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
288
292 double EvaluateQuadric(double[3]);
293
294 double Origin[3];
295 double GridScale[3];
296 unsigned int Dimension;
297
298 unsigned int Dimensions[3];
299 bool TransposedRootIndexing;
300 unsigned int MaxDepth;
301
302 unsigned int Orientation;
303 unsigned int BranchFactor;
304 unsigned int BlockSize;
305 bool UseDescriptor;
306 bool UseMask;
307 bool GenerateInterfaceFields;
308
309 vtkDataArray* XCoordinates;
310 vtkDataArray* YCoordinates;
311 vtkDataArray* ZCoordinates;
312
313 char* Descriptor;
314 char* Mask;
315 std::vector<std::string> LevelDescriptors;
316 std::vector<std::string> LevelMasks;
317
318 vtkBitArray* DescriptorBits;
319 vtkBitArray* MaskBits;
320 std::vector<vtkIdType> LevelBitsIndex;
321 std::vector<vtkIdType> LevelBitsIndexCnt;
322
323 vtkIdTypeArray* LevelZeroMaterialIndex;
324 std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
325
326 std::vector<int> LevelCounters;
327
328 vtkQuadric* Quadric;
329
330 vtkHyperTreeGrid* OutputHTG;
331
332 private:
333 vtkHyperTreeGridSource(const vtkHyperTreeGridSource&) = delete;
334 void operator=(const vtkHyperTreeGridSource&) = delete;
335 };
336
337 VTK_ABI_NAMESPACE_END
338 #endif
vtkBitArray
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:29
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkHyperTreeGridAlgorithm
Superclass for algorithms that produce a hyper tree grid as output.
Definition: vtkHyperTreeGridAlgorithm.h:37
vtkHyperTreeGridNonOrientedCursor
Objects for traversal a HyperTreeGrid.
Definition: vtkHyperTreeGridNonOrientedCursor.h:46
vtkHyperTreeGridSource
Create a synthetic grid of hypertrees.
Definition: vtkHyperTreeGridSource.h:65
vtkHyperTreeGridSource::YCoordinates
vtkDataArray * YCoordinates
Definition: vtkHyperTreeGridSource.h:310
vtkHyperTreeGridSource::SetDimensions
void SetDimensions(const unsigned int *dims)
Set/Get the number of root cells + 1 in each dimension of the grid.
vtkHyperTreeGridSource::SetIndexingModeToIJK
void SetIndexingModeToIJK()
Specify whether indexing mode of grid root cells must be transposed to x-axis first,...
vtkHyperTreeGridSource::SetQuadric
virtual void SetQuadric(vtkQuadric *)
Set/Get the quadric function.
vtkHyperTreeGridSource::Orientation
unsigned int Orientation
Definition: vtkHyperTreeGridSource.h:302
vtkHyperTreeGridSource::SetMaskBits
virtual void SetMaskBits(vtkBitArray *)
Set/Get the bitarray used as a material mask.
vtkHyperTreeGridSource::LevelBitsIndex
std::vector< vtkIdType > LevelBitsIndex
Definition: vtkHyperTreeGridSource.h:320
vtkHyperTreeGridSource::RequestData
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkHyperTreeGridSource::InitializeFromStringDescriptor
int InitializeFromStringDescriptor()
Initialize grid from descriptor string when it is to be used.
vtkHyperTreeGridSource::TransposedRootIndexing
bool TransposedRootIndexing
Definition: vtkHyperTreeGridSource.h:299
vtkHyperTreeGridSource::New
static vtkHyperTreeGridSource * New()
vtkHyperTreeGridSource::XCoordinates
vtkDataArray * XCoordinates
Definition: vtkHyperTreeGridSource.h:309
vtkHyperTreeGridSource::GenerateInterfaceFields
bool GenerateInterfaceFields
Definition: vtkHyperTreeGridSource.h:307
vtkHyperTreeGridSource::SetGridScale
void SetGridScale(double scale)
Set/Get the scale to be applied to root cells in each dimension of the grid.
Definition: vtkHyperTreeGridSource.h:100
vtkHyperTreeGridSource::Mask
char * Mask
Definition: vtkHyperTreeGridSource.h:314
vtkHyperTreeGridSource::GetMTime
vtkMTimeType GetMTime() override
Override GetMTime because we delegate to a vtkQuadric.
vtkHyperTreeGridSource::SetLevelZeroMaterialIndex
virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray *)
Set the index array used to as a material mask.
vtkHyperTreeGridSource::EvaluateQuadric
double EvaluateQuadric(double[3])
Evaluate quadric at given point coordinates.
vtkHyperTreeGridSource::UseDescriptor
bool UseDescriptor
Definition: vtkHyperTreeGridSource.h:305
vtkHyperTreeGridSource::FillOutputPortInformation
int FillOutputPortInformation(int, vtkInformation *) override
Define default input and output port types.
vtkHyperTreeGridSource::RequestInformation
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
vtkHyperTreeGridSource::ZCoordinates
vtkDataArray * ZCoordinates
Definition: vtkHyperTreeGridSource.h:311
vtkHyperTreeGridSource::LevelBitsIndexCnt
std::vector< vtkIdType > LevelBitsIndexCnt
Definition: vtkHyperTreeGridSource.h:321
vtkHyperTreeGridSource::ConvertDescriptorStringToBitArray
vtkBitArray * ConvertDescriptorStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
vtkHyperTreeGridSource::MaxDepth
unsigned int MaxDepth
Definition: vtkHyperTreeGridSource.h:300
vtkHyperTreeGridSource::GetMaxDepth
unsigned int GetMaxDepth()
Return the maximum number of levels of the hypertree.
vtkHyperTreeGridSource::SetDimensions
void SetDimensions(unsigned int, unsigned int, unsigned int)
Set/Get the number of root cells + 1 in each dimension of the grid.
vtkHyperTreeGridSource::SetIndexingModeToKJI
void SetIndexingModeToKJI()
Specify whether indexing mode of grid root cells must be transposed to x-axis first,...
vtkHyperTreeGridSource::DescriptorBits
vtkBitArray * DescriptorBits
Definition: vtkHyperTreeGridSource.h:318
vtkHyperTreeGridSource::Dimension
unsigned int Dimension
Definition: vtkHyperTreeGridSource.h:296
vtkHyperTreeGridSource::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkHyperTreeGridSource::LevelZeroMaterialIndex
vtkIdTypeArray * LevelZeroMaterialIndex
Definition: vtkHyperTreeGridSource.h:323
vtkHyperTreeGridSource::OutputHTG
vtkHyperTreeGrid * OutputHTG
Definition: vtkHyperTreeGridSource.h:330
vtkHyperTreeGridSource::LevelMasks
std::vector< std::string > LevelMasks
Definition: vtkHyperTreeGridSource.h:316
vtkHyperTreeGridSource::UseMask
bool UseMask
Definition: vtkHyperTreeGridSource.h:306
vtkHyperTreeGridSource::vtkHyperTreeGridSource
vtkHyperTreeGridSource()
vtkHyperTreeGridSource::LevelCounters
std::vector< int > LevelCounters
Definition: vtkHyperTreeGridSource.h:326
vtkHyperTreeGridSource::SubdivideFromBitsDescriptor
void SubdivideFromBitsDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, int childIdx, int idx[3], int parentPos)
Subdivide grid from descriptor string when it is to be used.
vtkHyperTreeGridSource::Quadric
vtkQuadric * Quadric
Definition: vtkHyperTreeGridSource.h:328
vtkHyperTreeGridSource::InitializeFromBitsDescriptor
int InitializeFromBitsDescriptor()
Initialize grid from bit array descriptors when it is to be used.
vtkHyperTreeGridSource::BlockSize
unsigned int BlockSize
Definition: vtkHyperTreeGridSource.h:304
vtkHyperTreeGridSource::MaskBits
vtkBitArray * MaskBits
Definition: vtkHyperTreeGridSource.h:319
vtkHyperTreeGridSource::~vtkHyperTreeGridSource
~vtkHyperTreeGridSource() override
vtkHyperTreeGridSource::ConvertMaskStringToBitArray
vtkBitArray * ConvertMaskStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
vtkHyperTreeGridSource::SubdivideFromQuadric
void SubdivideFromQuadric(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3])
Subdivide grid from quadric when descriptor is not used.
vtkHyperTreeGridSource::SubdivideFromStringDescriptor
void SubdivideFromStringDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, int childIdx, int idx[3], int parentPos)
Subdivide grid from descriptor string when it is to be used.
vtkHyperTreeGridSource::Descriptor
char * Descriptor
Definition: vtkHyperTreeGridSource.h:313
vtkHyperTreeGridSource::SetMaxDepth
void SetMaxDepth(unsigned int levels)
Set the maximum number of levels of the hypertrees.
vtkHyperTreeGridSource::GetQuadricCoefficients
double * GetQuadricCoefficients()
Helpers to set/get the 10 coefficients of the quadric function.
vtkHyperTreeGridSource::LevelZeroMaterialMap
std::map< vtkIdType, vtkIdType > LevelZeroMaterialMap
Definition: vtkHyperTreeGridSource.h:324
vtkHyperTreeGridSource::BranchFactor
unsigned int BranchFactor
Definition: vtkHyperTreeGridSource.h:303
vtkHyperTreeGridSource::InitTreeFromDescriptor
void InitTreeFromDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, int treeIdx, int idx[3])
Initialize tree grid from descriptor and call subdivide if needed.
vtkHyperTreeGridSource::GetQuadricCoefficients
void GetQuadricCoefficients(double[10])
Helpers to set/get the 10 coefficients of the quadric function.
vtkHyperTreeGridSource::LevelDescriptors
std::vector< std::string > LevelDescriptors
Definition: vtkHyperTreeGridSource.h:315
vtkHyperTreeGridSource::ProcessTrees
int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *) override
Main routine to process individual trees in the grid.
vtkHyperTreeGridSource::SetQuadricCoefficients
void SetQuadricCoefficients(double[10])
Helpers to set/get the 10 coefficients of the quadric function.
vtkHyperTreeGridSource::SetDescriptorBits
virtual void SetDescriptorBits(vtkBitArray *)
Set/Get the bitarray used to describe the grid.
vtkHyperTreeGrid
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
Definition: vtkHyperTreeGrid.h:91
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:37
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:59
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkQuadric
evaluate implicit quadric function
Definition: vtkQuadric.h:32
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkX3D::scale
@ scale
Definition: vtkX3D.h:229
vtkX3D::size
@ size
Definition: vtkX3D.h:253
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkHyperTreeGridAlgorithm.h
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270