VTK  9.1.0
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 #ifndef __VTK_WRAP__
40 
41 #include "assert.h"
42 
43 #include "vtkObject.h"
44 #include "vtkSmartPointer.h"
45 
48 
49 class vtkHyperTree;
50 class vtkHyperTreeGrid;
51 
53 {
54 public:
58  void PrintSelf(ostream& os, vtkIndent indent);
59 
64  {
65  this->Tree = nullptr;
66  this->Level = 0;
67  this->Index = 0;
68  for (unsigned int d = 0; d < 3; ++d)
69  {
70  this->Origin[d] = 0.;
71  }
72  }
73 
78 
82  void Dump(ostream& os);
83 
87  void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin)
88  {
89  this->Tree = tree;
90  this->Level = level;
91  this->Index = index;
92  for (unsigned int d = 0; d < 3; ++d)
93  {
94  this->Origin[d] = origin[d];
95  }
96  }
97 
101  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
102 
106  void Reset()
107  {
108  this->Tree = nullptr;
109  this->Index = 0;
110  }
111 
116  {
117  this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
118  }
119 
125  vtkHyperTreeGrid* grid)
126  {
129  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
130  return cursor;
131  }
132 
139  {
140  assert("pre: level==0" && this->Level == 0);
143  cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
144  return cursor;
145  }
146 
151  vtkIdType GetVertexId() const { return this->Index; }
152 
159 
165 
171 
176  void SetMask(const vtkHyperTreeGrid* grid, bool state);
177 
182  bool IsMasked(const vtkHyperTreeGrid* grid) const;
183 
189  bool IsLeaf(const vtkHyperTreeGrid* grid) const;
190 
198  void SubdivideLeaf(const vtkHyperTreeGrid* grid);
199 
204  bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
205 
209  bool IsRoot() { return (this->Index == 0); }
210 
219  void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
220 
224  vtkHyperTree* GetTree() const { return this->Tree; }
225 
229  unsigned int GetLevel() const { return this->Level; }
230 
234  double* GetOrigin() { return this->Origin; }
235  const double* GetOrigin() const { return this->Origin; }
236 
240  void GetBounds(double bounds[6]) const;
241 
245  void GetPoint(double point[3]) const;
246 
247 private:
251  vtkHyperTree* Tree;
252 
256  unsigned int Level;
257 
261  vtkIdType Index;
262 
266  double Origin[3];
267 };
268 
269 #endif // __VTK_WRAP__
270 
271 #endif // vtkHyperTreeGridGeometryLevelEntry
272 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryLevelEntry.h
vtkHyperTreeGridGeometryLevelEntry::Initialize
void Initialize(vtkHyperTree *tree, unsigned int level, vtkIdType index, const double *origin)
Initialize cache entry from explicit required data.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:87
vtkHyperTreeGridGeometryLevelEntry::GetHyperTreeGridOrientedGeometryCursor
vtkSmartPointer< vtkHyperTreeGridOrientedGeometryCursor > GetHyperTreeGridOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridOrientedCursor from input grid and current entry data.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:124
vtkHyperTreeGridGeometryLevelEntry::GetOrigin
const double * GetOrigin() const
Definition: vtkHyperTreeGridGeometryLevelEntry.h:235
vtkHyperTreeGridGeometryLevelEntry::GetOrigin
double * GetOrigin()
Getter for origin coordinates of the current cell.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:234
vtkHyperTreeGridGeometryLevelEntry::SetGlobalIndexStart
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
vtkHyperTreeGridGeometryLevelEntry::IsTerminalNode
bool IsTerminalNode(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a coarse with all childrens being leaves ?
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkHyperTreeGridGeometryLevelEntry::IsMasked
bool IsMasked(const vtkHyperTreeGrid *grid) const
Determine whether blanking mask is empty or not.
vtkHyperTreeGridGeometryLevelEntry::SetMask
void SetMask(const vtkHyperTreeGrid *grid, bool state)
Set the blanking mask is empty or not.
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition: vtkSmartPointer.h:145
vtkHyperTreeGridNonOrientedGeometryCursor::Initialize
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
vtkHyperTreeGridGeometryLevelEntry::GetHyperTreeGridNonOrientedGeometryCursor
vtkSmartPointer< vtkHyperTreeGridNonOrientedGeometryCursor > GetHyperTreeGridNonOrientedGeometryCursor(vtkHyperTreeGrid *grid)
Create a vtkHyperTreeGridNonOrientedCursor from input grid and current entry data.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:138
vtkHyperTreeGridGeometryLevelEntry::GetPoint
void GetPoint(double point[3]) const
Getter for center of the current cell.
vtkHyperTreeGridGeometryLevelEntry::Dump
void Dump(ostream &os)
Dump information.
vtkHyperTreeGridGeometryLevelEntry
Cursor cache data with coordinates and level info.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:53
vtkX3D::level
@ level
Definition: vtkX3D.h:401
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkHyperTreeGridGeometryLevelEntry::ToChild
void ToChild(const vtkHyperTreeGrid *grid, unsigned char ichild)
Move the cursor to child ‘child’ of the current vertex.
vtkHyperTreeGridOrientedGeometryCursor.h
vtkHyperTreeGridGeometryLevelEntry::Copy
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:115
vtkHyperTreeGridGeometryLevelEntry::vtkHyperTreeGridGeometryLevelEntry
vtkHyperTreeGridGeometryLevelEntry()
Constructor.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:63
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkHyperTreeGridGeometryLevelEntry::GetGlobalNodeIndex
vtkIdType GetGlobalNodeIndex() const
Return the global index (relative to the grid) of the current vertex in the tree.
vtkSmartPointer.h
vtkHyperTreeGridGeometryLevelEntry::SubdivideLeaf
void SubdivideLeaf(const vtkHyperTreeGrid *grid)
Change the current cell's status: if leaf then becomes coarse and all its children are created,...
vtkHyperTreeGridGeometryLevelEntry::Initialize
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cache entry at root of given tree index in grid.
vtkSmartPointer::New
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
Definition: vtkSmartPointer.h:334
vtkHyperTree
A data object structured as a tree.
Definition: vtkHyperTree.h:177
vtkHyperTreeGridGeometryLevelEntry::IsLeaf
bool IsLeaf(const vtkHyperTreeGrid *grid) const
Is the cursor pointing to a leaf?
vtkObject.h
vtkHyperTreeGridGeometryLevelEntry::GetBounds
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
vtkHyperTreeGridGeometryLevelEntry::IsRoot
bool IsRoot()
Is the cursor at tree root?
Definition: vtkHyperTreeGridGeometryLevelEntry.h:209
vtkHyperTreeGridGeometryLevelEntry::Reset
void Reset()
Reset function.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:106
vtkHyperTreeGridGeometryLevelEntry::GetTree
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:224
vtkHyperTreeGridGeometryLevelEntry::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
vtkHyperTreeGridOrientedGeometryCursor::Initialize
void Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
vtkHyperTreeGridGeometryLevelEntry::~vtkHyperTreeGridGeometryLevelEntry
~vtkHyperTreeGridGeometryLevelEntry()=default
Destructor.
vtkHyperTreeGridGeometryLevelEntry::GetVertexId
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:151
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkHyperTreeGridGeometryLevelEntry::GetLevel
unsigned int GetLevel() const
Get level info from current cache entry.
Definition: vtkHyperTreeGridGeometryLevelEntry.h:229
vtkHyperTreeGridGeometryLevelEntry::SetGlobalIndexFromLocal
void SetGlobalIndexFromLocal(vtkIdType index)
Set the global index for the current cell of the HyperTree.
vtkHyperTreeGridNonOrientedGeometryCursor.h
vtkHyperTreeGrid
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
Definition: vtkHyperTreeGrid.h:96