VTK  9.7.1
vtkHyperTreeGridGeometryLevelEntry.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
24 #ifndef vtkHyperTreeGridGeometryLevelEntry_h
25 #define vtkHyperTreeGridGeometryLevelEntry_h
26 
27 #include "assert.h"
28 
29 #include "vtkObject.h"
30 #include "vtkSmartPointer.h"
31 
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkHyperTree;
37 class vtkHyperTreeGrid;
38 
40 {
41 public:
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
51  {
52  this->Tree = nullptr;
53  this->Level = 0;
54  this->Index = 0;
55  for (unsigned int d = 0; d < 3; ++d)
56  {
57  this->Origin[d] = 0.;
58  }
59  }
60 
63  vtkHyperTreeGridGeometryLevelEntry const&) = default;
64 
69 
73  void Dump(ostream& os);
74 
78  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin)
79  {
80  this->Tree = tree;
81  this->Level = level;
82  this->Index = index;
83  for (unsigned int d = 0; d < 3; ++d)
84  {
85  this->Origin[d] = origin[d];
86  }
87  }
88 
92  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
93 
97  void Reset()
98  {
99  this->Tree = nullptr;
100  this->Index = 0;
101  }
102 
107  {
108  this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
109  }
110 
116  vtkHyperTreeGrid* grid)
117  {
120  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
121  return cursor;
122  }
123 
130  {
131  assert("pre: level==0" && this->Level == 0);
134  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
135  return cursor;
136  }
137 
142  vtkIdType GetVertexId() const { return this->Index; }
143 
150 
156 
162 
167  void SetMask(const vtkHyperTreeGrid* grid, bool state);
168 
173  bool IsMasked(const vtkHyperTreeGrid* grid) const;
174 
180  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
181 
189  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
190 
195  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
196 
200  bool IsRoot() { return (this->Index == 0); }
201 
210  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
211 
215  vtkHyperTree* GetTree() const { return this->Tree; }
216 
220  unsigned int GetLevel() const { return this->Level; }
221 
225  double* GetOrigin() { return this->Origin; }
226  const double* GetOrigin() const { return this->Origin; }
227 
231  void GetBounds(double bounds[6]) const;
232 
236  void GetPoint(double point[3]) const;
237 
238 private:
242  vtkHyperTree* Tree;
243 
247  unsigned int Level;
248 
252  vtkIdType Index;
253 
257  double Origin[3];
258 };
259 
260 VTK_ABI_NAMESPACE_END
261 #endif // vtkHyperTreeGridGeometryLevelEntry
262 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryLevelEntry.h
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
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.
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:23
int vtkIdType
Definition: vtkType.h:363
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all children being leaves ?
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.
vtkHyperTreeGridGeometryLevelEntry & operator=(vtkHyperTreeGridGeometryLevelEntry const &)=default
unsigned int GetLevel() const
Get level info from current cache entry.
void GetPoint(double point[3]) const
Getter for center of the current cell.
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.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree. ...
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
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:170
Cursor cache data with coordinates and level info.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created...
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
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.