VTK  9.4.20250102
vtkHyperTreeGridGeometryLevelEntry.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
24#ifndef vtkHyperTreeGridGeometryLevelEntry_h
25#define vtkHyperTreeGridGeometryLevelEntry_h
26
27#include "assert.h"
28
29#include "vtkObject.h"
30#include "vtkSmartPointer.h"
31
34
35VTK_ABI_NAMESPACE_BEGIN
36class vtkHyperTree;
38
40{
41public:
45 void PrintSelf(ostream& os, vtkIndent indent);
46
51 {
52 this->Tree = nullptr;
53 this->Level = 0;
54 this->Index = 0;
55 for (unsigned int d = 0; d < 3; ++d)
56 {
57 this->Origin[d] = 0.;
58 }
59 }
60
63 vtkHyperTreeGridGeometryLevelEntry const&) = default;
64
69
73 void Dump(ostream& os);
74
78 void Initialize(vtkHyperTree* tree, unsigned int level, vtkIdType index, const double* origin)
79 {
80 this->Tree = tree;
81 this->Level = level;
82 this->Index = index;
83 for (unsigned int d = 0; d < 3; ++d)
84 {
85 this->Origin[d] = origin[d];
86 }
87 }
88
92 vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
93
97 void Reset()
98 {
99 this->Tree = nullptr;
100 this->Index = 0;
101 }
102
107 {
108 this->Initialize(entry->Tree, entry->Level, entry->Index, entry->Origin);
109 }
110
116 vtkHyperTreeGrid* grid)
117 {
120 cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
121 return cursor;
122 }
123
130 {
131 assert("pre: level==0" && this->Level == 0);
134 cursor->Initialize(grid, this->Tree, this->Level, this->Index, this->Origin);
135 return cursor;
136 }
137
142 vtkIdType GetVertexId() const { return this->Index; }
143
150
156
162
167 void SetMask(const vtkHyperTreeGrid* grid, bool state);
168
173 bool IsMasked(const vtkHyperTreeGrid* grid) const;
174
180 bool IsLeaf(const vtkHyperTreeGrid* grid) const;
181
190
195 bool IsTerminalNode(const vtkHyperTreeGrid* grid) const;
196
200 bool IsRoot() { return (this->Index == 0); }
201
210 void ToChild(const vtkHyperTreeGrid* grid, unsigned char ichild);
211
215 vtkHyperTree* GetTree() const { return this->Tree; }
216
220 unsigned int GetLevel() const { return this->Level; }
221
225 double* GetOrigin() { return this->Origin; }
226 const double* GetOrigin() const { return this->Origin; }
227
231 void GetBounds(double bounds[6]) const;
232
236 void GetPoint(double point[3]) const;
237
238private:
242 vtkHyperTree* Tree;
243
247 unsigned int Level;
248
252 vtkIdType Index;
253
257 double Origin[3];
258};
259
260VTK_ABI_NAMESPACE_END
261#endif // vtkHyperTreeGridGeometryLevelEntry
262// 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.
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 children being leaves ?
void GetBounds(double bounds[6]) const
Getter for bounding box of the current cell.
vtkHyperTree * GetTree() const
Get HyperTree from current cache entry.
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.
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.
void Copy(const vtkHyperTreeGridGeometryLevelEntry *entry)
Copy function.
vtkHyperTreeGridGeometryLevelEntry & operator=(vtkHyperTreeGridGeometryLevelEntry const &)=default
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.
void SetGlobalIndexStart(vtkIdType index)
Set the global index for the root cell of the HyperTree.
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cache entry at root of given tree index in grid.
double * GetOrigin()
Getter for origin coordinates of the current cell.
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,...
vtkHyperTreeGridGeometryLevelEntry(vtkHyperTreeGridGeometryLevelEntry const &)=default
unsigned int GetLevel() const
Get level info from current cache entry.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
A data object structured as a tree.
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
static vtkSmartPointer< T > New()
Create an instance of a VTK object.
int vtkIdType
Definition vtkType.h:315