VTK  9.0.2
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 "vtkFiltersSourcesModule.h" // For export macro
50 
51 #include <map> // STL Header
52 #include <string> // STL Header
53 #include <vector> // STL Header
54 
55 class vtkBitArray;
56 class vtkDataArray;
58 class vtkIdTypeArray;
60 class vtkHyperTreeGrid;
61 class vtkQuadric;
62 
63 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
64 {
65 public:
67  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
71  // @deprecated Replaced by GetMaxDepth() as of VTK 9
72  VTK_LEGACY(unsigned int GetMaximumLevel());
73 
74  // @deprecated Replaced by SetMaxDepth() as of VTK 9
75  VTK_LEGACY(void SetMaximumLevel(unsigned int levels));
76 
81  unsigned int GetMaxDepth();
82 
89  void SetMaxDepth(unsigned int levels);
90 
92 
95  vtkSetVector3Macro(Origin, double);
96  vtkGetVector3Macro(Origin, double);
98 
100 
103  vtkSetVector3Macro(GridScale, double);
104  vtkGetVector3Macro(GridScale, double);
105  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
107 
109 
112  void SetDimensions(const unsigned int* dims);
113  void SetDimensions(unsigned int, unsigned int, unsigned int);
114  vtkGetVector3Macro(Dimensions, unsigned int);
116 
118 
122  vtkSetMacro(TransposedRootIndexing, bool);
123  vtkGetMacro(TransposedRootIndexing, bool);
127 
129 
132  vtkGetMacro(Orientation, unsigned int);
134 
136 
139  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
140  vtkGetMacro(BranchFactor, unsigned int);
142 
144 
149  vtkSetMacro(UseDescriptor, bool);
150  vtkGetMacro(UseDescriptor, bool);
151  vtkBooleanMacro(UseDescriptor, bool);
153 
155 
160  vtkSetMacro(UseMask, bool);
161  vtkGetMacro(UseMask, bool);
162  vtkBooleanMacro(UseMask, bool);
164 
166 
171  vtkSetMacro(GenerateInterfaceFields, bool);
172  vtkGetMacro(GenerateInterfaceFields, bool);
173  vtkBooleanMacro(GenerateInterfaceFields, bool);
175 
177 
180  vtkSetStringMacro(Descriptor);
181  vtkGetStringMacro(Descriptor);
183 
185 
188  vtkSetStringMacro(Mask);
189  vtkGetStringMacro(Mask);
191 
193 
197  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
199 
204 
206 
209  virtual void SetMaskBits(vtkBitArray*);
210  vtkGetObjectMacro(MaskBits, vtkBitArray);
212 
214 
217  virtual void SetQuadric(vtkQuadric*);
218  vtkGetObjectMacro(Quadric, vtkQuadric);
220 
222 
225  void SetQuadricCoefficients(double[10]);
226  void GetQuadricCoefficients(double[10]);
229 
233  vtkMTimeType GetMTime() override;
234 
236 
242 
243 protected:
246 
248 
250 
252 
257 
262 
267 
272  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
273 
278  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
279  int idx[3], int parentPos);
280 
285  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
286  int idx[3], int parentPos);
287 
292  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
293 
297  double EvaluateQuadric(double[3]);
298 
299  double Origin[3];
300  double GridScale[3];
301  unsigned int Dimension;
302 
303 protected:
304  unsigned int Dimensions[3];
306  unsigned int MaxDepth;
307 
308  unsigned int Orientation;
309  unsigned int BranchFactor;
310  unsigned int BlockSize;
312  bool UseMask;
314 
318 
319  char* Descriptor;
320  char* Mask;
321  std::vector<std::string> LevelDescriptors;
322  std::vector<std::string> LevelMasks;
323 
326  std::vector<vtkIdType> LevelBitsIndex;
327  std::vector<vtkIdType> LevelBitsIndexCnt;
328 
330  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
331 
332  std::vector<int> LevelCounters;
333 
335 
337 
338 private:
340  void operator=(const vtkHyperTreeGridSource&) = delete;
341 };
342 
343 #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.
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)
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
Fill the output port information objects for this algorithm.
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)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkIdTypeArray * LevelZeroMaterialIndex
unsigned int GetMaximumLevel()
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 &)
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()
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 SetMaximumLevel(unsigned int levels)
void GetQuadricCoefficients(double[10])
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
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293