VTK  9.2.6
vtkHyperTreeGridGeometryLevelEntry.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHyperTreeGridGeometryLevelEntry.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 vtkHyperTreeGridGeometryLevelEntry_h
37 #define vtkHyperTreeGridGeometryLevelEntry_h
38 
39 #include "assert.h"
40 
41 #include "vtkObject.h"
42 #include "vtkSmartPointer.h"
43 
46 
47 class vtkHyperTree;
48 class vtkHyperTreeGrid;
49 
51 {
52 public:
56  void PrintSelf(ostream& os, vtkIndent indent);
57 
62  {
63  this->Tree = nullptr;
64  this->Level = 0;
65  this->Index = 0;
66  for (unsigned int d = 0; d < 3; ++d)
67  {
68  this->Origin[d] = 0.;
69  }
70  }
71 
76 
80  void Dump(ostream& os);
81 
85  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin)
86  {
87  this->Tree = tree;
88  this->Level = level;
89  this->Index = index;
90  for (unsigned int d = 0; d < 3; ++d)
91  {
92  this->Origin[d] = origin[d];
93  }
94  }
95 
99  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
100 
104  void Reset()
105  {
106  this->Tree = nullptr;
107  this->Index = 0;
108  }
109 
114  {
115  this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
116  }
117 
123  vtkHyperTreeGrid* grid)
124  {
127  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
128  return cursor;
129  }
130 
137  {
138  assert("pre: level==0" && this->Level == 0);
141  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
142  return cursor;
143  }
144 
149  vtkIdType GetVertexId() const { return this->Index; }
150 
157 
163 
169 
174  void SetMask(const vtkHyperTreeGrid* grid, bool state);
175 
180  bool IsMasked(const vtkHyperTreeGrid* grid) const;
181 
187  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
188 
196  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
197 
202  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
203 
207  bool IsRoot() { return (this->Index == 0); }
208 
217  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
218 
222  vtkHyperTree* GetTree() const { return this->Tree; }
223 
227  unsigned int GetLevel() const { return this->Level; }
228 
232  double* GetOrigin() { return this->Origin; }
233  const double* GetOrigin() const { return this->Origin; }
234 
238  void GetBounds(double bounds[6]) const;
239 
243  void GetPoint(double point[3]) const;
244 
245 private:
249  vtkHyperTree* Tree;
250 
254  unsigned int Level;
255 
259  vtkIdType Index;
260 
264  double Origin[3];
265 };
266 
267 #endif // vtkHyperTreeGridGeometryLevelEntry
268 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryLevelEntry.h
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
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.
~vtkHyperTreeGridGeometryLevelEntry()=default
Destructor.
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index, const double *origin)
Initialize cache entry from explicit required data.
double * GetOrigin()
Getter for origin coordinates of the current cell.
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
int vtkIdType
Definition: vtkType.h:332
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
unsigned int GetLevel() const
Get level info from current cache entry.
void GetPoint(double point[3]) const
Getter for center of the current cell.
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree. ...
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
vtkSmartPointer< vtkHyperTreeGridOrientedGeometryCursor > GetHyperTreeGridOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridOrientedCursor from input grid and current entry data.
A data object structured as a tree.
Definition: vtkHyperTree.h:179
Cursor cache data with coordinates and level info.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created...
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
void Dump(ostream &os)
Dump information.
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.