VTK  9.0.1
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 =========================================================================*/
37 #ifndef vtkHyperTreeGridLevelEntry_h
38 #define vtkHyperTreeGridLevelEntry_h
39 
40 #ifndef __VTK_WRAP__
41 
42 #include "vtkObject.h"
43 #include "vtkSmartPointer.h" // Used internally
44 
45 class vtkHyperTree;
46 class vtkHyperTreeGrid;
48 
50 {
51 public:
55  void PrintSelf(ostream& os, vtkIndent indent);
56 
60  void Dump(ostream& os);
61 
66  : Tree(nullptr)
67  , Level(0)
68  , Index(0)
69  {
70  }
71 
76  : Tree(entry->Tree)
77  , Level(entry->Level)
78  , Index(entry->Index)
79  {
80  }
81 
86  : Tree(tree)
87  , Level(level)
88  , Index(index)
89  {
90  }
91 
95  vtkHyperTreeGridLevelEntry(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
96 
100  ~vtkHyperTreeGridLevelEntry() = default;
101 
105  void Reset()
106  {
107  this->Tree = nullptr;
108  this->Level = 0;
109  this->Index = 0;
110  }
111 
115  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index)
116  {
117  this->Tree = tree;
118  this->Level = level;
119  this->Index = index;
120  }
121 
125  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
126 
130  void Copy(const vtkHyperTreeGridLevelEntry* entry)
131  {
132  this->Tree = entry->Tree;
133  this->Level = entry->Level;
134  this->Index = entry->Index;
135  }
136 
142  vtkHyperTreeGrid* grid);
143 
147  vtkIdType GetVertexId() const { return this->Index; }
148 
154 
160 
166 
171  void SetMask(const vtkHyperTreeGrid* grid, bool state);
172 
177  bool IsMasked(const vtkHyperTreeGrid* grid) const;
178 
184  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
185 
193  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
194 
199  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
200 
204  bool IsRoot() const { return (this->Index == 0); }
205 
214  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
215 
219  vtkHyperTree* GetTree() const { return this->Tree; }
220 
224  unsigned int GetLevel() const { return this->Level; }
225 
226 protected:
231 
235  unsigned int Level;
236 
241 };
242 
243 #endif // __VTK_WRAP__
244 
245 #endif // vtkHyperTreeGridLevelEntry_h
246 // VTK-HeaderTest-Exclude: vtkHyperTreeGridLevelEntry.h
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
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.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
unsigned int GetLevel() const
Get level info from current cache entry.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree. ...
void Dump(ostream &os)
Dump information.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
void Copy(const vtkHyperTreeGridLevelEntry *entry)
Copy function.
int vtkIdType
Definition: vtkType.h:338
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.
bool IsRoot() const
Is the cursor at tree root?
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
a simple class to control print indentation
Definition: vtkIndent.h:33
~vtkHyperTreeGridLevelEntry()=default
Destructor.
unsigned int Level
level of the current cell in the HyperTree.
void SetGlobalIndexFromLocal(vtkIdType index)
Set the global index for the current cell of the HyperTree.
A data object structured as a tree.
Definition: vtkHyperTree.h:178
vtkSmartPointer< vtkHyperTreeGridNonOrientedCursor > GetHyperTreeGridNonOrientedCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell&#39;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.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.