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 =========================================================================*/
27  The top level of the tree is not considered a grid level
28  NB: For ease of legibility, white spaces are allowed and ignored.
29 
30  @par Thanks:
31  This class was written by Philippe Pebay and Joachim Pouderoux,
32  Kitware 2013
33  This work was supported in part by Commissariat a l'Energie Atomique (CEA/DIF)
34 
35  @par Examples:
36  @ref c2_vtk_e_vtkHyperTreeGridSource "vtkHyperTreeGridSource (Examples)"
37 
38  @par Tests:
39  @ref c2_vtk_t_vtkHyperTreeGridSource "vtkHyperTreeGridSource (Tests)"
40 */
41 
42 #ifndef vtkHyperTreeGridSource_h
43 #define vtkHyperTreeGridSource_h
44 
45 #include "vtkFiltersSourcesModule.h" // For export macro
47 
48 #include <string> // STL Header
49 #include <map> // STL Header
50 #include <vector> // STL Header
51 
52 class vtkDataArray;
53 class vtkBitArray;
55 class vtkHyperTreeGrid;
56 class vtkQuadric;
57 
59 {
60 public:
62  void PrintSelf(ostream& os, vtkIndent indent);
63 
64  static vtkHyperTreeGridSource* New();
65 
68  unsigned int GetMaximumLevel();
69 
72  void SetMaximumLevel( unsigned int levels );
73 
75 
76  vtkSetVector3Macro(Origin, double);
77  vtkGetVector3Macro(Origin, double);
79 
81 
83  vtkSetVector3Macro(GridScale, double);
84  vtkGetVector3Macro(GridScale, double);
86 
88 
89  vtkSetVector3Macro(GridSize, unsigned int);
90  vtkGetVector3Macro(GridSize, unsigned int);
92 
94 
97  vtkSetMacro(TransposedRootIndexing, bool);
98  vtkGetMacro(TransposedRootIndexing, bool);
99  void SetIndexingModeToKJI();
100  void SetIndexingModeToIJK();
102 
104 
105  vtkSetClampMacro(BranchFactor, unsigned int, 2, 3);
106  vtkGetMacro(BranchFactor, unsigned int);
108 
110 
111  vtkSetClampMacro(Dimension, unsigned int, 2, 3);
112  vtkGetMacro(Dimension, unsigned int);
114 
116 
118  vtkSetMacro(UseDescriptor, bool);
119  vtkGetMacro(UseDescriptor, bool);
120  vtkBooleanMacro(UseDescriptor, bool);
122 
124 
126  vtkSetMacro(UseMaterialMask, bool);
127  vtkGetMacro(UseMaterialMask, bool);
128  vtkBooleanMacro(UseMaterialMask, bool);
130 
132 
133  vtkSetStringMacro(Descriptor);
134  vtkGetStringMacro(Descriptor);
136 
138 
139  vtkSetStringMacro(MaterialMask);
140  vtkGetStringMacro(MaterialMask);
142 
144 
145  virtual void SetDescriptorBits( vtkBitArray* );
146  vtkGetObjectMacro( DescriptorBits, vtkBitArray );
148 
150  virtual void SetLevelZeroMaterialIndex( vtkIdTypeArray* );
151 
153 
154  virtual void SetMaterialMaskBits( vtkBitArray* );
155  vtkGetObjectMacro( MaterialMaskBits, vtkBitArray );
157 
159 
160  virtual void SetQuadric( vtkQuadric* );
161  vtkGetObjectMacro(Quadric, vtkQuadric);
163 
165 
166  void SetQuadricCoefficients( double[10] );
167  void GetQuadricCoefficients( double[10] );
168  double* GetQuadricCoefficients();
170 
172  unsigned long GetMTime();
173 
175 
176  vtkBitArray* ConvertDescriptorStringToBitArray( const std::string& );
177  vtkBitArray* ConvertMaterialMaskStringToBitArray( const std::string& );
179 
180 protected:
183 
184  int RequestInformation ( vtkInformation*,
187 
188  virtual int RequestData( vtkInformation*,
191 
193  int InitializeFromStringDescriptor();
194 
196  int InitializeFromBitsDescriptor();
197 
199 
200  void InitTreeFromDescriptor( vtkHyperTreeCursor* cursor,
201  int treeIdx,
202  int idx[3] );
204 
206 
207  void SubdivideFromStringDescriptor( vtkHyperTreeCursor* cursor,
208  unsigned int level,
209  int treeIdx,
210  int childIdx,
211  int idx[3],
212  int parentPos );
214 
216 
217  void SubdivideFromBitsDescriptor( vtkHyperTreeCursor* cursor,
218  unsigned int level,
219  int treeIdx,
220  int childIdx,
221  int idx[3],
222  int parentPos );
224 
226 
227  void SubdivideFromQuadric( vtkHyperTreeCursor* cursor,
228  unsigned int level,
229  int treeIdx,
230  const int idx[3],
231  double origin[3],
232  double size[3] );
234 
236  double EvaluateQuadric( double[3] );
237 
238  double Origin[3];
239  double GridScale[3];
240  unsigned int GridSize[3];
242  unsigned int MaximumLevel;
243  unsigned int Dimension;
244  unsigned int BranchFactor;
245  unsigned int BlockSize;
248 
252 
253  char* Descriptor;
255  std::vector<std::string> LevelDescriptors;
256  std::vector<std::string> LevelMaterialMasks;
257 
260  std::vector<vtkIdType> LevelBitsIndex;
261  std::vector<vtkIdType> LevelBitsIndexCnt;
262 
264  std::map<vtkIdType, vtkIdType> LevelZeroMaterialMap;
265 
266  std::vector<int> LevelCounters;
267 
269 
271 
272 private:
273  vtkHyperTreeGridSource(const vtkHyperTreeGridSource&); // Not implemented.
274  void operator=(const vtkHyperTreeGridSource&); // Not implemented.
275 };
276 
277 #endif
abstract interface for implicit functions
Create a synthetic grid of hypertrees.
std::vector< vtkIdType > LevelBitsIndexCnt
The top level of the tree is not considered a grid level white spaces are allowed and ignored par Thanks
Store vtkAlgorithm input/output information.
std::map< vtkIdType, vtkIdType > LevelZeroMaterialMap
The top level of the tree is not considered a grid level NB
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
std::vector< std::string > LevelDescriptors
vtkIdTypeArray * LevelZeroMaterialIndex
dynamic, self-adjusting array of vtkIdType
Objects that can traverse hypertree nodes.
std::vector< vtkIdType > LevelBitsIndex
a simple class to control print indentation
Definition: vtkIndent.h:38
evaluate implicit quadric function
Definition: vtkQuadric.h:35
#define VTKFILTERSSOURCES_EXPORT
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:35
std::vector< std::string > LevelMaterialMasks
Superclass for algorithms that produce a hyper tree grid as output.
Store zero or more vtkInformation instances.
std::vector< int > LevelCounters