VTK  9.0.1
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 
69  static vtkHyperTreeGridSource* New();
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);
124  void SetIndexingModeToKJI();
125  void SetIndexingModeToIJK();
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 
196  virtual void SetDescriptorBits(vtkBitArray*);
197  vtkGetObjectMacro(DescriptorBits, vtkBitArray);
199 
203  virtual void SetLevelZeroMaterialIndex(vtkIdTypeArray*);
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]);
227  double* GetQuadricCoefficients();
229 
233  vtkMTimeType GetMTime() override;
234 
236 
239  vtkBitArray* ConvertDescriptorStringToBitArray(const std::string&);
240  vtkBitArray* ConvertMaskStringToBitArray(const std::string&);
242 
243 protected:
245  ~vtkHyperTreeGridSource() override;
246 
248 
250 
251  int FillOutputPortInformation(int, vtkInformation*) override;
252 
257 
261  int InitializeFromStringDescriptor();
262 
266  int InitializeFromBitsDescriptor();
267 
271  void InitTreeFromDescriptor(
272  vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor, int treeIdx, int idx[3]);
273 
277  void SubdivideFromStringDescriptor(vtkHyperTreeGrid* output,
278  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
279  int idx[3], int parentPos);
280 
284  void SubdivideFromBitsDescriptor(vtkHyperTreeGrid* output,
285  vtkHyperTreeGridNonOrientedCursor* cursor, unsigned int level, int treeIdx, int childIdx,
286  int idx[3], int parentPos);
287 
291  void SubdivideFromQuadric(vtkHyperTreeGrid* output, vtkHyperTreeGridNonOrientedCursor* cursor,
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
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:293
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:33
evaluate implicit quadric function
Definition: vtkQuadric.h:30
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:49
virtual vtkMTimeType GetMTime()
Return this object&#39;s modified time.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:33
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:59
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...