VTK  9.3.20240419
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
55 #ifndef vtkHyperTreeGridSource_h
56 #define vtkHyperTreeGridSource_h
57 
58 #include "vtkFiltersSourcesModule.h" // For export macro
60 
61 #include <map> // STL Header
62 #include <string> // STL Header
63 #include <vector> // STL Header
64 
65 VTK_ABI_NAMESPACE_BEGIN
66 class vtkBitArray;
67 class vtkDataArray;
69 class vtkIdTypeArray;
71 class vtkHyperTreeGrid;
72 class vtkQuadric;
73 
74 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
75 {
76 public:
78  void PrintSelf(ostream& os, vtkIndent indent) override;
79 
81 
86  unsigned int GetMaxDepth();
87 
94  void SetMaxDepth(unsigned int levels);
95 
97 
100  vtkSetVector3Macro(Origin, double);
101  vtkGetVector3Macro(Origin, double);
103 
105 
108  vtkSetVector3Macro(GridScale, double);
109  vtkGetVector3Macro(GridScale, double);
110  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
112 
114 
117  void SetDimensions(const unsigned int* dims);
118  void SetDimensions(unsigned int, unsigned int, unsigned int);
119  vtkGetVector3Macro(Dimensions, unsigned int);
121 
123 
127  vtkSetMacro(TransposedRootIndexing, bool);
128  vtkGetMacro(TransposedRootIndexing, bool);
132 
134 
137  vtkGetMacro(Orientation, unsigned int);
139 
141 
144  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
145  vtkGetMacro(BranchFactor, unsigned int);
147 
149 
154  vtkSetMacro(UseDescriptor, bool);
155  vtkGetMacro(UseDescriptor, bool);
156  vtkBooleanMacro(UseDescriptor, bool);
158 
160 
165  vtkSetMacro(UseMask, bool);
166  vtkGetMacro(UseMask, bool);
167  vtkBooleanMacro(UseMask, bool);
169 
171 
176  vtkSetMacro(GenerateInterfaceFields, bool);
177  vtkGetMacro(GenerateInterfaceFields, bool);
178  vtkBooleanMacro(GenerateInterfaceFields, bool);
180 
182 
185  vtkSetStringMacro(Descriptor);
186  vtkGetStringMacro(Descriptor);
188 
190 
193  vtkSetStringMacro(Mask);
194  vtkGetStringMacro(Mask);
196 
198 
202  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
204 
209 
211 
214  virtual void SetMaskBits(vtkBitArray*);
215  vtkGetObjectMacro(MaskBits, vtkBitArray);
217 
219 
222  virtual void SetQuadric(vtkQuadric*);
223  vtkGetObjectMacro(Quadric, vtkQuadric);
225 
227 
230  void SetQuadricCoefficients(double[10]);
231  void GetQuadricCoefficients(double[10]);
234 
238  vtkMTimeType GetMTime() override;
239 
241 
247 
248 protected:
251 
253 
255 
257 
262 
267 
272 
277  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
278 
283  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
284  int idx[3], int parentPos);
285 
290  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
291  int idx[3], int parentPos);
292 
297  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
298 
302  double EvaluateQuadric(double[3]);
303 
304  double Origin[3];
305  double GridScale[3];
306  unsigned int Dimension;
307 
308  unsigned int Dimensions[3];
310  unsigned int MaxDepth;
311 
312  unsigned int Orientation;
313  unsigned int BranchFactor;
314  unsigned int BlockSize;
316  bool UseMask;
318 
322 
323  char* Descriptor;
324  char* Mask;
325  std::vector<std::string> LevelDescriptors;
326  std::vector<std::string> LevelMasks;
327 
330  std::vector<vtkIdType> LevelBitsIndex;
331  std::vector<vtkIdType> LevelBitsIndexCnt;
332 
334  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
335 
336  std::vector<int> LevelCounters;
337 
339 
341 
342 private:
344  void operator=(const vtkHyperTreeGridSource&) = delete;
345 };
346 
347 VTK_ABI_NAMESPACE_END
348 #endif
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:29
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:155
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.
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
vtkBitArray * ConvertDescriptorStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
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,...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray * LevelZeroMaterialIndex
std::vector< std::string > LevelMasks
std::vector< int > LevelCounters
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.
int InitializeFromBitsDescriptor()
Initialize grid from bit array descriptors when it is to be used.
~vtkHyperTreeGridSource() override
vtkBitArray * ConvertMaskStringToBitArray(const std::string &)
Helpers to convert string descriptors & mask to bit arrays.
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 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.
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 InitTreeFromDescriptor(vtkHyperTreeGrid *output, vtkHyperTreeGridNonOrientedCursor *cursor, int treeIdx, int idx[3])
Initialize tree grid from descriptor and call subdivide if needed.
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
@ level
Definition: vtkX3D.h:395
@ scale
Definition: vtkX3D.h:229
@ size
Definition: vtkX3D.h:253
@ string
Definition: vtkX3D.h:490
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270