VTK  9.3.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 
65 
69  void Dump(ostream& os);
70 
74  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin)
75  {
76  this->Tree = tree;
77  this->Level = level;
78  this->Index = index;
79  for (unsigned int d = 0; d < 3; ++d)
80  {
81  this->Origin[d] = origin[d];
82  }
83  }
84 
88  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
89 
93  void Reset()
94  {
95  this->Tree = nullptr;
96  this->Index = 0;
97  }
98 
103  {
104  this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
105  }
106 
112  vtkHyperTreeGrid* grid)
113  {
116  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
117  return cursor;
118  }
119 
126  {
127  assert("pre: level==0" && this->Level == 0);
130  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
131  return cursor;
132  }
133 
138  vtkIdType GetVertexId() const { return this->Index; }
139 
146 
152 
158 
163  void SetMask(const vtkHyperTreeGrid* grid, bool state);
164 
169  bool IsMasked(const vtkHyperTreeGrid* grid) const;
170 
176  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
177 
185  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
186 
191  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
192 
196  bool IsRoot() { return (this->Index == 0); }
197 
206  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
207 
211  vtkHyperTree* GetTree() const { return this->Tree; }
212 
216  unsigned int GetLevel() const { return this->Level; }
217 
221  double* GetOrigin() { return this->Origin; }
222  const double* GetOrigin() const { return this->Origin; }
223 
227  void GetBounds(double bounds[6]) const;
228 
232  void GetPoint(double point[3]) const;
233 
234 private:
238  vtkHyperTree* Tree;
239 
243  unsigned int Level;
244 
248  vtkIdType Index;
249 
253  double Origin[3];
254 };
255 
256 VTK_ABI_NAMESPACE_END
257 #endif // vtkHyperTreeGridGeometryLevelEntry
258 // 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:315
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens 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.
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:168
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.