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 =========================================================================*/
48 #ifndef vtkHyperTreeGridSource_h
49 #define vtkHyperTreeGridSource_h
50 
51 #include "vtkFiltersSourcesModule.h" // For export macro
53 
54 #include <map> // STL Header
55 #include <string> // STL Header
56 #include <vector> // STL Header
57 
58 class vtkBitArray;
59 class vtkDataArray;
61 class vtkIdTypeArray;
63 class vtkHyperTreeGrid;
64 class vtkQuadric;
65 
66 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
67 {
68 public:
70  void PrintSelf(ostream& os, vtkIndent indent) override;
71 
72  static vtkHyperTreeGridSource* New();
73 
78  unsigned int GetMaxDepth();
79 
86  void SetMaxDepth(unsigned int levels);
87 
89 
92  vtkSetVector3Macro(Origin, double);
93  vtkGetVector3Macro(Origin, double);
95 
97 
100  vtkSetVector3Macro(GridScale, double);
101  vtkGetVector3Macro(GridScale, double);
102  void SetGridScale(double scale) { this->SetGridScale(scale, scale, scale); }
104 
106 
109  void SetDimensions(const unsigned int* dims);
110  void SetDimensions(unsigned int, unsigned int, unsigned int);
111  vtkGetVector3Macro(Dimensions, unsigned int);
113 
115 
119  vtkSetMacro(TransposedRootIndexing, bool);
120  vtkGetMacro(TransposedRootIndexing, bool);
121  void SetIndexingModeToKJI();
122  void SetIndexingModeToIJK();
124 
126 
129  vtkGetMacro(Orientation, unsigned int);
131 
133 
136  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
137  vtkGetMacro(BranchFactor, unsigned int);
139 
141 
146  vtkSetMacro(UseDescriptor, bool);
147  vtkGetMacro(UseDescriptor, bool);
148  vtkBooleanMacro(UseDescriptor, bool);
150 
152 
157  vtkSetMacro(UseMask, bool);
158  vtkGetMacro(UseMask, bool);
159  vtkBooleanMacro(UseMask, bool);
161 
163 
168  vtkSetMacro(GenerateInterfaceFields, bool);
169  vtkGetMacro(GenerateInterfaceFields, bool);
170  vtkBooleanMacro(GenerateInterfaceFields, bool);
172 
174 
177  vtkSetStringMacro(Descriptor);
178  vtkGetStringMacro(Descriptor);
180 
182 
185  vtkSetStringMacro(Mask);
186  vtkGetStringMacro(Mask);
188 
190 
193  virtual void SetDescriptorBits(vtkBitArray*);
194  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
196 
200  virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray*);
201 
203 
206  virtual void SetMaskBits(vtkBitArray*);
207  vtkGetObjectMacro(MaskBits, vtkBitArray);
209 
211 
214  virtual void SetQuadric(vtkQuadric*);
215  vtkGetObjectMacro(Quadric, vtkQuadric);
217 
219 
222  void SetQuadricCoefficients(double[10]);
223  void GetQuadricCoefficients(double[10]);
224  double* GetQuadricCoefficients();
226 
230  vtkMTimeType GetMTime() override;
231 
233 
236  vtkBitArray* ConvertDescriptorStringToBitArray(const std::string&);
237  vtkBitArray* ConvertMaskStringToBitArray(const std::string&);
239 
240 protected:
242  ~vtkHyperTreeGridSource() override;
243 
245 
247 
248  int FillOutputPortInformation(int, vtkInformation*) override;
249 
254 
258  int InitializeFromStringDescriptor();
259 
263  int InitializeFromBitsDescriptor();
264 
268  void InitTreeFromDescriptor(
269  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
270 
274  void SubdivideFromStringDescriptor(vtkHyperTreeGrid* output,
275  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
276  int idx[3], int parentPos);
277 
281  void SubdivideFromBitsDescriptor(vtkHyperTreeGrid* output,
282  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
283  int idx[3], int parentPos);
284 
288  void SubdivideFromQuadric(vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor,
289  unsigned int level, int treeIdx, const int idx[3], double origin[3], double size[3]);
290 
294  double EvaluateQuadric(double[3]);
295 
296  double Origin[3];
297  double GridScale[3];
298  unsigned int Dimension;
299 
300 protected:
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 
340 #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:287
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:39
evaluate implicit quadric function
Definition: vtkQuadric.h:33
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:55
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:36
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:65
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...