VTK  9.3.0
vtkHyperTreeGridGeometryEntry.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
26#ifndef vtkHyperTreeGridGeometryEntry_h
27#define vtkHyperTreeGridGeometryEntry_h
28
29#include "vtkObject.h"
30
31VTK_ABI_NAMESPACE_BEGIN
32class vtkHyperTree;
34
36{
37public:
41 void PrintSelf(ostream& os, vtkIndent indent);
42
47
51 vtkHyperTreeGridGeometryEntry(vtkIdType index, const double* origin)
52 {
53 this->Index = index;
54 for (unsigned int d = 0; d < 3; ++d)
55 {
56 this->Origin[d] = origin[d];
57 }
58 }
59
64
68 void Dump(ostream& os);
69
73 vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
74
78 void Initialize(vtkIdType index, const double* origin)
79 {
80 this->Index = index;
81 for (unsigned int d = 0; d < 3; ++d)
82 {
83 this->Origin[d] = origin[d];
84 }
85 }
86
91 {
92 this->Index = entry->Index;
93 for (unsigned int d = 0; d < 3; ++d)
94 {
95 this->Origin[d] = entry->Origin[d];
96 }
97 }
98
102 vtkIdType GetVertexId() const { return this->Index; }
103
110
116
122
127 void SetMask(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, bool state);
128
133 bool IsMasked(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree) const;
134
140 bool IsLeaf(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
141
149 void SubdivideLeaf(const vtkHyperTreeGrid* grid, vtkHyperTree* tree, unsigned int level);
150
156 const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
157
161 bool IsRoot() const { return (this->Index == 0); }
162
171 void ToChild(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level,
172 const double* sizeChild, unsigned char ichild);
173
177 double* GetOrigin() { return this->Origin; }
178 const double* GetOrigin() const { return this->Origin; }
179
183 void GetBounds(const double* sizeChild, double bounds[6]) const
184 {
185 // Compute bounds
186 bounds[0] = this->Origin[0];
187 bounds[1] = this->Origin[0] + sizeChild[0];
188 bounds[2] = this->Origin[1];
189 bounds[3] = this->Origin[1] + sizeChild[1];
190 bounds[4] = this->Origin[2];
191 bounds[5] = this->Origin[2] + sizeChild[2];
192 }
193
197 void GetPoint(const double* sizeChild, double point[3]) const
198 {
199 // Compute center point coordinates
200 point[0] = this->Origin[0] + sizeChild[0] / 2.;
201 point[1] = this->Origin[1] + sizeChild[1] / 2.;
202 point[2] = this->Origin[2] + sizeChild[2] / 2.;
203 }
204
205private:
209 vtkIdType Index;
210
214 double Origin[3];
215};
216
217VTK_ABI_NAMESPACE_END
218#endif // vtkHyperTreeGridGeometryEntry_h
219// VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryEntry.h
vtkHyperTreeGridGeometryEntry()
Constructor.
void GetBounds(const double *sizeChild, double bounds[6]) const
Getter for bounding box of the current cell.
void SubdivideLeaf(const vtkHyperTreeGrid *grid, vtkHyperTree *tree, unsigned int level)
Change the current cell's status: if leaf then becomes coarse and all its children are created,...
double * GetOrigin()
Getter for origin coordinates of the current cell.
void SetGlobalIndexStart(vtkHyperTree *tree, vtkIdType index)
Set the global index for the root cell of the HyperTree.
void Dump(ostream &os)
Dump information.
vtkHyperTreeGridGeometryEntry(vtkIdType index, const double *origin)
Constructor.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
bool IsRoot() const
Is the cursor at tree root?
void SetGlobalIndexFromLocal(vtkHyperTree *tree, vtkIdType index)
Set the global index for the current cell of the HyperTree.
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
bool IsLeaf(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a leaf?
~vtkHyperTreeGridGeometryEntry()=default
Destructor.
void Initialize(vtkIdType index, const double *origin)
Initialize cursor from explicit required data.
bool IsMasked(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree) const
Determine whether blanking mask is empty or not.
void ToChild(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level, const double *sizeChild, unsigned char ichild)
Move the cursor to child ‘child’ of the current vertex.
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
void Copy(const vtkHyperTreeGridGeometryEntry *entry)
Copy function.
vtkIdType GetGlobalNodeIndex(const vtkHyperTree *tree) const
Return the global index (relative to the grid) of the current vertex in the tree.
void SetMask(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, bool state)
Set the blanking mask is empty or not.
bool IsTerminalNode(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a coarse with all childrens leaves ?
void GetPoint(const double *sizeChild, double point[3]) const
Getter for center of the current cell.
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:29
int vtkIdType
Definition vtkType.h:315