VTK  9.1.0
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 =========================================================================*/
45 #ifndef vtkHyperTreeGridSource_h
46 #define vtkHyperTreeGridSource_h
47 
48 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_0_0
49 #include "vtkFiltersSourcesModule.h" // For export macro
51 
52 #include <map> // STL Header
53 #include <string> // STL Header
54 #include <vector> // STL Header
55 
56 class vtkBitArray;
57 class vtkDataArray;
59 class vtkIdTypeArray;
61 class vtkHyperTreeGrid;
62 class vtkQuadric;
63 
64 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
65 {
66 public:
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
71 
72  // @deprecated Replaced by GetMaxDepth() as of VTK 9
73  VTK_DEPRECATED_IN_9_0_0("Use vtkHyperTreeGridSource::GetMaxDepth")
74  unsigned int GetMaximumLevel();
75 
76  // @deprecated Replaced by SetMaxDepth() as of VTK 9
78  void SetMaximumLevel(unsigned int levels);
79 
84  unsigned int GetMaxDepth();
85 
92  void SetMaxDepth(unsigned int levels);
93 
95 
98  vtkSetVector3Macro(Origin, double);
99  vtkGetVector3Macro(Origin, double);
101 
103 
106  vtkSetVector3Macro(GridScale, double);
107  vtkGetVector3Macro(GridScale, double);
108  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
110 
112 
115  void SetDimensions(const unsigned int* dims);
116  void SetDimensions(unsigned int, unsigned int, unsigned int);
117  vtkGetVector3Macro(Dimensions, unsigned int);
119 
121 
125  vtkSetMacro(TransposedRootIndexing, bool);
126  vtkGetMacro(TransposedRootIndexing, bool);
130 
132 
135  vtkGetMacro(Orientation, unsigned int);
137 
139 
142  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
143  vtkGetMacro(BranchFactor, unsigned int);
145 
147 
152  vtkSetMacro(UseDescriptor, bool);
153  vtkGetMacro(UseDescriptor, bool);
154  vtkBooleanMacro(UseDescriptor, bool);
156 
158 
163  vtkSetMacro(UseMask, bool);
164  vtkGetMacro(UseMask, bool);
165  vtkBooleanMacro(UseMask, bool);
167 
169 
174  vtkSetMacro(GenerateInterfaceFields, bool);
175  vtkGetMacro(GenerateInterfaceFields, bool);
176  vtkBooleanMacro(GenerateInterfaceFields, bool);
178 
180 
183  vtkSetStringMacro(Descriptor);
184  vtkGetStringMacro(Descriptor);
186 
188 
191  vtkSetStringMacro(Mask);
192  vtkGetStringMacro(Mask);
194 
196 
200  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
202 
207 
209 
212  virtual void SetMaskBits(vtkBitArray*);
213  vtkGetObjectMacro(MaskBits, vtkBitArray);
215 
217 
220  virtual void SetQuadric(vtkQuadric*);
221  vtkGetObjectMacro(Quadric, vtkQuadric);
223 
225 
228  void SetQuadricCoefficients(double[10]);
229  void GetQuadricCoefficients(double[10]);
232 
236  vtkMTimeType GetMTime() override;
237 
239 
245 
246 protected:
249 
251 
253 
255 
260 
265 
270 
275  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
276 
281  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
282  int idx[3], int parentPos);
283 
288  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
289  int idx[3], int parentPos);
290 
295  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
296 
300  double EvaluateQuadric(double[3]);
301 
302  double Origin[3];
303  double GridScale[3];
304  unsigned int Dimension;
305 
306 protected:
307  unsigned int Dimensions[3];
309  unsigned int MaxDepth;
310 
311  unsigned int Orientation;
312  unsigned int BranchFactor;
313  unsigned int BlockSize;
315  bool UseMask;
317 
321 
322  char* Descriptor;
323  char* Mask;
324  std::vector<std::string> LevelDescriptors;
325  std::vector<std::string> LevelMasks;
326 
329  std::vector<vtkIdType> LevelBitsIndex;
330  std::vector<vtkIdType> LevelBitsIndexCnt;
331 
333  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
334 
335  std::vector<int> LevelCounters;
336 
338 
340 
341 private:
343  void operator=(const vtkHyperTreeGridSource&) = delete;
344 };
345 
346 #endif
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:34
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
general representation of visualization data
Definition: vtkDataObject.h:60
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.
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.
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:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
evaluate implicit quadric function
Definition: vtkQuadric.h:31
@ level
Definition: vtkX3D.h:401
@ scale
Definition: vtkX3D.h:235
@ size
Definition: vtkX3D.h:259
@ string
Definition: vtkX3D.h:496
#define VTK_DEPRECATED_IN_9_0_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287