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=========================================================================*/
30#ifndef vtkUniformHyperTreeGrid_h
31#define vtkUniformHyperTreeGrid_h
32
33#include "limits.h" // UINT_MAX
34
35#include <algorithm> // std::min/std::max
36#include <cmath> // std::round
37#include <memory> // std::shared_ptr
38
39#include "vtkCommonDataModelModule.h" // For export macro
40#include "vtkHyperTreeGrid.h"
41
42class vtkDoubleArray;
44
45class VTKCOMMONDATAMODEL_EXPORT vtkUniformHyperTreeGrid : public vtkHyperTreeGrid
46{
47public:
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
56
62
63 void Initialize() override;
64
66
69 vtkSetVector3Macro(Origin, double);
70 vtkGetVector3Macro(Origin, double);
72
74
77 void SetGridScale(double, double, double);
78 void SetGridScale(double*);
79 vtkGetVector3Macro(GridScale, double);
81
85 void SetGridScale(double);
86
92 double* GetBounds() VTK_SIZEHINT(6) override;
93
95
100 void SetXCoordinates(vtkDataArray* XCoordinates) override;
101 vtkDataArray* GetXCoordinates() override;
102 /* JB A faire pour les Get !
103 const vtkDataArray* GetXCoordinates() const override {
104 throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
105 }
106 */
108
110
115 void SetYCoordinates(vtkDataArray* YCoordinates) override;
116 vtkDataArray* GetYCoordinates() override;
117 /* JB A faire pour les Get !
118 const vtkDataArray* GetYCoordinates() const override {
119 throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
120 }
121 */
123
125
130 void SetZCoordinates(vtkDataArray* ZCoordinates) override;
131 vtkDataArray* GetZCoordinates() override;
132 /* JB A faire pour les Get !
133 const vtkDataArray* GetZCoordinates() const override {
134 throw std::domain_error("Cannot use GetZCoordinates on UniformHyperTreeGrid");
135 }
136 */
137 // JB A faire pour les autre Get !
139
141
144 void CopyCoordinates(const vtkHyperTreeGrid* output) override;
145 void SetFixedCoordinates(unsigned int axis, double value) override;
147
151 void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double*, double*) override;
152
156 void GetLevelZeroOriginFromIndex(vtkIdType, double*) override;
157
161 void ShallowCopy(vtkDataObject*) override;
162
166 void DeepCopy(vtkDataObject*) override;
167
171 unsigned long GetActualMemorySizeBytes() override;
172
177 vtkHyperTree* GetTree(vtkIdType, bool create = false) override;
178
179protected:
184
189
193 double Origin[3];
194
198 double GridScale[3];
199
201
204 bool ComputedXCoordinates;
205 bool ComputedYCoordinates;
206 bool ComputedZCoordinates;
208
209 unsigned int FindDichotomicX(double value) const override
210 {
211 if (value < this->Origin[0] ||
212 value > this->Origin[0] + this->GridScale[0] * (this->GetDimensions()[0] - 1))
213 {
214 return UINT_MAX;
215 }
216 return std::round((value - this->Origin[0]) / this->GridScale[0]);
217 }
218 unsigned int FindDichotomicY(double value) const override
219 {
220 if (value < this->Origin[1] ||
221 value > this->Origin[1] + this->GridScale[1] * (this->GetDimensions()[1] - 1))
222 {
223 return UINT_MAX;
224 }
225 return std::round((value - this->Origin[1]) / this->GridScale[1]);
226 }
227 unsigned int FindDichotomicZ(double value) const override
228 {
229 if (value < this->Origin[2] ||
230 value > this->Origin[2] + this->GridScale[2] * (this->GetDimensions()[2] - 1))
231 {
232 return UINT_MAX;
233 }
234 return std::round((value - this->Origin[2]) / this->GridScale[2]);
235 }
236
240 mutable std::shared_ptr<vtkHyperTreeGridScales> Scales;
241
242private:
244 void operator=(const vtkUniformHyperTreeGrid&) = delete;
245};
246
247#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:34
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(...)