VTK  9.2.6
vtkHyperTreeGridSource.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperTreeGridSource.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
57 #ifndef vtkHyperTreeGridSource_h
58 #define vtkHyperTreeGridSource_h
59 
60 #include "vtkFiltersSourcesModule.h" // For export macro
62 
63 #include <map> // STL Header
64 #include <string> // STL Header
65 #include <vector> // STL Header
66 
67 class vtkBitArray;
68 class vtkDataArray;
70 class vtkIdTypeArray;
72 class vtkHyperTreeGrid;
73 class vtkQuadric;
74 
75 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
76 {
77 public:
79  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
82 
87  unsigned int GetMaxDepth();
88 
95  void SetMaxDepth(unsigned int levels);
96 
98 
101  vtkSetVector3Macro(Origin, double);
102  vtkGetVector3Macro(Origin, double);
104 
106 
109  vtkSetVector3Macro(GridScale, double);
110  vtkGetVector3Macro(GridScale, double);
111  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
113 
115 
118  void SetDimensions(const unsigned int* dims);
119  void SetDimensions(unsigned int, unsigned int, unsigned int);
120  vtkGetVector3Macro(Dimensions, unsigned int);
122 
124 
128  vtkSetMacro(TransposedRootIndexing, bool);
129  vtkGetMacro(TransposedRootIndexing, bool);
133 
135 
138  vtkGetMacro(Orientation, unsigned int);
140 
142 
145  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
146  vtkGetMacro(BranchFactor, unsigned int);
148 
150 
155  vtkSetMacro(UseDescriptor, bool);
156  vtkGetMacro(UseDescriptor, bool);
157  vtkBooleanMacro(UseDescriptor, bool);
159 
161 
166  vtkSetMacro(UseMask, bool);
167  vtkGetMacro(UseMask, bool);
168  vtkBooleanMacro(UseMask, bool);
170 
172 
177  vtkSetMacro(GenerateInterfaceFields, bool);
178  vtkGetMacro(GenerateInterfaceFields, bool);
179  vtkBooleanMacro(GenerateInterfaceFields, bool);
181 
183 
186  vtkSetStringMacro(Descriptor);
187  vtkGetStringMacro(Descriptor);
189 
191 
194  vtkSetStringMacro(Mask);
195  vtkGetStringMacro(Mask);
197 
199 
203  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
205 
210 
212 
215  virtual void SetMaskBits(vtkBitArray*);
216  vtkGetObjectMacro(MaskBits, vtkBitArray);
218 
220 
223  virtual void SetQuadric(vtkQuadric*);
224  vtkGetObjectMacro(Quadric, vtkQuadric);
226 
228 
231  void SetQuadricCoefficients(double[10]);
232  void GetQuadricCoefficients(double[10]);
235 
239  vtkMTimeType GetMTime() override;
240 
242 
248 
249 protected:
252 
254 
256 
258 
263 
268 
273 
278  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
279 
284  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
285  int idx[3], int parentPos);
286 
291  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
292  int idx[3], int parentPos);
293 
298  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
299 
303  double EvaluateQuadric(double[3]);
304 
305  double Origin[3];
306  double GridScale[3];
307  unsigned int Dimension;
308 
309 protected:
310  unsigned int Dimensions[3];
312  unsigned int MaxDepth;
313 
314  unsigned int Orientation;
315  unsigned int BranchFactor;
316  unsigned int BlockSize;
318  bool UseMask;
320 
324 
325  char* Descriptor;
326  char* Mask;
327  std::vector<std::string> LevelDescriptors;
328  std::vector<std::string> LevelMasks;
329 
332  std::vector<vtkIdType> LevelBitsIndex;
333  std::vector<vtkIdType> LevelBitsIndexCnt;
334 
336  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
337 
338  std::vector<int> LevelCounters;
339 
341 
343 
344 private:
346  void operator=(const vtkHyperTreeGridSource&) = delete;
347 };
348 
349 #endif
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:37
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:65
general representation of visualization data
Definition: vtkDataObject.h:75
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:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
evaluate implicit quadric function
Definition: vtkQuadric.h:43
@ level
Definition: vtkX3D.h:401
@ scale
Definition: vtkX3D.h:235
@ size
Definition: vtkX3D.h:259
@ string
Definition: vtkX3D.h:496
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287