VTK  9.0.1
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 #ifndef __VTK_WRAP__
42 
43 #include "vtkObject.h"
44 
45 class vtkHyperTree;
46 class vtkHyperTreeGrid;
47 
49 {
50 public:
54  void PrintSelf(ostream& os, vtkIndent indent);
55 
60 
65  {
66  this->Index = index;
67  for (unsigned int d = 0; d < 3; ++d)
68  {
69  this->Origin[d] = origin[d];
70  }
71  }
72 
77 
81  void Dump(ostream& os);
82 
86  vtkHyperTree* Initialize(vtkHyperTreeGrid* grid, vtkIdType treeIndex, bool create = false);
87 
91  void Initialize(vtkIdType index, const double* origin)
92  {
93  this->Index = index;
94  for (unsigned int d = 0; d < 3; ++d)
95  {
96  this->Origin[d] = origin[d];
97  }
98  }
99 
104  {
105  this->Index = entry->Index;
106  for (unsigned int d = 0; d < 3; ++d)
107  {
108  this->Origin[d] = entry->Origin[d];
109  }
110  }
111 
115  vtkIdType GetVertexId() const { return this->Index; }
116 
122  vtkIdType GetGlobalNodeIndex(const vtkHyperTree* tree) const;
123 
129 
135 
140  void SetMask(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, bool state);
141 
146  bool IsMasked(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree) const;
147 
153  bool IsLeaf(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
154 
162  void SubdivideLeaf(const vtkHyperTreeGrid* grid, vtkHyperTree* tree, unsigned int level);
163 
168  bool IsTerminalNode(
169  const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level) const;
170 
174  bool IsRoot() const { return (this->Index == 0); }
175 
184  void ToChild(const vtkHyperTreeGrid* grid, const vtkHyperTree* tree, unsigned int level,
185  const double* sizeChild, unsigned char ichild);
186 
190  double* GetOrigin() { return this->Origin; }
191  const double* GetOrigin() const { return this->Origin; }
192 
196  void GetBounds(const double* sizeChild, double bounds[6]) const
197  {
198  // Compute bounds
199  bounds[0] = this->Origin[0];
200  bounds[1] = this->Origin[0] + sizeChild[0];
201  bounds[2] = this->Origin[1];
202  bounds[3] = this->Origin[1] + sizeChild[1];
203  bounds[4] = this->Origin[2];
204  bounds[5] = this->Origin[2] + sizeChild[2];
205  }
206 
210  void GetPoint(const double* sizeChild, double point[3]) const
211  {
212  // Compute center point coordinates
213  point[0] = this->Origin[0] + sizeChild[0] / 2.;
214  point[1] = this->Origin[1] + sizeChild[1] / 2.;
215  point[2] = this->Origin[2] + sizeChild[2] / 2.;
216  }
217 
218 private:
222  vtkIdType Index;
223 
227  double Origin[3];
228 };
229 
230 #endif // __VTK_WRAP__
231 
232 #endif // vtkHyperTreeGridGeometryEntry_h
233 // VTK-HeaderTest-Exclude: vtkHyperTreeGridGeometryEntry.h
vtkIdType GetVertexId() const
Return the index of the current vertex in the tree.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
void PrintSelf(ostream &os, vtkIndent indent)
Display info about the entry.
bool IsTerminalNode(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a coarse with all childrens leaves ?
bool IsRoot() const
Is the cursor at tree root?
int vtkIdType
Definition: vtkType.h:338
vtkHyperTreeGridGeometryEntry(vtkIdType index, const double *origin)
Constructor.
~vtkHyperTreeGridGeometryEntry()=default
Destructor.
vtkHyperTreeGridGeometryEntry()
Constructor.
a simple class to control print indentation
Definition: vtkIndent.h:33
double * GetOrigin()
Getter for origin coordinates of the current cell.
bool IsLeaf(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree, unsigned int level) const
Is the cursor pointing to a leaf?
vtkIdType GetGlobalNodeIndex(const vtkHyperTree *tree) const
Return the global index (relative to the grid) of the current vertex in the tree. ...
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.
void GetPoint(const double *sizeChild, double point[3]) const
Getter for center of the current cell.
void GetBounds(const double *sizeChild, double bounds[6]) const
Getter for bounding box of the current cell.
A data object structured as a tree.
Definition: vtkHyperTree.h:178
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.
void SubdivideLeaf(const vtkHyperTreeGrid *grid, vtkHyperTree *tree, unsigned int level)
Change the current cell&#39;s status: if leaf then becomes coarse and all its children are created...
bool IsMasked(const vtkHyperTreeGrid *grid, const vtkHyperTree *tree) const
Determine whether blanking mask is empty or not.
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.