VTK  9.3.0
vtkHyperTreeGridGeometryUnlimitedLevelEntry.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
25 #ifndef vtkHyperTreeGridGeometryUnlimitedLevelEntry_h
26 #define vtkHyperTreeGridGeometryUnlimitedLevelEntry_h
27 
28 #include "assert.h"
29 
30 #include "vtkObject.h"
31 #include "vtkSmartPointer.h"
32 
35 
36 VTK_ABI_NAMESPACE_BEGIN
37 class vtkHyperTree;
38 class vtkHyperTreeGrid;
39 
41 {
42 public:
46  void PrintSelf(ostream& os, vtkIndent indent);
47 
52  {
53  this->Tree = tree;
54  this->Level = 0;
55  this->Index = 0;
56  for (unsigned int d = 0; d < 3; ++d)
57  {
58  this->Origin[d] = 0.;
59  }
60  }
61 
66 
70  void Dump(ostream& os);
71 
75  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin);
76 
80  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
81 
85  void Reset()
86  {
87  this->Tree = nullptr;
88  this->Index = 0;
89  }
90 
95  {
96  this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
97  this->LastRealIndex = entry->LastRealIndex;
98  this->LastRealLevel = entry->LastRealLevel;
99  }
100 
106  vtkHyperTreeGrid* grid)
107  {
110  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
111  return cursor;
112  }
113 
120  {
121  assert("pre: level==0" && this->Level == 0);
124  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
125  return cursor;
126  }
127 
132  vtkIdType GetVertexId() const { return this->LastRealIndex; }
133 
140 
146 
152 
157  void SetMask(const vtkHyperTreeGrid* grid, bool state);
158 
163  bool IsMasked(const vtkHyperTreeGrid* grid) const;
164 
170  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
171 
176  bool IsRealLeaf(const vtkHyperTreeGrid* grid) const;
177 
182  bool IsVirtualLeaf(const vtkHyperTreeGrid* grid) const;
183 
188  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
189 
193  bool IsRoot() { return this->Index == 0 && this->Level == 0; }
194 
203  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
204 
208  vtkHyperTree* GetTree() const { return this->Tree; }
209 
211 
214  unsigned int GetLevel() const { return this->Level; }
215  unsigned int GetLastRealLevel() const { return this->LastRealLevel; }
217 
219 
222  double* GetOrigin() { return this->Origin; }
223  const double* GetOrigin() const { return this->Origin; }
225 
229  void GetBounds(double bounds[6]) const;
230 
234  void GetPoint(double point[3]) const;
235 
236 private:
240  vtkHyperTree* Tree;
241 
245  unsigned int Level = 0;
246 
250  vtkIdType Index = 0;
251 
255  vtkIdType LastRealIndex = 0;
256 
260  vtkIdType LastRealLevel = 0;
261 
265  double Origin[3];
266 };
267 
268 VTK_ABI_NAMESPACE_END
269 #endif // vtkHyperTreeGridGeometryUnlimitedLevelEntry
270 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryUnlimitedLevelEntry.h
Cursor cache data with coordinates and level info.
void Copy(const vtkHyperTreeGridGeometryUnlimitedLevelEntry *entry)
Copy function.
bool IsVirtualLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a virually subdivided leaf?
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
void Dump(ostream &os)
Dump information.
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
unsigned int GetLastRealLevel() const
Get level info from current cache entry.
unsigned int GetLevel() const
Get level info from current cache entry.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index, const double *origin)
Initialize cache entry from explicit required data.
void GetPoint(double point[3]) const
Getter for center of the current cell.
vtkHyperTreeGridGeometryUnlimitedLevelEntry(vtkHyperTree *tree=nullptr)
Constructor.
~vtkHyperTreeGridGeometryUnlimitedLevelEntry()=default
Destructor.
void ToChild(const vtkHyperTreeGrid *grid, unsigned char ichild)
Move the cursor to child ‘child’ of the current vertex.
const double * GetOrigin() const
Getter for origin coordinates of the current cell.
void SetGlobalIndexFromLocal(vtkIdType index)
Set the global index for the current cell of the HyperTree.
bool IsRealLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
double * GetOrigin()
Getter for origin coordinates of the current cell.
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cache entry at root of given tree index in grid.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
vtkSmartPointer< vtkHyperTreeGridOrientedGeometryCursor > GetHyperTreeGridOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridOrientedCursor from input grid and current entry data.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree.
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
A data object structured as a tree.
Definition: vtkHyperTree.h:169
a simple class to control print indentation
Definition: vtkIndent.h:38
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
@ point
Definition: vtkX3D.h:236
@ level
Definition: vtkX3D.h:395
@ index
Definition: vtkX3D.h:246
int vtkIdType
Definition: vtkType.h:315