VTK  9.0.1
vtkUniformHyperTreeGrid.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkUniformHyperTreeGrid.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 =========================================================================*/
30 #ifndef vtkUniformHyperTreeGrid_h
31 #define vtkUniformHyperTreeGrid_h
32 
33 #include "limits.h" // UINT_MAX
34 
35 #include <memory> // std::shared_ptr
36 
37 #include "vtkCommonDataModelModule.h" // For export macro
38 #include "vtkHyperTreeGrid.h"
39 
40 class vtkDoubleArray;
42 
43 class VTKCOMMONDATAMODEL_EXPORT vtkUniformHyperTreeGrid : public vtkHyperTreeGrid
44 {
45 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
54 
59  void CopyStructure(vtkDataObject*) override;
60 
61  virtual void Initialize() override;
62 
64 
67  vtkSetVector3Macro(Origin, double);
68  vtkGetVector3Macro(Origin, double);
70 
72 
75  void SetGridScale(double, double, double);
76  void SetGridScale(double*);
77  vtkGetVector3Macro(GridScale, double);
79 
83  void SetGridScale(double);
84 
90  double* GetBounds() VTK_SIZEHINT(6) override;
91 
93 
98  void SetXCoordinates(vtkDataArray* XCoordinates) override;
99  vtkDataArray* GetXCoordinates() override;
100  /* JB A faire pour les Get !
101  const vtkDataArray* GetXCoordinates() const override {
102  throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
103  }
104  */
106 
108 
113  void SetYCoordinates(vtkDataArray* YCoordinates) override;
114  vtkDataArray* GetYCoordinates() override;
115  /* JB A faire pour les Get !
116  const vtkDataArray* GetYCoordinates() const override {
117  throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
118  }
119  */
121 
123 
128  void SetZCoordinates(vtkDataArray* ZCoordinates) override;
129  vtkDataArray* GetZCoordinates() override;
130  /* JB A faire pour les Get !
131  const vtkDataArray* GetZCoordinates() const override {
132  throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
133  }
134  */
135  // JB A faire pour les autre Get !
137 
139 
142  void CopyCoordinates(const vtkHyperTreeGrid* output) override;
143  void SetFixedCoordinates(unsigned int axis, double value) override;
145 
149  void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double*, double*) override;
150 
154  void GetLevelZeroOriginFromIndex(vtkIdType, double*) override;
155 
159  void ShallowCopy(vtkDataObject*) override;
160 
164  void DeepCopy(vtkDataObject*) override;
165 
169  unsigned long GetActualMemorySizeBytes() override;
170 
175  vtkHyperTree* GetTree(vtkIdType, bool create = false) override;
176 
177 protected:
182 
187 
191  double Origin[3];
192 
196  double GridScale[3];
197 
199 
202  bool ComputedXCoordinates;
203  bool ComputedYCoordinates;
204  bool ComputedZCoordinates;
206 
207  unsigned int FindDichotomicX(double value) const override
208  {
209  if (value < this->Origin[0] ||
210  value > this->Origin[0] + this->GridScale[0] * (this->GetDimensions()[0] - 1))
211  {
212  return UINT_MAX;
213  }
214  return round((value - this->Origin[0]) / this->GridScale[0]);
215  }
216  unsigned int FindDichotomicY(double value) const override
217  {
218  if (value < this->Origin[1] ||
219  value > this->Origin[1] + this->GridScale[1] * (this->GetDimensions()[1] - 1))
220  {
221  return UINT_MAX;
222  }
223  return round((value - this->Origin[1]) / this->GridScale[1]);
224  }
225  unsigned int FindDichotomicZ(double value) const override
226  {
227  if (value < this->Origin[2] ||
228  value > this->Origin[2] + this->GridScale[2] * (this->GetDimensions()[2] - 1))
229  {
230  return UINT_MAX;
231  }
232  return round((value - this->Origin[2]) / this->GridScale[2]);
233  }
234 
238  mutable std::shared_ptr<vtkHyperTreeGridScales> Scales;
239 
240 private:
242  void operator=(const vtkUniformHyperTreeGrid&) = delete;
243 };
244 
245 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
general representation of visualization data
Definition: vtkDataObject.h:60
dynamic, self-adjusting array of double
A specifalized type of vtkHyperTreeGrid for the case when root cells have uniform sizes in each direc...
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
const unsigned int * GetDimensions() const
Get dimensions of this rectilinear grid dataset.
A data object structured as a tree.
Definition: vtkHyperTree.h:179
a simple class to control print indentation
Definition: vtkIndent.h:34
A specifalized type of vtkHyperTreeGrid for the case when root cells have uniform sizes in each direc...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetGridScale(double, double, double)
Set/Get scale of root cells along each direction.
std::shared_ptr< vtkHyperTreeGridScales > Scales
JB Storage of pre-computed per-level cell scales.
void SetGridScale(double *)
void SetGridScale(double)
Set all scales at once when root cells are d-cubes.
unsigned int FindDichotomicY(double value) const override
unsigned int FindDichotomicZ(double value) const override
int GetDataObjectType() override
Return what type of dataset this is.
virtual void Initialize() override
Restore data object to initial state.
double * GetBounds() override
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
void CopyStructure(vtkDataObject *) override
Copy the internal geometric and topological structure of a vtkUniformHyperTreeGrid object.
static vtkUniformHyperTreeGrid * New()
@ value
Definition: vtkX3D.h:226
#define VTK_UNIFORM_HYPER_TREE_GRID
Definition: vtkType.h:124
int vtkIdType
Definition: vtkType.h:338
#define VTK_SIZEHINT(...)