VTK  9.3.20240418
vtkHyperTreeGridLevelEntry.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 vtkHyperTreeGridLevelEntry_h
25 #define vtkHyperTreeGridLevelEntry_h
26 
27 #include "vtkObject.h"
28 #include "vtkSmartPointer.h" // Used internally
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkHyperTree;
32 class vtkHyperTreeGrid;
34 
36 {
37 public:
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
46  void Dump(ostream& os);
47 
52  : Tree(nullptr)
53  , Level(0)
54  , Index(0)
55  {
56  }
57 
60 
65  : Tree(entry->Tree)
66  , Level(entry->Level)
67  , Index(entry->Index)
68  {
69  }
70 
75  : Tree(tree)
76  , Level(level)
77  , Index(index)
78  {
79  }
80 
84  vtkHyperTreeGridLevelEntry(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
85 
90 
94  void Reset()
95  {
96  this->Tree = nullptr;
97  this->Level = 0;
98  this->Index = 0;
99  }
100 
104  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index)
105  {
106  this->Tree = tree;
107  this->Level = level;
108  this->Index = index;
109  }
110 
114  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
115 
119  void Copy(const vtkHyperTreeGridLevelEntry* entry)
120  {
121  this->Tree = entry->Tree;
122  this->Level = entry->Level;
123  this->Index = entry->Index;
124  }
125 
131  vtkHyperTreeGrid* grid);
132 
136  vtkIdType GetVertexId() const { return this->Index; }
137 
143 
149 
155 
160  void SetMask(const vtkHyperTreeGrid* grid, bool state);
161 
166  bool IsMasked(const vtkHyperTreeGrid* grid) const;
167 
173  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
174 
182  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
183 
188  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
189 
193  bool IsRoot() const { return (this->Index == 0); }
194 
203  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
204 
208  vtkHyperTree* GetTree() const { return this->Tree; }
209 
213  unsigned int GetLevel() const { return this->Level; }
214 
215 protected:
220 
224  unsigned int Level;
225 
230 };
231 
232 VTK_ABI_NAMESPACE_END
233 #endif // vtkHyperTreeGridLevelEntry_h
234 // VTK-HeaderTest-Exclude: vtkHyperTreeGridLevelEntry.h
LevelEntry is a cache data for cursors requiring level info.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
vtkHyperTreeGridLevelEntry(vtkHyperTreeGridLevelEntry const &)=default
~vtkHyperTreeGridLevelEntry()=default
Destructor.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree.
unsigned int GetLevel() const
Get level info 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)
Initialize cursor from explicit required data.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
vtkIdType Index
index of the current cell in the HyperTree.
vtkHyperTree * Tree
pointer to the HyperTree containing the current cell.
vtkHyperTreeGridLevelEntry & operator=(vtkHyperTreeGridLevelEntry const &)=default
vtkHyperTreeGridLevelEntry(vtkHyperTreeGridLevelEntry *entry)
Constructor.
bool IsRoot() const
Is the cursor at tree root?
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
vtkHyperTreeGridLevelEntry(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Constructor.
void ToChild(const vtkHyperTreeGrid *grid, unsigned char ichild)
Move the cursor to child ‘child’ of the current vertex.
void SetGlobalIndexFromLocal(vtkIdType index)
Set the global index for the current cell of the HyperTree.
void Dump(ostream &os)
Dump information.
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all children being leaves ?
vtkHyperTreeGridLevelEntry(vtkHyperTree *tree, unsigned int level, vtkIdType index)
Constructor.
void Copy(const vtkHyperTreeGridLevelEntry *entry)
Copy function.
unsigned int Level
level of the current cell in the HyperTree.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created,...
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
vtkSmartPointer< vtkHyperTreeGridNonOrientedCursor > GetHyperTreeGridNonOrientedCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
Objects for traversal a HyperTreeGrid.
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:108
Hold a reference to a vtkObjectBase instance.
@ level
Definition: vtkX3D.h:395
@ index
Definition: vtkX3D.h:246
int vtkIdType
Definition: vtkType.h:315