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
vtkHyperTreeGridSource::ZCoordinates
vtkDataArray * ZCoordinates
Definition: vtkHyperTreeGridSource.h:317
vtkHyperTreeGridSource::LevelZeroMaterialMap
std::map< vtkIdType, vtkIdType > LevelZeroMaterialMap
Definition: vtkHyperTreeGridSource.h:330
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkHyperTreeGridSource::OutputHTG
vtkHyperTreeGrid * OutputHTG
Definition: vtkHyperTreeGridSource.h:336
vtkHyperTreeGridSource::UseMask
bool UseMask
Definition: vtkHyperTreeGridSource.h:312
vtkHyperTreeGridSource::LevelDescriptors
std::vector< std::string > LevelDescriptors
Definition: vtkHyperTreeGridSource.h:321
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkHyperTreeGridSource
Create a synthetic grid of hypertrees.
Definition: vtkHyperTreeGridSource.h:63
vtkHyperTreeGridSource::LevelZeroMaterialIndex
vtkIdTypeArray * LevelZeroMaterialIndex
Definition: vtkHyperTreeGridSource.h:329
vtkHyperTreeGridAlgorithm::ProcessTrees
virtual int ProcessTrees(vtkHyperTreeGrid *, vtkDataObject *)=0
Main routine to process individual trees in the grid This is pure virtual method to be implemented by...
vtkHyperTreeGridSource::MaxDepth
unsigned int MaxDepth
Definition: vtkHyperTreeGridSource.h:306
vtkHyperTreeGridAlgorithm.h
vtkHyperTreeGridNonOrientedCursor
Objects for traversal a HyperTreeGrid.
Definition: vtkHyperTreeGridNonOrientedCursor.h:50
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
vtkHyperTreeGridSource::BranchFactor
unsigned int BranchFactor
Definition: vtkHyperTreeGridSource.h:309
vtkHyperTreeGridSource::Descriptor
char * Descriptor
Definition: vtkHyperTreeGridSource.h:319
vtkHyperTreeGridSource::TransposedRootIndexing
bool TransposedRootIndexing
Definition: vtkHyperTreeGridSource.h:305
vtkQuadric
evaluate implicit quadric function
Definition: vtkQuadric.h:30
vtkHyperTreeGridSource::DescriptorBits
vtkBitArray * DescriptorBits
Definition: vtkHyperTreeGridSource.h:324
vtkHyperTreeGridAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkHyperTreeGridSource::Mask
char * Mask
Definition: vtkHyperTreeGridSource.h:320
vtkHyperTreeGridSource::LevelBitsIndex
std::vector< vtkIdType > LevelBitsIndex
Definition: vtkHyperTreeGridSource.h:326
vtkImplicitFunction
abstract interface for implicit functions
Definition: vtkImplicitFunction.h:60
vtkHyperTreeGridSource::XCoordinates
vtkDataArray * XCoordinates
Definition: vtkHyperTreeGridSource.h:315
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkObject::GetMTime
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkHyperTreeGridSource::YCoordinates
vtkDataArray * YCoordinates
Definition: vtkHyperTreeGridSource.h:316
vtkHyperTreeGridSource::UseDescriptor
bool UseDescriptor
Definition: vtkHyperTreeGridSource.h:311
vtkX3D::size
@ size
Definition: vtkX3D.h:259
vtkHyperTreeGridSource::GenerateInterfaceFields
bool GenerateInterfaceFields
Definition: vtkHyperTreeGridSource.h:313
vtkHyperTreeGridSource::LevelCounters
std::vector< int > LevelCounters
Definition: vtkHyperTreeGridSource.h:332
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkHyperTreeGridAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkAlgorithm::New
static vtkAlgorithm * New()
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkHyperTreeGridSource::BlockSize
unsigned int BlockSize
Definition: vtkHyperTreeGridSource.h:310
vtkHyperTreeGridSource::Quadric
vtkQuadric * Quadric
Definition: vtkHyperTreeGridSource.h:334
vtkHyperTreeGridSource::Dimension
unsigned int Dimension
Definition: vtkHyperTreeGridSource.h:301
vtkHyperTreeGridAlgorithm::FillOutputPortInformation
int FillOutputPortInformation(int, vtkInformation *) override
Fill the output port information objects for this algorithm.
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkHyperTreeGridSource::SetGridScale
void SetGridScale(double scale)
Definition: vtkHyperTreeGridSource.h:105
vtkHyperTreeGridSource::LevelMasks
std::vector< std::string > LevelMasks
Definition: vtkHyperTreeGridSource.h:322
vtkHyperTreeGridSource::LevelBitsIndexCnt
std::vector< vtkIdType > LevelBitsIndexCnt
Definition: vtkHyperTreeGridSource.h:327
vtkBitArray
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:33
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkHyperTreeGridAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
vtkHyperTreeGridAlgorithm
Superclass for algorithms that produce a hyper tree grid as output.
Definition: vtkHyperTreeGridAlgorithm.h:47
vtkHyperTreeGridSource::MaskBits
vtkBitArray * MaskBits
Definition: vtkHyperTreeGridSource.h:325
vtkHyperTreeGrid
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
Definition: vtkHyperTreeGrid.h:96
vtkHyperTreeGridSource::Orientation
unsigned int Orientation
Definition: vtkHyperTreeGridSource.h:308
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293