VTK  9.7.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
44 #ifndef vtkHyperTreeGridSource_h
45 #define vtkHyperTreeGridSource_h
46 
47 #include "vtkFiltersSourcesModule.h" // For export macro
49 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
50 
51 #include <map> // STL Header
52 #include <string> // STL Header
53 #include <vector> // STL Header
54 
55 VTK_ABI_NAMESPACE_BEGIN
56 class vtkBitArray;
57 class vtkDataArray;
59 class vtkIdTypeArray;
61 class vtkHyperTreeGrid;
62 class vtkQuadric;
63 
64 class VTKFILTERSSOURCES_EXPORT VTK_MARSHALAUTO vtkHyperTreeGridSource
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
71  static vtkHyperTreeGridSource* New();
72 
77  unsigned int GetMaxDepth();
78 
85  void SetMaxDepth(unsigned int levels);
86 
88 
91  vtkSetVector3Macro(Origin, double);
92  vtkGetVector3Macro(Origin, double);
94 
96 
99  vtkSetVector3Macro(GridScale, double);
100  vtkGetVector3Macro(GridScale, double);
101  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
103 
105 
108  void SetDimensions(const unsigned int* dims);
109  void SetDimensions(unsigned int, unsigned int, unsigned int);
110  vtkGetVector3Macro(Dimensions, unsigned int);
112 
114 
118  vtkSetMacro(TransposedRootIndexing, bool);
119  vtkGetMacro(TransposedRootIndexing, bool);
120  void SetIndexingModeToKJI();
121  void SetIndexingModeToIJK();
123 
125 
128  vtkGetMacro(Orientation, unsigned int);
130 
132 
135  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
136  vtkGetMacro(BranchFactor, unsigned int);
138 
140 
145  vtkSetMacro(UseDescriptor, bool);
146  vtkGetMacro(UseDescriptor, bool);
147  vtkBooleanMacro(UseDescriptor, bool);
149 
151 
156  vtkSetMacro(UseMask, bool);
157  vtkGetMacro(UseMask, bool);
158  vtkBooleanMacro(UseMask, bool);
160 
162 
167  vtkSetMacro(GenerateInterfaceFields, bool);
168  vtkGetMacro(GenerateInterfaceFields, bool);
169  vtkBooleanMacro(GenerateInterfaceFields, bool);
171 
173 
176  vtkSetStringMacro(Descriptor);
177  vtkGetStringMacro(Descriptor);
179 
181 
184  vtkSetStringMacro(Mask);
185  vtkGetStringMacro(Mask);
187 
189 
192  virtual void SetDescriptorBits(vtkBitArray*);
193  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
195 
199  virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray*);
200 
202 
205  virtual void SetMaskBits(vtkBitArray*);
206  vtkGetObjectMacro(MaskBits, vtkBitArray);
208 
210 
213  virtual void SetQuadric(vtkQuadric*);
214  vtkGetObjectMacro(Quadric, vtkQuadric);
216 
218 
221  void SetQuadricCoefficients(double[10]);
222  void GetQuadricCoefficients(double[10]);
223  double* GetQuadricCoefficients();
225 
229  vtkMTimeType GetMTime() override;
230 
232 
235  vtkBitArray* ConvertDescriptorStringToBitArray(const std::string&);
236  vtkBitArray* ConvertMaskStringToBitArray(const std::string&);
238 
239 protected:
241  ~vtkHyperTreeGridSource() override;
242 
244 
246 
247  int FillOutputPortInformation(int, vtkInformation*) override;
248 
253 
257  int InitializeFromStringDescriptor();
258 
262  int InitializeFromBitsDescriptor();
263 
267  void InitTreeFromDescriptor(vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor,
268  int treeIdx, int idx[3], int offset = 0);
269 
275  void SubdivideFromStringDescriptor(vtkHyperTreeGrid* output,
276  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
277  int idx[3], int parentPos, int offset = 0);
278 
282  void SubdivideFromBitsDescriptor(vtkHyperTreeGrid* output,
283  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
284  int idx[3], int parentPos);
285 
289  void SubdivideFromQuadric(vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor,
290  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
291 
295  double EvaluateQuadric(double[3]);
296 
297  double Origin[3];
298  double GridScale[3];
299  unsigned int Dimension;
300 
301  unsigned int Dimensions[3];
303  unsigned int MaxDepth;
304 
305  unsigned int Orientation;
306  unsigned int BranchFactor;
307  unsigned int BlockSize;
309  bool UseMask;
311 
315 
316  char* Descriptor;
317  char* Mask;
318  std::vector<std::string> LevelDescriptors;
319  std::vector<std::string> LevelMasks;
320 
323  std::vector<vtkIdType> LevelBitsIndex;
324  std::vector<vtkIdType> LevelBitsIndexCnt;
325 
327  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
328 
329  std::vector<int> LevelCounters;
330 
332 
334 
335 private:
337  void operator=(const vtkHyperTreeGridSource&) = delete;
338 
339  // Multi-piece utilities
340  int Piece = 0;
341  int NumPieces = 1;
342  int CurrentTreeProcess = 0; // Track the process where next root trees should go
343 
349  bool IsLevelDescriptorConsistent(bool isRootLevel, unsigned int nRefined, unsigned int nLeaves,
350  unsigned int nTotal, unsigned int nNextLevel, const std::ostringstream& descriptor);
351 };
352 
353 VTK_ABI_NAMESPACE_END
354 #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:318
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:32
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::map< DataSetType, DataSet > Piece
Definition: VTXTypes.h:43
#define VTK_MARSHALAUTO
std::vector< int > LevelCounters
general representation of visualization data
Definition: vtkDataObject.h:55
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...