VTK  9.2.6
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=========================================================================*/
33#ifndef vtkUniformHyperTreeGrid_h
34#define vtkUniformHyperTreeGrid_h
35
36#include "limits.h" // UINT_MAX
37
38#include <algorithm> // std::min/std::max
39#include <cmath> // std::round
40#include <memory> // std::shared_ptr
41
42#include "vtkCommonDataModelModule.h" // For export macro
43#include "vtkHyperTreeGrid.h"
44
45class vtkDoubleArray;
47
48class VTKCOMMONDATAMODEL_EXPORT vtkUniformHyperTreeGrid : public vtkHyperTreeGrid
49{
50public:
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
59
65
66 void Initialize() override;
67
69
72 vtkSetVector3Macro(Origin, double);
73 vtkGetVector3Macro(Origin, double);
75
77
80 void SetGridScale(double, double, double);
81 void SetGridScale(double*);
82 vtkGetVector3Macro(GridScale, double);
84
88 void SetGridScale(double);
89
95 double* GetBounds() VTK_SIZEHINT(6) override;
96
98
103 void SetXCoordinates(vtkDataArray* XCoordinates) override;
104 vtkDataArray* GetXCoordinates() override;
105 /* JB A faire pour les Get !
106 const vtkDataArray* GetXCoordinates() const override {
107 throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
108 }
109 */
111
113
118 void SetYCoordinates(vtkDataArray* YCoordinates) override;
119 vtkDataArray* GetYCoordinates() override;
120 /* JB A faire pour les Get !
121 const vtkDataArray* GetYCoordinates() const override {
122 throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
123 }
124 */
126
128
133 void SetZCoordinates(vtkDataArray* ZCoordinates) override;
134 vtkDataArray* GetZCoordinates() override;
135 /* JB A faire pour les Get !
136 const vtkDataArray* GetZCoordinates() const override {
137 throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
138 }
139 */
140 // JB A faire pour les autre Get !
142
144
147 void CopyCoordinates(const vtkHyperTreeGrid* output) override;
148 void SetFixedCoordinates(unsigned int axis, double value) override;
150
154 void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double*, double*) override;
155
159 void GetLevelZeroOriginFromIndex(vtkIdType, double*) override;
160
164 void ShallowCopy(vtkDataObject*) override;
165
169 void DeepCopy(vtkDataObject*) override;
170
174 unsigned long GetActualMemorySizeBytes() override;
175
180 vtkHyperTree* GetTree(vtkIdType, bool create = false) override;
181
182protected:
187
192
196 double Origin[3];
197
201 double GridScale[3];
202
204
207 bool ComputedXCoordinates;
208 bool ComputedYCoordinates;
209 bool ComputedZCoordinates;
211
212 unsigned int FindDichotomicX(double value) const override
213 {
214 if (value < this->Origin[0] ||
215 value > this->Origin[0] + this->GridScale[0] * (this->GetDimensions()[0] - 1))
216 {
217 return UINT_MAX;
218 }
219 return std::round((value - this->Origin[0]) / this->GridScale[0]);
220 }
221 unsigned int FindDichotomicY(double value) const override
222 {
223 if (value < this->Origin[1] ||
224 value > this->Origin[1] + this->GridScale[1] * (this->GetDimensions()[1] - 1))
225 {
226 return UINT_MAX;
227 }
228 return std::round((value - this->Origin[1]) / this->GridScale[1]);
229 }
230 unsigned int FindDichotomicZ(double value) const override
231 {
232 if (value < this->Origin[2] ||
233 value > this->Origin[2] + this->GridScale[2] * (this->GetDimensions()[2] - 1))
234 {
235 return UINT_MAX;
236 }
237 return std::round((value - this->Origin[2]) / this->GridScale[2]);
238 }
239
243 mutable std::shared_ptr<vtkHyperTreeGridScales> Scales;
244
245private:
247 void operator=(const vtkUniformHyperTreeGrid&) = delete;
248};
249
250#endif
abstract superclass for arrays of numeric data
general representation of visualization data
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.
a simple class to control print indentation
Definition vtkIndent.h:40
A specifalized type of vtkHyperTreeGrid for the case when root cells have uniform sizes in each direc...
static vtkUniformHyperTreeGrid * New()
void Initialize() override
Restore data object to initial state.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
double * GetBounds() override
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
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 *)
Set/Get scale of root cells along each direction.
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.
void CopyStructure(vtkDataObject *) override
Copy the internal geometric and topological structure of a vtkUniformHyperTreeGrid object.
#define VTK_UNIFORM_HYPER_TREE_GRID
Definition vtkType.h:116
int vtkIdType
Definition vtkType.h:332
#define VTK_SIZEHINT(...)