VTK  9.7.1
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
25 #ifndef vtkHyperTreeGridGeometryEntry_h
26 #define vtkHyperTreeGridGeometryEntry_h
27 
28 #include "vtkObject.h"
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkHyperTree;
32 class vtkHyperTreeGrid;
33 
35 {
36 public:
40  void PrintSelf(ostream& os, vtkIndent indent);
41 
46 
49 
54  {
55  this->Index = index;
56  for (unsigned int d = 0; d < 3; ++d)
57  {
58  this->Origin[d] = origin[d];
59  }
60  }
61 
66 
70  void Dump(ostream& os);
71 
75  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
76 
80  void Initialize(vtkIdType index, const double* origin)
81  {
82  this->Index = index;
83  for (unsigned int d = 0; d < 3; ++d)
84  {
85  this->Origin[d] = origin[d];
86  }
87  }
88 
93  {
94  this->Index = entry->Index;
95  for (unsigned int d = 0; d < 3; ++d)
96  {
97  this->Origin[d] = entry->Origin[d];
98  }
99  }
100 
104  vtkIdType GetVertexId() const { return this->Index; }
105 
111  vtkIdType GetGlobalNodeIndex(const vtkHyperTree* tree) const;
112 
118 
124 
129  void SetMask(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, bool state);
130 
135  bool IsMasked(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree) const;
136 
142  bool IsLeaf(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
143 
151  void SubdivideLeaf(const vtkHyperTreeGrid* grid, vtkHyperTree* tree, unsigned int level);
152 
157  bool IsTerminalNode(
158  const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
159 
163  bool IsRoot() const { return (this->Index == 0); }
164 
173  void ToChild(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level,
174  const double* sizeChild, unsigned char ichild);
175 
179  double* GetOrigin() { return this->Origin; }
180  const double* GetOrigin() const { return this->Origin; }
181 
185  void GetBounds(const double* sizeChild, double bounds[6]) const
186  {
187  // Compute bounds
188  bounds[0] = this->Origin[0];
189  bounds[1] = this->Origin[0] + sizeChild[0];
190  bounds[2] = this->Origin[1];
191  bounds[3] = this->Origin[1] + sizeChild[1];
192  bounds[4] = this->Origin[2];
193  bounds[5] = this->Origin[2] + sizeChild[2];
194  }
195 
199  void GetPoint(const double* sizeChild, double point[3]) const
200  {
201  // Compute center point coordinates
202  point[0] = this->Origin[0] + sizeChild[0] / 2.;
203  point[1] = this->Origin[1] + sizeChild[1] / 2.;
204  point[2] = this->Origin[2] + sizeChild[2] / 2.;
205  }
206 
207 private:
211  vtkIdType Index;
212 
216  double Origin[3];
217 };
218 
219 VTK_ABI_NAMESPACE_END
220 #endif // vtkHyperTreeGridGeometryEntry_h
221 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryEntry.h
void GetBounds(const double *sizeChild, 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.
GeometryEntry is a cache data for cursors requiring coordinates.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
void GetPoint(const double *sizeChild, double point[3]) const
Getter for center of the current cell.
int vtkIdType
Definition: vtkType.h:363
vtkHyperTreeGridGeometryEntry(vtkIdType index, const double *origin)
Constructor.
~vtkHyperTreeGridGeometryEntry()=default
Destructor.
vtkHyperTreeGridGeometryEntry()
Constructor.
bool IsRoot() const
Is the cursor at tree root?
a simple class to control print indentation
Definition: vtkIndent.h:28
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 Copy(const vtkHyperTreeGridGeometryEntry *entry)
Copy function.
void Dump(ostream &os)
Dump information.
void SetMask(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, bool state)
Set the blanking mask is empty or not.
vtkHyperTreeGridGeometryEntry & operator=(vtkHyperTreeGridGeometryEntry const &)=default
bool IsTerminalNode(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a coarse with all children leaves ?
A data object structured as a tree.
Definition: vtkHyperTree.h:170
vtkIdType GetGlobalNodeIndex(const vtkHyperTree *tree) const
Return the global index (relative to the grid) of the current vertex in the tree. ...
vtkHyperTree * Initialize(vtkHyperTreeGrid *grid, vtkIdType treeIndex, bool create=false)
Initialize cursor at root of given tree index in grid.
void Initialize(vtkIdType index, const double *origin)
Initialize cursor from explicit required data.
bool IsLeaf(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a leaf?
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...
void SetGlobalIndexFromLocal(vtkHyperTree *tree, vtkIdType index)
Set the global index for the current cell of the HyperTree.
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.
bool IsMasked(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree) const
Determine whether blanking mask is empty or not.