VTK  9.7.1
vtkHyperTreeGridGeometryUnlimitedEntry.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 vtkHyperTreeGridGeometryUnlimitedEntry_h
26 #define vtkHyperTreeGridGeometryUnlimitedEntry_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 
52 
57 
61  void Dump(ostream& os);
62 
66  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
67 
71  void Initialize(vtkIdType index, vtkIdType lastIndex, const double* origin)
72  {
73  this->Index = index;
74  this->LastRealIndex = lastIndex;
75  for (unsigned int d = 0; d < 3; ++d)
76  {
77  this->Origin[d] = origin[d];
78  }
79  }
80 
85  {
86  this->Initialize(entry->Index, entry->LastRealIndex, entry->Origin);
87  }
88 
92  vtkIdType GetVertexId() const { return this->LastRealIndex; }
93 
99  vtkIdType GetGlobalNodeIndex(const vtkHyperTree* tree) const;
100 
105  void SetGlobalIndexStart(vtkHyperTree* tree, vtkIdType index);
106 
112 
117  void SetMask(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, bool state);
118 
123  bool IsMasked(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree) const;
124 
131  bool IsLeaf(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
132 
139  bool IsRealLeaf(const vtkHyperTree* tree) const;
140 
146  bool IsVirtualLeaf(const vtkHyperTree* tree) const;
147 
152  bool IsTerminalNode(
153  const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
154 
158  bool IsRoot() const { return (this->Index == 0); }
159 
168  void ToChild(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level,
169  const double* sizeChild, unsigned char ichild);
170 
174  double* GetOrigin() { return this->Origin; }
175  const double* GetOrigin() const { return this->Origin; }
176 
180  void GetBounds(const double* sizeChild, double bounds[6]) const
181  {
182  // Compute bounds
183  bounds[0] = this->Origin[0];
184  bounds[1] = this->Origin[0] + sizeChild[0];
185  bounds[2] = this->Origin[1];
186  bounds[3] = this->Origin[1] + sizeChild[1];
187  bounds[4] = this->Origin[2];
188  bounds[5] = this->Origin[2] + sizeChild[2];
189  }
190 
194  void GetPoint(const double* sizeChild, double point[3]) const
195  {
196  // Compute center point coordinates
197  point[0] = this->Origin[0] + sizeChild[0] / 2.;
198  point[1] = this->Origin[1] + sizeChild[1] / 2.;
199  point[2] = this->Origin[2] + sizeChild[2] / 2.;
200  }
201 
202 private:
206  vtkIdType Index = 0;
207 
211  vtkIdType LastRealIndex = 0;
212 
216  double Origin[3];
217 };
218 
219 VTK_ABI_NAMESPACE_END
220 #endif // vtkHyperTreeGridGeometryUnlimitedEntry_h
221 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryUnlimitedEntry.h
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
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 IsLeaf(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a leaf? Unlimited cursors allow to go deeper than a real leaf...
void SetGlobalIndexStart(vtkHyperTree *tree, vtkIdType index)
Set the global index for the root cell of the HyperTree.
void GetBounds(const double *sizeChild, double bounds[6]) const
Getter for bounding box of the current cell.
bool IsRoot() const
Is the cursor at tree root?
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
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 children leaves ?
void SetGlobalIndexFromLocal(vtkHyperTree *tree, vtkIdType index)
Set the global index for the current cell of the HyperTree.
void Copy(const vtkHyperTreeGridGeometryUnlimitedEntry *entry)
Copy function.
int vtkIdType
Definition: vtkType.h:363
GeometryUnlimitedEntry is a cache data for cursors requiring coordinates.
bool IsMasked(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree) const
Determine whether blanking mask is empty or not.
a simple class to control print indentation
Definition: vtkIndent.h:28
bool IsVirtualLeaf(const vtkHyperTree *tree) const
Is the cursor pointing below a real leaf of the underlying tree ?
vtkIdType GetVertexId() const
Return the index 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 GetPoint(const double *sizeChild, double point[3]) const
Getter for center of the current cell.
vtkIdType GetGlobalNodeIndex(const vtkHyperTree *tree) const
Return the global index (relative to the grid) of the current vertex in the tree. ...
A data object structured as a tree.
Definition: vtkHyperTree.h:170
bool IsRealLeaf(const vtkHyperTree *tree) const
Is the cursor pointing to a real leaf of the underlying tree ?
vtkHyperTreeGridGeometryUnlimitedEntry()
Constructor.
void Dump(ostream &os)
Dump information.
double * GetOrigin()
Getter for origin coordinates of the current cell.
~vtkHyperTreeGridGeometryUnlimitedEntry()=default
Destructor.
void Initialize(vtkIdType index, vtkIdType lastIndex, const double *origin)
Initialize cursor from explicit required data.