VTK  9.3.1
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
36 #ifndef vtkHyperTreeGridSource_h
37 #define vtkHyperTreeGridSource_h
38 
39 #include "vtkFiltersSourcesModule.h" // For export macro
41 
42 #include <map> // STL Header
43 #include <string> // STL Header
44 #include <vector> // STL Header
45 
46 VTK_ABI_NAMESPACE_BEGIN
47 class vtkBitArray;
48 class vtkDataArray;
50 class vtkIdTypeArray;
52 class vtkHyperTreeGrid;
53 class vtkQuadric;
54 
55 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
56 {
57 public:
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
61  static vtkHyperTreeGridSource* New();
62 
67  unsigned int GetMaxDepth();
68 
75  void SetMaxDepth(unsigned int levels);
76 
78 
81  vtkSetVector3Macro(Origin, double);
82  vtkGetVector3Macro(Origin, double);
84 
86 
89  vtkSetVector3Macro(GridScale, double);
90  vtkGetVector3Macro(GridScale, double);
91  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
93 
95 
98  void SetDimensions(const unsigned int* dims);
99  void SetDimensions(unsigned int, unsigned int, unsigned int);
100  vtkGetVector3Macro(Dimensions, unsigned int);
102 
104 
108  vtkSetMacro(TransposedRootIndexing, bool);
109  vtkGetMacro(TransposedRootIndexing, bool);
110  void SetIndexingModeToKJI();
111  void SetIndexingModeToIJK();
113 
115 
118  vtkGetMacro(Orientation, unsigned int);
120 
122 
125  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
126  vtkGetMacro(BranchFactor, unsigned int);
128 
130 
135  vtkSetMacro(UseDescriptor, bool);
136  vtkGetMacro(UseDescriptor, bool);
137  vtkBooleanMacro(UseDescriptor, bool);
139 
141 
146  vtkSetMacro(UseMask, bool);
147  vtkGetMacro(UseMask, bool);
148  vtkBooleanMacro(UseMask, bool);
150 
152 
157  vtkSetMacro(GenerateInterfaceFields, bool);
158  vtkGetMacro(GenerateInterfaceFields, bool);
159  vtkBooleanMacro(GenerateInterfaceFields, bool);
161 
163 
166  vtkSetStringMacro(Descriptor);
167  vtkGetStringMacro(Descriptor);
169 
171 
174  vtkSetStringMacro(Mask);
175  vtkGetStringMacro(Mask);
177 
179 
182  virtual void SetDescriptorBits(vtkBitArray*);
183  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
185 
189  virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray*);
190 
192 
195  virtual void SetMaskBits(vtkBitArray*);
196  vtkGetObjectMacro(MaskBits, vtkBitArray);
198 
200 
203  virtual void SetQuadric(vtkQuadric*);
204  vtkGetObjectMacro(Quadric, vtkQuadric);
206 
208 
211  void SetQuadricCoefficients(double[10]);
212  void GetQuadricCoefficients(double[10]);
213  double* GetQuadricCoefficients();
215 
219  vtkMTimeType GetMTime() override;
220 
222 
225  vtkBitArray* ConvertDescriptorStringToBitArray(const std::string&);
226  vtkBitArray* ConvertMaskStringToBitArray(const std::string&);
228 
229 protected:
231  ~vtkHyperTreeGridSource() override;
232 
234 
236 
237  int FillOutputPortInformation(int, vtkInformation*) override;
238 
243 
247  int InitializeFromStringDescriptor();
248 
252  int InitializeFromBitsDescriptor();
253 
257  void InitTreeFromDescriptor(
258  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
259 
263  void SubdivideFromStringDescriptor(vtkHyperTreeGrid* output,
264  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
265  int idx[3], int parentPos);
266 
270  void SubdivideFromBitsDescriptor(vtkHyperTreeGrid* output,
271  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
272  int idx[3], int parentPos);
273 
277  void SubdivideFromQuadric(vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor,
278  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
279 
283  double EvaluateQuadric(double[3]);
284 
285  double Origin[3];
286  double GridScale[3];
287  unsigned int Dimension;
288 
289  unsigned int Dimensions[3];
291  unsigned int MaxDepth;
292 
293  unsigned int Orientation;
294  unsigned int BranchFactor;
295  unsigned int BlockSize;
297  bool UseMask;
299 
303 
304  char* Descriptor;
305  char* Mask;
306  std::vector<std::string> LevelDescriptors;
307  std::vector<std::string> LevelMasks;
308 
311  std::vector<vtkIdType> LevelBitsIndex;
312  std::vector<vtkIdType> LevelBitsIndexCnt;
313 
315  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
316 
317  std::vector<int> LevelCounters;
318 
320 
322 
323 private:
325  void operator=(const vtkHyperTreeGridSource&) = delete;
326 };
327 
328 VTK_ABI_NAMESPACE_END
329 #endif
abstract interface for implicit functions
Create a synthetic grid of hypertrees.
std::vector< vtkIdType > LevelBitsIndexCnt
int FillOutputPortInformation(int, vtkInformation *) override
Define default input and output port types.
Store vtkAlgorithm input/output information.
std::map< vtkIdType, vtkIdType > LevelZeroMaterialMap
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
std::vector< std::string > LevelDescriptors
vtkIdTypeArray * LevelZeroMaterialIndex
dynamic, self-adjusting array of vtkIdType
Objects for traversal a HyperTreeGrid.
std::vector< vtkIdType > LevelBitsIndex
a simple class to control print indentation
Definition: vtkIndent.h:28
evaluate implicit quadric function
Definition: vtkQuadric.h:22
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual vtkMTimeType GetMTime()
Return this object's modified time.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:28
std::vector< std::string > LevelMasks
Superclass for algorithms that produce a hyper tree grid as output.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
std::vector< int > LevelCounters
general representation of visualization data
Definition: vtkDataObject.h:54
void SetGridScale(double scale)
Set/Get the scale to be applied to root cells in each dimension of the grid.
virtual int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *)=0
Main routine to process individual trees in the grid This is pure virtual method to be implemented by...