VTK  9.2.5
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
Cursor cache data with coordinates and level info.
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cache entry at root of given tree index in grid.
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree.
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index, const double *origin)
Initialize cache entry from explicit required data.
void Dump(ostream &os)
Dump information.
~vtkHyperTreeGridGeometryLevelEntry()=default
Destructor.
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
vtkSmartPointer< vtkHyperTreeGridOrientedGeometryCursor > GetHyperTreeGridOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridOrientedCursor from input grid and current entry data.
double * GetOrigin()
Getter for origin coordinates of the current cell.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
void GetPoint(double point[3]) const
Getter for center of the current cell.
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.
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created,...
unsigned int GetLevel() const
Get level info from current cache entry.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
A data object structured as a tree.
Definition: vtkHyperTree.h:180
a simple class to control print indentation
Definition: vtkIndent.h:119
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
@ point
Definition: vtkX3D.h:242
@ level
Definition: vtkX3D.h:401
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:332