VTK  9.2.5
vtkHyperTreeGridGeometryEntry.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkHyperTreeGridGeometryEntry.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=========================================================================*/
38#ifndef vtkHyperTreeGridGeometryEntry_h
39#define vtkHyperTreeGridGeometryEntry_h
40
41#include "vtkObject.h"
42
43class vtkHyperTree;
45
47{
48public:
52 void PrintSelf(ostream& os, vtkIndent indent);
53
58
62 vtkHyperTreeGridGeometryEntry(vtkIdType index, const double* origin)
63 {
64 this->Index = index;
65 for (unsigned int d = 0; d < 3; ++d)
66 {
67 this->Origin[d] = origin[d];
68 }
69 }
70
75
79 void Dump(ostream& os);
80
84 vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
85
89 void Initialize(vtkIdType index, const double* origin)
90 {
91 this->Index = index;
92 for (unsigned int d = 0; d < 3; ++d)
93 {
94 this->Origin[d] = origin[d];
95 }
96 }
97
102 {
103 this->Index = entry->Index;
104 for (unsigned int d = 0; d < 3; ++d)
105 {
106 this->Origin[d] = entry->Origin[d];
107 }
108 }
109
113 vtkIdType GetVertexId() const { return this->Index; }
114
121
127
133
138 void SetMask(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, bool state);
139
144 bool IsMasked(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree) const;
145
151 bool IsLeaf(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
152
160 void SubdivideLeaf(const vtkHyperTreeGrid* grid, vtkHyperTree* tree, unsigned int level);
161
167 const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
168
172 bool IsRoot() const { return (this->Index == 0); }
173
182 void ToChild(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level,
183 const double* sizeChild, unsigned char ichild);
184
188 double* GetOrigin() { return this->Origin; }
189 const double* GetOrigin() const { return this->Origin; }
190
194 void GetBounds(const double* sizeChild, double bounds[6]) const
195 {
196 // Compute bounds
197 bounds[0] = this->Origin[0];
198 bounds[1] = this->Origin[0] + sizeChild[0];
199 bounds[2] = this->Origin[1];
200 bounds[3] = this->Origin[1] + sizeChild[1];
201 bounds[4] = this->Origin[2];
202 bounds[5] = this->Origin[2] + sizeChild[2];
203 }
204
208 void GetPoint(const double* sizeChild, double point[3]) const
209 {
210 // Compute center point coordinates
211 point[0] = this->Origin[0] + sizeChild[0] / 2.;
212 point[1] = this->Origin[1] + sizeChild[1] / 2.;
213 point[2] = this->Origin[2] + sizeChild[2] / 2.;
214 }
215
216private:
220 vtkIdType Index;
221
225 double Origin[3];
226};
227
228#endif // vtkHyperTreeGridGeometryEntry_h
229// 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.
Definition: vtkHyperTree.h:180
a simple class to control print indentation
Definition: vtkIndent.h:40
int vtkIdType
Definition: vtkType.h:332