VTK  9.2.6
vtkHyperTreeGridLevelEntry.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperTreeGridLevelEntry.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
36 #ifndef vtkHyperTreeGridLevelEntry_h
37 #define vtkHyperTreeGridLevelEntry_h
38 
39 #include "vtkObject.h"
40 #include "vtkSmartPointer.h" // Used internally
41 
42 class vtkHyperTree;
43 class vtkHyperTreeGrid;
45 
47 {
48 public:
52  void PrintSelf(ostream& os, vtkIndent indent);
53 
57  void Dump(ostream& os);
58 
63  : Tree(nullptr)
64  , Level(0)
65  , Index(0)
66  {
67  }
68 
73  : Tree(entry->Tree)
74  , Level(entry->Level)
75  , Index(entry->Index)
76  {
77  }
78 
83  : Tree(tree)
84  , Level(level)
85  , Index(index)
86  {
87  }
88 
92  vtkHyperTreeGridLevelEntry(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
93 
97  ~vtkHyperTreeGridLevelEntry() = default;
98 
102  void Reset()
103  {
104  this->Tree = nullptr;
105  this->Level = 0;
106  this->Index = 0;
107  }
108 
112  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index)
113  {
114  this->Tree = tree;
115  this->Level = level;
116  this->Index = index;
117  }
118 
122  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
123 
127  void Copy(const vtkHyperTreeGridLevelEntry* entry)
128  {
129  this->Tree = entry->Tree;
130  this->Level = entry->Level;
131  this->Index = entry->Index;
132  }
133 
139  vtkHyperTreeGrid* grid);
140 
144  vtkIdType GetVertexId() const { return this->Index; }
145 
151 
157 
163 
168  void SetMask(const vtkHyperTreeGrid* grid, bool state);
169 
174  bool IsMasked(const vtkHyperTreeGrid* grid) const;
175 
181  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
182 
190  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
191 
196  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
197 
201  bool IsRoot() const { return (this->Index == 0); }
202 
211  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
212 
216  vtkHyperTree* GetTree() const { return this->Tree; }
217 
221  unsigned int GetLevel() const { return this->Level; }
222 
223 protected:
228 
232  unsigned int Level;
233 
238 };
239 
240 #endif // vtkHyperTreeGridLevelEntry_h
241 // 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:32
void Copy(const vtkHyperTreeGridLevelEntry *entry)
Copy function.
int vtkIdType
Definition: vtkType.h:332
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:39
~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:179
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.