VTK
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 =========================================================================*/
49 #ifndef vtkHyperTreeGridSource_h
50 #define vtkHyperTreeGridSource_h
51 
52 #include "vtkFiltersSourcesModule.h" // For export macro
54 
55 #include <string> // STL Header
56 #include <map> // STL Header
57 #include <vector> // STL Header
58 
59 class vtkDataArray;
60 class vtkBitArray;
62 class vtkHyperTreeGrid;
63 class vtkQuadric;
64 
65 class VTKFILTERSSOURCES_EXPORT vtkHyperTreeGridSource : public vtkHyperTreeGridAlgorithm
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
70 
71  static vtkHyperTreeGridSource* New();
72 
77  unsigned int GetMaximumLevel();
78 
84  void SetMaximumLevel( unsigned int levels );
85 
87 
90  vtkSetVector3Macro(Origin, double);
91  vtkGetVector3Macro(Origin, double);
93 
95 
98  vtkSetVector3Macro(GridScale, double);
99  vtkGetVector3Macro(GridScale, double);
101 
103 
106  vtkSetVector3Macro(GridSize, unsigned int);
107  vtkGetVector3Macro(GridSize, unsigned int);
109 
111 
115  vtkSetMacro(TransposedRootIndexing, bool);
116  vtkGetMacro(TransposedRootIndexing, bool);
117  void SetIndexingModeToKJI();
118  void SetIndexingModeToIJK();
120 
122 
125  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
126  vtkGetMacro(BranchFactor, unsigned int);
128 
130 
133  vtkSetClampMacro(Dimension, unsigned int, 2, 3);
134  vtkGetMacro(Dimension, unsigned int);
136 
138 
143  vtkSetMacro(UseDescriptor, bool);
144  vtkGetMacro(UseDescriptor, bool);
145  vtkBooleanMacro(UseDescriptor, bool);
147 
149 
154  vtkSetMacro(UseMaterialMask, bool);
155  vtkGetMacro(UseMaterialMask, bool);
156  vtkBooleanMacro(UseMaterialMask, bool);
158 
160 
163  vtkSetStringMacro(Descriptor);
164  vtkGetStringMacro(Descriptor);
166 
168 
171  vtkSetStringMacro(MaterialMask);
172  vtkGetStringMacro(MaterialMask);
174 
176 
179  virtual void SetDescriptorBits( vtkBitArray* );
180  vtkGetObjectMacro( DescriptorBits, vtkBitArray );
182 
186  virtual void SetLevelZeroMaterialIndex( vtkIdTypeArray* );
187 
189 
192  virtual void SetMaterialMaskBits( vtkBitArray* );
193  vtkGetObjectMacro( MaterialMaskBits, vtkBitArray );
195 
197 
200  virtual void SetQuadric( vtkQuadric* );
201  vtkGetObjectMacro(Quadric, vtkQuadric);
203 
205 
208  void SetQuadricCoefficients( double[10] );
209  void GetQuadricCoefficients( double[10] );
210  double* GetQuadricCoefficients();
212 
216  vtkMTimeType GetMTime() VTK_OVERRIDE;
217 
219 
222  vtkBitArray* ConvertDescriptorStringToBitArray( const std::string& );
223  vtkBitArray* ConvertMaterialMaskStringToBitArray( const std::string& );
225 
226 protected:
228  ~vtkHyperTreeGridSource() VTK_OVERRIDE;
229 
230  int RequestInformation ( vtkInformation*,
232  vtkInformationVector* ) VTK_OVERRIDE;
233 
234  int RequestData( vtkInformation*,
235  vtkInformationVector**,
236  vtkInformationVector* ) VTK_OVERRIDE;
237 
241  int InitializeFromStringDescriptor();
242 
246  int InitializeFromBitsDescriptor();
247 
251  void InitTreeFromDescriptor( vtkHyperTreeCursor* cursor,
252  int treeIdx,
253  int idx[3] );
254 
258  void SubdivideFromStringDescriptor( vtkHyperTreeCursor* cursor,
259  unsigned int level,
260  int treeIdx,
261  int childIdx,
262  int idx[3],
263  int parentPos );
264 
268  void SubdivideFromBitsDescriptor( vtkHyperTreeCursor* cursor,
269  unsigned int level,
270  int treeIdx,
271  int childIdx,
272  int idx[3],
273  int parentPos );
274 
278  void SubdivideFromQuadric( vtkHyperTreeCursor* cursor,
279  unsigned int level,
280  int treeIdx,
281  const int idx[3],
282  double origin[3],
283  double size[3] );
284 
288  double EvaluateQuadric( double[3] );
289 
290  double Origin[3];
291  double GridScale[3];
292  unsigned int GridSize[3];
293  bool TransposedRootIndexing;
294  unsigned int MaximumLevel;
295  unsigned int Dimension;
296  unsigned int BranchFactor;
297  unsigned int BlockSize;
298  bool UseDescriptor;
299  bool UseMaterialMask;
300 
301  vtkDataArray* XCoordinates;
302  vtkDataArray* YCoordinates;
303  vtkDataArray* ZCoordinates;
304 
305  char* Descriptor;
306  char* MaterialMask;
307  std::vector<std::string> LevelDescriptors;
308  std::vector<std::string> LevelMaterialMasks;
309 
310  vtkBitArray* DescriptorBits;
311  vtkBitArray* MaterialMaskBits;
312  std::vector<vtkIdType> LevelBitsIndex;
313  std::vector<vtkIdType> LevelBitsIndexCnt;
314 
315  vtkIdTypeArray* LevelZeroMaterialIndex;
316  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
317 
318  std::vector<int> LevelCounters;
319 
320  vtkQuadric* Quadric;
321 
323 
324 private:
325  vtkHyperTreeGridSource(const vtkHyperTreeGridSource&) VTK_DELETE_FUNCTION;
326  void operator=(const vtkHyperTreeGridSource&) VTK_DELETE_FUNCTION;
327 };
328 
329 #endif
abstract interface for implicit functions
Create a synthetic grid of hypertrees.
Store vtkAlgorithm input/output information.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:287
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
Objects that can traverse hypertree nodes.
a simple class to control print indentation
Definition: vtkIndent.h:39
evaluate implicit quadric function
Definition: vtkQuadric.h:36
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:54
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:36
Superclass for algorithms that produce a hyper tree grid as output.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.