VTK
vtkHyperTreeGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperTreeGrid.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 =========================================================================*/
46 #ifndef vtkHyperTreeGrid_h
47 #define vtkHyperTreeGrid_h
48 
49 #include "vtkCommonDataModelModule.h" // For export macro
50 #include "vtkDataSet.h"
51 #include <map> // STL header for dual point coordinates ajustment
52 
53 class vtkHyperTreeCursor;
54 class vtkHyperTree;
55 
56 class vtkBitArray;
57 class vtkCellLinks;
58 class vtkCollection;
59 class vtkDataArray;
61 class vtkIdTypeArray;
62 class vtkLine;
63 class vtkPixel;
64 class vtkPoints;
65 class vtkVoxel;
66 
68 {
69 public:
70 //BTX
74 //ETX
75 
79  static vtkHyperTreeGrid* New();
80 
82  void PrintSelf( ostream&, vtkIndent );
83 
86 
90 
92 
93  void SetGridSize( unsigned int[3] );
94  void SetGridSize( unsigned int i, unsigned int j, unsigned int k );
95  vtkGetVector3Macro(GridSize, unsigned int);
97 
99 
100  void SetGridExtent(int extent[6]);
101  void SetGridExtent(int iMin, int iMax, int jMin, int jMax,
102  int kMin, int kMax);
104 
106 
109  vtkSetMacro(TransposedRootIndexing, bool);
110  vtkGetMacro(TransposedRootIndexing, bool);
112  { this->SetTransposedRootIndexing( false ); }
114  { this->SetTransposedRootIndexing( true ); }
116 
118 
120  void SetBranchFactor( unsigned int );
121  vtkGetMacro(BranchFactor, unsigned int);
123 
125 
126  void SetDimension( unsigned int );
127  vtkGetMacro(Dimension, unsigned int);
129 
132 
135 
138 
141 
144 
146 
150 
152 
156 
158 
162 
164 
168 
170 
172  vtkGetObjectMacro(MaterialMaskIndex, vtkIdTypeArray);
174 
176  virtual void GenerateTrees();
177 
181 
186 
191  virtual double* GetPoint( vtkIdType );
192 
198  virtual void GetPoint( vtkIdType, double[3] );
199 
204  virtual vtkCell* GetCell( vtkIdType );
205 
212  virtual void GetCell( vtkIdType, vtkGenericCell* );
213 
218  virtual int GetCellType( vtkIdType );
219 
225  virtual void GetCellPoints( vtkIdType, vtkIdList* );
226 
230 
236  virtual void GetPointCells( vtkIdType, vtkIdList* );
237 
247 
251  virtual vtkIdType FindPoint( double x[3] );
252 
254 
264  virtual vtkIdType FindCell( double x[3], vtkCell *cell, vtkIdType cellId,
265  double tol2, int& subId, double pcoords[3],
266  double *weights );
268 
270 
275  virtual vtkIdType FindCell( double x[3], vtkCell *cell,
276  vtkGenericCell *gencell, vtkIdType cellId,
277  double tol2, int& subId, double pcoords[3],
278  double *weights );
280 
282  void Initialize();
283 
286 
290  virtual int GetMaxCellSize();
291 
293 
297 
299  int GetExtentType() { return VTK_3D_EXTENT; }
300 
306  unsigned long GetActualMemorySize();
307 
310 
311 //BTX
312 #ifndef __WRAP__
313 
314 
318  unsigned int,
319  unsigned int,
320  unsigned int,
321  vtkIdType );
323  vtkIdType );
325 
326 
330  unsigned int childIdx );
331 #endif
332 //ETX
334 
336 
337  vtkGetMacro(NumberOfChildren, unsigned int);
339 
341 
344  unsigned int &i,
345  unsigned int &j,
346  unsigned int &k );
348 
349 protected:
350  // Constructor with default bounds (0,1, 0,1, 0,1).
353 
355 
357 
361 
362  unsigned int Dimension; // 1, 2 or 3.
363  unsigned int GridSize[3];
364  int Extent[6];
365  unsigned int BranchFactor;
366  unsigned int NumberOfChildren;
368 
371 
375 
376  std::map<vtkIdType, vtkHyperTree*> HyperTrees;
377 
380  std::map<vtkIdType, bool> PointShifted;
381  std::map<vtkIdType, double> PointShifts[3];
382  std::map<vtkIdType, double> ReductionFactors;
383 
385  void DeleteTrees();
386 
387 //BTX
388 #if !defined(__WRAP__) && !defined(__WRAP_GCCXML__)
390 
392 
394 
396 #endif
397 //ETX
398 
399  // Used to advance the super cursor; One Entry per cursor node.
400  // Private.
402  {
403  // For the new node, start with the node in super cursor as parent.
404  unsigned char Parent;
405  // Traverse to this child.
406  unsigned char Child;
407  };
408 
409  // Generalizing for 27 tree. Cannot use 3 bits to encode the child to move to.
410  // Input: root in supercursor(3x3x3=27), child(3x3x3=27)
411  // Output: root, child
412  // It is easier to abstract dimensions when we use a single array.
413  vtkSuperCursorEntry SuperCursorTraversalTable[27*27];
414 
415  // for the GetCell method
419 
420  // I would like to get rid of this.
421  // Is it a part of the vtkDataSet API?
423  void BuildLinks();
424 
425 //BTX
427  vtkHyperTreeSimpleCursor* cursor,
428  double* origin, double* size);
429 //ETX
430 
431 public:
432 
433 //BTX
434  // A simplified hyper tree cursor, to be used by the hyper tree
435  // grid supercursor.
437  {
438  public:
440 
441  void Clear();
443  void ToRoot();
444  void ToChild( int );
445  bool IsLeaf();
446  vtkHyperTree* GetTree() { return this->Tree; }
447  vtkIdType GetLeafIndex() { return this->Index; } // Only valid for leaves.
449  unsigned short GetLevel() { return this->Level; }
450 
451  private:
452  vtkHyperTree* Tree;
453  vtkIdType Index;
454  unsigned short Level;
455  bool Leaf;
456  };
457 
459  {
460  public:
462 
465 
469 
473 
474  protected:
475  std::map<vtkIdType, vtkHyperTree*>::iterator Iterator;
477  };
478 
479  // Public structure filters use to move around the tree.
480  // The super cursor keeps neighbor cells so filters can
481  // easily access neighbor to leaves.
482  // The super cursor is 'const'. Methods in vtkHyperTreeGrid
483  // initialize and compute children for moving toward leaves.
485  {
486  double Origin[3];
487  double Size[3];
490  vtkHyperTreeSimpleCursor Cursors[3*3*3];
491 
493  {
494  return this->Cursors + this->MiddleCursorId + idx;
495  }
496  };
497 //ETX
498 
499 private:
500  vtkHyperTreeGrid(const vtkHyperTreeGrid&); // Not implemented.
501  void operator=(const vtkHyperTreeGrid&); // Not implemented.
502 };
503 
504 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkHyperTreeGrid::GetActualMemorySize
unsigned long GetActualMemorySize()
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::GetGlobalNodeIndex
vtkIdType GetGlobalNodeIndex()
vtkHyperTreeGrid::EvaluateDualCorner
void EvaluateDualCorner(vtkHyperTreeSimpleCursor *)
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::GetLeafIndex
vtkIdType GetLeafIndex()
Definition: vtkHyperTreeGrid.h:447
vtkHyperTreeGrid::Links
vtkCellLinks * Links
Definition: vtkHyperTreeGrid.h:422
vtkGetObjectMacro
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:232
vtkHyperTreeGrid::BranchFactor
unsigned int BranchFactor
Definition: vtkHyperTreeGrid.h:365
vtkHyperTreeGrid::ZCoordinates
vtkDataArray * ZCoordinates
Definition: vtkHyperTreeGrid.h:374
vtkgl::weights
const GLbyte * weights
Definition: vtkgl.h:12766
vtkHyperTreeGrid::GetConnectivity
vtkIdTypeArray * GetConnectivity()
vtkHyperTreeGrid::TransposedRootIndexing
bool TransposedRootIndexing
Definition: vtkHyperTreeGrid.h:367
vtkHyperTreeGrid::GetNumberOfLevels
vtkIdType GetNumberOfLevels(vtkIdType)
vtkHyperTreeGrid::Initialize
void Initialize()
vtkHyperTreeGrid::Connectivity
vtkIdTypeArray * Connectivity
Definition: vtkHyperTreeGrid.h:379
vtkHyperTreeGrid::vtkHyperTreeIterator::GetNextTree
vtkHyperTree * GetNextTree()
vtkIdType
int vtkIdType
Definition: vtkType.h:275
vtkHyperTreeGrid::SetDimension
void SetDimension(unsigned int)
vtkCommonDataModelModule.h
vtkHyperTreeGrid::GetCellType
virtual int GetCellType(vtkIdType)
vtkHyperTreeGrid::vtkHyperTreeIterator
Definition: vtkHyperTreeGrid.h:459
vtkHyperTreeGrid::LEVELS
static vtkInformationIntegerKey * LEVELS()
vtkDataSetAttributes
represent and manipulate attribute data in a dataset
Definition: vtkDataSetAttributes.h:58
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::vtkHyperTreeSimpleCursor
vtkHyperTreeSimpleCursor()
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::Clear
void Clear()
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::ToChild
void ToChild(int)
vtkHyperTreeGrid::Points
vtkPoints * Points
Definition: vtkHyperTreeGrid.h:378
vtkHyperTreeGrid::ReductionFactors
std::map< vtkIdType, double > ReductionFactors
Definition: vtkHyperTreeGrid.h:382
vtkHyperTreeGrid::GetExtentType
int GetExtentType()
Definition: vtkHyperTreeGrid.h:299
vtkHyperTreeGrid::vtkHyperTreeGridSuperCursor::NumberOfCursors
int NumberOfCursors
Definition: vtkHyperTreeGrid.h:488
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkHyperTreeGrid::Line
vtkLine * Line
Definition: vtkHyperTreeGrid.h:416
vtkHyperTreeGrid::vtkHyperTreeGridSuperCursor::MiddleCursorId
int MiddleCursorId
Definition: vtkHyperTreeGrid.h:489
vtkgl::x
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::Initialize
void Initialize(vtkHyperTreeGrid *, vtkIdType, int[3])
vtkHyperTreeGrid::SetBranchFactor
void SetBranchFactor(unsigned int)
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor
Definition: vtkHyperTreeGrid.h:437
vtkHyperTreeGrid::SetIndexingModeToKJI
void SetIndexingModeToKJI()
Definition: vtkHyperTreeGrid.h:111
vtkHyperTreeGrid::Dimension
unsigned int Dimension
Definition: vtkHyperTreeGrid.h:362
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkHyperTreeGrid::vtkHyperTreeGridSuperCursor
Definition: vtkHyperTreeGrid.h:485
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::GetTree
vtkHyperTree * GetTree()
Definition: vtkHyperTreeGrid.h:446
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::GetLevel
unsigned short GetLevel()
Definition: vtkHyperTreeGrid.h:449
vtkHyperTreeGrid::SetMaterialMask
void SetMaterialMask(vtkBitArray *)
vtkHyperTreeGrid::DeleteTrees
void DeleteTrees()
vtkHyperTreeGrid::MaterialMask
vtkBitArray * MaterialMask
Definition: vtkHyperTreeGrid.h:369
vtkHyperTreeGrid::GetPoint
virtual double * GetPoint(vtkIdType)
vtkHyperTreeGrid::PrintSelf
void PrintSelf(ostream &, vtkIndent)
vtkHyperTreeGrid::TraverseDualLeaf
void TraverseDualLeaf(vtkHyperTreeGridSuperCursor *)
vtkLine
cell represents a 1D line
Definition: vtkLine.h:35
vtkHyperTreeGrid::GetPoints
vtkPoints * GetPoints()
vtkHyperTreeGrid::vtkHyperTreeIterator::Iterator
std::map< vtkIdType, vtkHyperTree * >::iterator Iterator
Definition: vtkHyperTreeGrid.h:475
vtkHyperTreeGrid::FindCell
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkGenericCell *gencell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
VTK_3D_EXTENT
#define VTK_3D_EXTENT
Definition: vtkDataObject.h:61
vtkHyperTreeGrid::InitializeSuperCursor
void InitializeSuperCursor(vtkHyperTreeGridSuperCursor *, vtkIdType)
vtkHyperTreeGrid::NumberOfChildren
unsigned int NumberOfChildren
Definition: vtkHyperTreeGrid.h:366
vtkHyperTreeGrid::GetPointCells
virtual void GetPointCells(vtkIdType, vtkIdList *)
vtkHyperTreeGrid::SetGridSize
void SetGridSize(unsigned int i, unsigned int j, unsigned int k)
vtkHyperTreeGrid::GetCell
void GetCell(vtkIdType, vtkCell *)
vtkHyperTreeGrid::GetLevelZeroCoordsFromIndex
void GetLevelZeroCoordsFromIndex(vtkIdType index, unsigned int &i, unsigned int &j, unsigned int &k)
vtkHyperTreeGrid::GetNumberOfLeaves
vtkIdType GetNumberOfLeaves()
vtkHyperTreeGrid::TraverseDualRecursively
void TraverseDualRecursively(vtkHyperTreeGridSuperCursor *, unsigned int)
vtkCollection
create and manipulate unsorted lists of objects
Definition: vtkCollection.h:53
vtkGetVector3Macro
#define vtkGetVector3Macro(name, type)
Definition: vtkSetGet.h:304
vtkHyperTreeGrid::vtkSuperCursorEntry::Child
unsigned char Child
Definition: vtkHyperTreeGrid.h:406
vtkHyperTreeGrid::GetPoint
virtual void GetPoint(vtkIdType, double[3])
vtkHyperTreeGrid::GetDataObjectType
int GetDataObjectType()
vtkHyperTreeGrid::ComputeBounds
void ComputeBounds()
vtkHyperTreeGrid::SetYCoordinates
void SetYCoordinates(vtkDataArray *)
vtkHyperTreeGrid::GetCell
virtual void GetCell(vtkIdType, vtkGenericCell *)
vtkHyperTreeGrid::Pixel
vtkPixel * Pixel
Definition: vtkHyperTreeGrid.h:417
vtkHyperTreeGrid::XCoordinates
vtkDataArray * XCoordinates
Definition: vtkHyperTreeGrid.h:372
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:62
vtkHyperTreeCursor
Objects that can traverse hypertree nodes.
Definition: vtkHyperTreeCursor.h:57
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:34
vtkHyperTreeGrid::HyperTrees
std::map< vtkIdType, vtkHyperTree * > HyperTrees
Definition: vtkHyperTreeGrid.h:376
vtkHyperTreeGrid::vtkHyperTreeIterator::Initialize
void Initialize(vtkHyperTreeGrid *)
vtkHyperTreeGrid::BuildLinks
void BuildLinks()
vtkHyperTreeGrid::SetGridExtent
void SetGridExtent(int iMin, int iMax, int jMin, int jMax, int kMin, int kMax)
vtkHyperTreeGrid::SetZCoordinates
void SetZCoordinates(vtkDataArray *)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkHyperTreeGrid::SetGridExtent
void SetGridExtent(int extent[6])
vtkHyperTreeGrid::vtkHyperTreeIterator::Tree
vtkHyperTreeGrid * Tree
Definition: vtkHyperTreeGrid.h:476
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkHyperTreeGrid::SetGridSize
void SetGridSize(unsigned int[3])
vtkHyperTreeGrid::GetNumberOfTrees
vtkIdType GetNumberOfTrees()
vtkHyperTreeGrid::InitializeSuperCursorChild
void InitializeSuperCursorChild(vtkHyperTreeGridSuperCursor *parent, vtkHyperTreeGridSuperCursor *child, unsigned int childIdx)
vtkHyperTree
An object structured as a tree where each node has exactly either 2^n or 3^n children.
Definition: vtkHyperTree.h:134
vtkHyperTreeGrid::~vtkHyperTreeGrid
~vtkHyperTreeGrid()
vtkHyperTreeGrid::NewCursor
vtkHyperTreeCursor * NewCursor(vtkIdType)
vtkHyperTreeGrid::DeepCopy
void DeepCopy(vtkDataObject *)
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::IsLeaf
bool IsLeaf()
vtkHyperTreeGrid::SetXCoordinates
void SetXCoordinates(vtkDataArray *)
vtkHyperTreeGrid::CopyStructure
void CopyStructure(vtkDataSet *)
vtkHyperTreeGrid::RecursiveFindPoint
vtkIdType RecursiveFindPoint(double x[3], vtkHyperTreeSimpleCursor *cursor, double *origin, double *size)
vtkHyperTreeGrid::GetCellPoints
virtual void GetCellPoints(vtkIdType, vtkIdType &, vtkIdType *&)
vtkDataSet.h
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkHyperTreeGrid::ShallowCopy
void ShallowCopy(vtkDataObject *)
vtkgl::index
GLuint index
Definition: vtkgl.h:11983
vtkHyperTreeGrid::vtkHyperTreeIterator::GetNextTree
vtkHyperTree * GetNextTree(vtkIdType &index)
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:49
vtkHyperTreeGrid::SetMaterialMaskIndex
virtual void SetMaterialMaskIndex(vtkIdTypeArray *)
vtkHyperTreeGrid::Voxel
vtkVoxel * Voxel
Definition: vtkHyperTreeGrid.h:418
vtkHyperTreeGrid::GetNumberOfPoints
vtkIdType GetNumberOfPoints()
vtkPixel
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:40
vtkHyperTreeGrid::vtkSuperCursorEntry::Parent
unsigned char Parent
Definition: vtkHyperTreeGrid.h:404
vtkInformationDoubleVectorKey
Key for double vector values.
Definition: vtkInformationDoubleVectorKey.h:34
vtkHyperTreeGrid::ComputeDualGrid
void ComputeDualGrid()
vtkHyperTreeGrid::MaterialMaskIndex
vtkIdTypeArray * MaterialMaskIndex
Definition: vtkHyperTreeGrid.h:370
vtkHyperTreeGrid::vtkHyperTreeGrid
vtkHyperTreeGrid()
vtkHyperTreeGrid::GetCellPoints
virtual void GetCellPoints(vtkIdType, vtkIdList *)
vtkGenericCell
provides thread-safe access to cells
Definition: vtkGenericCell.h:42
vtkHyperTreeGrid::vtkHyperTreeSimpleCursor::ToRoot
void ToRoot()
vtkHyperTreeGrid::DeleteInternalArrays
void DeleteInternalArrays()
vtkHyperTreeGrid::New
static vtkHyperTreeGrid * New()
vtkHyperTreeGrid::SubdivideLeaf
void SubdivideLeaf(vtkHyperTreeCursor *, vtkIdType)
vtkHyperTreeGrid::DIMENSION
static vtkInformationIntegerKey * DIMENSION()
vtkHyperTreeGrid::GenerateSuperCursorTraversalTable
void GenerateSuperCursorTraversalTable()
vtkBitArray
dynamic, self-adjusting array of bits
Definition: vtkBitArray.h:36
vtkHyperTreeGrid::vtkHyperTreeGridSuperCursor::GetCursor
vtkHyperTreeSimpleCursor * GetCursor(int idx)
Definition: vtkHyperTreeGrid.h:492
vtkHyperTreeGrid::vtkSuperCursorEntry
Definition: vtkHyperTreeGrid.h:402
VTKCOMMONDATAMODEL_EXPORT
#define VTKCOMMONDATAMODEL_EXPORT
Definition: vtkCommonDataModelModule.h:15
vtkX3D::extent
@ extent
Definition: vtkX3D.h:345
vtkHyperTreeGrid::InitializeTreeIterator
void InitializeTreeIterator(vtkHyperTreeIterator &)
vtkHyperTreeGrid::GetCell
virtual vtkCell * GetCell(vtkIdType)
vtkHyperTreeGrid::vtkHyperTreeIterator::vtkHyperTreeIterator
vtkHyperTreeIterator()
Definition: vtkHyperTreeGrid.h:461
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:65
vtkHyperTreeGrid::SIZES
static vtkInformationDoubleVectorKey * SIZES()
vtkHyperTreeGrid::InitializeSuperCursor
void InitializeSuperCursor(vtkHyperTreeGridSuperCursor *, unsigned int, unsigned int, unsigned int, vtkIdType)
vtkHyperTreeGrid::YCoordinates
vtkDataArray * YCoordinates
Definition: vtkHyperTreeGrid.h:373
vtkHyperTreeGrid::GetNumberOfCells
vtkIdType GetNumberOfCells()
vtkHyperTreeGrid::FindCell
virtual vtkIdType FindCell(double x[3], vtkCell *cell, vtkIdType cellId, double tol2, int &subId, double pcoords[3], double *weights)
vtkHyperTreeGrid::GetMaxCellSize
virtual int GetMaxCellSize()
vtkHyperTreeGrid::FindPoint
virtual vtkIdType FindPoint(double x[3])
vtkHyperTreeGrid::PointShifted
std::map< vtkIdType, bool > PointShifted
Definition: vtkHyperTreeGrid.h:380
vtkHyperTreeGrid::TraverseDualMaskedLeaf
void TraverseDualMaskedLeaf(vtkHyperTreeGridSuperCursor *)
vtkHyperTreeGrid
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
Definition: vtkHyperTreeGrid.h:68
vtkgl::size
GLsizeiptr size
Definition: vtkgl.h:11843
vtkHyperTreeGrid::SetIndexingModeToIJK
void SetIndexingModeToIJK()
Definition: vtkHyperTreeGrid.h:113
vtkHyperTreeGrid::GetCellNeighbors
virtual void GetCellNeighbors(vtkIdType, vtkIdList *, vtkIdList *)
vtkHyperTreeGrid::GenerateTrees
virtual void GenerateTrees()
vtkVoxel
a cell that represents a 3D orthogonal parallelepiped
Definition: vtkVoxel.h:44