VTK  9.0.1
vtkHyperTreeGridGeometryLevelEntry.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperTreeGridGeometryLevelEntry.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 =========================================================================*/
37 #ifndef vtkHyperTreeGridGeometryLevelEntry_h
38 #define vtkHyperTreeGridGeometryLevelEntry_h
39 
40 #ifndef __VTK_WRAP__
41 
42 #include "assert.h"
43 
44 #include "vtkObject.h"
45 #include "vtkSmartPointer.h"
46 
49 
50 class vtkHyperTree;
51 class vtkHyperTreeGrid;
52 
54 {
55 public:
59  void PrintSelf(ostream& os, vtkIndent indent);
60 
65  {
66  this->Tree = nullptr;
67  this->Level = 0;
68  this->Index = 0;
69  for (unsigned int d = 0; d < 3; ++d)
70  {
71  this->Origin[d] = 0.;
72  }
73  }
74 
79 
83  void Dump(ostream& os);
84 
88  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin)
89  {
90  this->Tree = tree;
91  this->Level = level;
92  this->Index = index;
93  for (unsigned int d = 0; d < 3; ++d)
94  {
95  this->Origin[d] = origin[d];
96  }
97  }
98 
102  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
103 
107  void Reset()
108  {
109  this->Tree = nullptr;
110  this->Index = 0;
111  }
112 
117  {
118  this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
119  }
120 
126  vtkHyperTreeGrid* grid)
127  {
130  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
131  return cursor;
132  }
133 
140  {
141  assert("pre: level==0" && this->Level == 0);
144  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
145  return cursor;
146  }
147 
152  vtkIdType GetVertexId() const { return this->Index; }
153 
160 
166 
172 
177  void SetMask(const vtkHyperTreeGrid* grid, bool state);
178 
183  bool IsMasked(const vtkHyperTreeGrid* grid) const;
184 
190  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
191 
199  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
200 
205  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
206 
210  bool IsRoot() { return (this->Index == 0); }
211 
220  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
221 
225  vtkHyperTree* GetTree() const { return this->Tree; }
226 
230  unsigned int GetLevel() const { return this->Level; }
231 
235  double* GetOrigin() { return this->Origin; }
236  const double* GetOrigin() const { return this->Origin; }
237 
241  void GetBounds(double bounds[6]) const;
242 
246  void GetPoint(double point[3]) const;
247 
248 private:
252  vtkHyperTree* Tree;
253 
257  unsigned int Level;
258 
262  vtkIdType Index;
263 
267  double Origin[3];
268 };
269 
270 #endif // __VTK_WRAP__
271 
272 #endif // vtkHyperTreeGridGeometryLevelEntry
273 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryLevelEntry.h
void GetPoint(double point[3]) const
Getter for center of the current cell.
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
unsigned int GetLevel() const
Get level info from current cache entry.
void SetGlobalIndexFromLocal(vtkIdType index)
Set the global index for the current cell of the HyperTree.
void ToChild(const vtkHyperTreeGrid *grid, unsigned char ichild)
Move the cursor to child ‘child’ of the current vertex.
~vtkHyperTreeGridGeometryLevelEntry()=default
Destructor.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index, const double *origin)
Initialize cache entry from explicit required data.
double * GetOrigin()
Getter for origin coordinates of the current cell.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
int vtkIdType
Definition: vtkType.h:338
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
a simple class to control print indentation
Definition: vtkIndent.h:33
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
vtkSmartPointer< vtkHyperTreeGridOrientedGeometryCursor > GetHyperTreeGridOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridOrientedCursor from input grid and current entry data.
A data object structured as a tree.
Definition: vtkHyperTree.h:178
Cursor cache data with coordinates and level info.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell&#39;s status: if leaf then becomes coarse and all its children are created...
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree. ...
void Dump(ostream &os)
Dump information.
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.