VTK  9.3.0
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
Cursor cache data with coordinates and level info.
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cache entry at root of given tree index in grid.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree.
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index, const double *origin)
Initialize cache entry from explicit required data.
void Dump(ostream &os)
Dump information.
~vtkHyperTreeGridGeometryLevelEntry()=default
Destructor.
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.
double * GetOrigin()
Getter for origin coordinates 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.
void GetPoint(double point[3]) const
Getter for center of the current cell.
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.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created,...
unsigned int GetLevel() const
Get level info from current cache entry.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
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