VTK  9.4.20250102
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
63#ifndef vtkHyperTreeGridSource_h
64#define vtkHyperTreeGridSource_h
65
66#include "vtkFiltersSourcesModule.h" // For export macro
68
69#include <map> // STL Header
70#include <string> // STL Header
71#include <vector> // STL Header
72
73VTK_ABI_NAMESPACE_BEGIN
74class vtkBitArray;
75class vtkDataArray;
77class vtkIdTypeArray;
80class vtkQuadric;
81
82class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
83{
84public:
86 void PrintSelf(ostream& os, vtkIndent indent) override;
87
89
94 unsigned int GetMaxDepth();
95
102 void SetMaxDepth(unsigned int levels);
103
105
108 vtkSetVector3Macro(Origin, double);
109 vtkGetVector3Macro(Origin, double);
111
113
116 vtkSetVector3Macro(GridScale, double);
117 vtkGetVector3Macro(GridScale, double);
118 void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
120
122
125 void SetDimensions(const unsigned int* dims);
126 void SetDimensions(unsigned int, unsigned int, unsigned int);
127 vtkGetVector3Macro(Dimensions, unsigned int);
129
131
135 vtkSetMacro(TransposedRootIndexing, bool);
136 vtkGetMacro(TransposedRootIndexing, bool);
140
142
145 vtkGetMacro(Orientation, unsigned int);
147
149
152 vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
153 vtkGetMacro(BranchFactor, unsigned int);
155
157
162 vtkSetMacro(UseDescriptor, bool);
163 vtkGetMacro(UseDescriptor, bool);
164 vtkBooleanMacro(UseDescriptor, bool);
166
168
173 vtkSetMacro(UseMask, bool);
174 vtkGetMacro(UseMask, bool);
175 vtkBooleanMacro(UseMask, bool);
177
179
184 vtkSetMacro(GenerateInterfaceFields, bool);
185 vtkGetMacro(GenerateInterfaceFields, bool);
186 vtkBooleanMacro(GenerateInterfaceFields, bool);
188
190
193 vtkSetStringMacro(Descriptor);
194 vtkGetStringMacro(Descriptor);
196
198
201 vtkSetStringMacro(Mask);
202 vtkGetStringMacro(Mask);
204
206
210 vtkGetObjectMacro(DescriptorBits, vtkBitArray);
212
217
219
222 virtual void SetMaskBits(vtkBitArray*);
223 vtkGetObjectMacro(MaskBits, vtkBitArray);
225
227
230 virtual void SetQuadric(vtkQuadric*);
231 vtkGetObjectMacro(Quadric, vtkQuadric);
233
235
238 void SetQuadricCoefficients(double[10]);
239 void GetQuadricCoefficients(double[10]);
242
247
249
255
256protected:
259
261
263
265
270
275
280
285 int treeIdx, int idx[3], int offset = 0);
286
293 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
294 int idx[3], int parentPos, int offset = 0);
295
300 vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
301 int idx[3], int parentPos);
302
307 unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
308
312 double EvaluateQuadric(double[3]);
313
314 double Origin[3];
315 double GridScale[3];
316 unsigned int Dimension;
317
318 unsigned int Dimensions[3];
320 unsigned int MaxDepth;
321
322 unsigned int Orientation;
323 unsigned int BranchFactor;
324 unsigned int BlockSize;
328
332
334 char* Mask;
335 std::vector<std::string> LevelDescriptors;
336 std::vector<std::string> LevelMasks;
337
340 std::vector<vtkIdType> LevelBitsIndex;
341 std::vector<vtkIdType> LevelBitsIndexCnt;
342
344 std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
345
346 std::vector<int> LevelCounters;
347
349
351
352private:
354 void operator=(const vtkHyperTreeGridSource&) = delete;
355
356 // Multi-piece utilities
357 int Piece = 0;
358 int NumPieces = 1;
359 int CurrentTreeProcess = 0; // Track the process where next root trees should go
360
366 bool IsLevelDescriptorConsistent(bool isRootLevel, unsigned int nRefined, unsigned int nLeaves,
367 unsigned int nTotal, unsigned int nNextLevel, const std::ostringstream& descriptor);
368};
369
370VTK_ABI_NAMESPACE_END
371#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:29
abstract superclass for arrays of numeric data
general representation of visualization data
Superclass for algorithms that produce a hyper tree grid as output.
Objects for traversal a HyperTreeGrid.
Create a synthetic grid of hypertrees.
void SetDimensions(const unsigned int *dims)
Set/Get the number of root cells + 1 in each dimension of the grid.
void SetIndexingModeToIJK()
Specify whether indexing mode of grid root cells must be transposed to x-axis first,...
virtual void SetQuadric(vtkQuadric *)
Set/Get the quadric function.
virtual void SetMaskBits(vtkBitArray *)
Set/Get the bitarray used as a material mask.
std::vector< vtkIdType > LevelBitsIndex
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int InitializeFromStringDescriptor()
Initialize grid from descriptor string when it is to be used.
static vtkHyperTreeGridSource * New()
void SetGridScale(double scale)
Set/Get the scale to be applied to root cells in each dimension of the grid.
void InitTreeFromDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, int treeIdx, int idx[3], int offset=0)
Initialize tree grid from descriptor and call subdivide if needed.
vtkMTimeType GetMTime() override
Override GetMTime because we delegate to a vtkQuadric.
virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray *)
Set the index array used to as a material mask.
double EvaluateQuadric(double[3])
Evaluate quadric at given point coordinates.
int FillOutputPortInformation(int, vtkInformation *) override
Define default input and output port types.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
std::vector< vtkIdType > LevelBitsIndexCnt
unsigned int GetMaxDepth()
Return the maximum number of levels of the hypertree.
void SetDimensions(unsigned int, unsigned int, unsigned int)
Set/Get the number of root cells + 1 in each dimension of the grid.
void SetIndexingModeToKJI()
Specify whether indexing mode of grid root cells must be transposed to x-axis first,...
vtkBitArray * ConvertDescriptorStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray * LevelZeroMaterialIndex
void SubdivideFromStringDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, unsigned int level, int treeIdx, int childIdx, int idx[3], int parentPos, int offset=0)
Subdivide grid from descriptor string when it is to be used offset represents the offset reading in t...
std::vector< std::string > LevelMasks
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.
vtkBitArray * ConvertMaskStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
int InitializeFromBitsDescriptor()
Initialize grid from bit array descriptors when it is to be used.
~vtkHyperTreeGridSource() override
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.
void SetMaxDepth(unsigned int levels)
Set the maximum number of levels of the hypertrees.
double * GetQuadricCoefficients()
Helpers to set/get the 10 coefficients of the quadric function.
std::map< vtkIdType, vtkIdType > LevelZeroMaterialMap
void GetQuadricCoefficients(double[10])
Helpers to set/get the 10 coefficients of the quadric function.
std::vector< std::string > LevelDescriptors
int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *) override
Main routine to process individual trees in the grid.
void SetQuadricCoefficients(double[10])
Helpers to set/get the 10 coefficients of the quadric function.
virtual void SetDescriptorBits(vtkBitArray *)
Set/Get the bitarray used to describe the grid.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
dynamic, self-adjusting array of vtkIdType
abstract interface for implicit functions
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
evaluate implicit quadric function
Definition vtkQuadric.h:112
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270