VTK  9.3.1
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 
62  : Tree(entry->Tree)
63  , Level(entry->Level)
64  , Index(entry->Index)
65  {
66  }
67 
72  : Tree(tree)
73  , Level(level)
74  , Index(index)
75  {
76  }
77 
81  vtkHyperTreeGridLevelEntry(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
82 
86  ~vtkHyperTreeGridLevelEntry() = default;
87 
91  void Reset()
92  {
93  this->Tree = nullptr;
94  this->Level = 0;
95  this->Index = 0;
96  }
97 
101  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index)
102  {
103  this->Tree = tree;
104  this->Level = level;
105  this->Index = index;
106  }
107 
111  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
112 
116  void Copy(const vtkHyperTreeGridLevelEntry* entry)
117  {
118  this->Tree = entry->Tree;
119  this->Level = entry->Level;
120  this->Index = entry->Index;
121  }
122 
128  vtkHyperTreeGrid* grid);
129 
133  vtkIdType GetVertexId() const { return this->Index; }
134 
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 
179  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
180 
185  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
186 
190  bool IsRoot() const { return (this->Index == 0); }
191 
200  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
201 
205  vtkHyperTree* GetTree() const { return this->Tree; }
206 
210  unsigned int GetLevel() const { return this->Level; }
211 
212 protected:
217 
221  unsigned int Level;
222 
227 };
228 
229 VTK_ABI_NAMESPACE_END
230 #endif // vtkHyperTreeGridLevelEntry_h
231 // VTK-HeaderTest-Exclude: vtkHyperTreeGridLevelEntry.h
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree. ...
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
vtkHyperTreeGridLevelEntry(vtkHyperTreeGridLevelEntry *entry)
Constructor.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
bool IsRoot() const
Is the cursor at tree root?
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
void Dump(ostream &os)
Dump information.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
void Copy(const vtkHyperTreeGridLevelEntry *entry)
Copy function.
int vtkIdType
Definition: vtkType.h:315
vtkIdType Index
index of the current cell in the HyperTree.
vtkHyperTreeGridLevelEntry(vtkHyperTree *tree, unsigned int level, vtkIdType index)
Constructor.
Objects for traversal a HyperTreeGrid.
void ToChild(const vtkHyperTreeGrid *grid, unsigned char ichild)
Move the cursor to child `child' of the current vertex.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
unsigned int GetLevel() const
Get level info from current cache entry.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
a simple class to control print indentation
Definition: vtkIndent.h:28
~vtkHyperTreeGridLevelEntry()=default
Destructor.
unsigned int Level
level of the current cell in the HyperTree.
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
void SetGlobalIndexFromLocal(vtkIdType index)
Set the global index for the current cell of the HyperTree.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
A data object structured as a tree.
Definition: vtkHyperTree.h:168
vtkSmartPointer< vtkHyperTreeGridNonOrientedCursor > GetHyperTreeGridNonOrientedCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created...
LevelEntry is a cache data for cursors requiring level info.
vtkHyperTree * Tree
pointer to the HyperTree containing the current cell.
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index)
Initialize cursor from explicit required data.