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=========================================================================*/
32
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
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
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
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
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
dynamic, self-adjusting array of double
A specifalized type of vtkHyperTreeGrid for the case when root cells have uniform sizes in each direc...
const unsigned int * GetDimensions() const
Get dimensions of this rectilinear grid dataset.
vtkDataArray * ZCoordinates
vtkDataArray * YCoordinates
vtkHyperTreeGrid()
Constructor with default bounds (0,1, 0,1, 0,1).
vtkDataArray * XCoordinates
A data object structured as a tree.
a simple class to control print indentation
Definition vtkIndent.h:40
static vtkUniformHyperTreeGrid * New()
void Initialize() override
Restore data object to initial state.
bool ComputedXCoordinates
Keep track of whether coordinates have been explicitly computed.
vtkDataArray * GetYCoordinates() override
Set/Get the grid coordinates in the y-direction.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double *, double *) override
Convert the global index of a root to its Spacial coordinates origin and size.
void SetXCoordinates(vtkDataArray *XCoordinates) override
Set/Get the grid coordinates in the x-direction.
double * GetBounds() override
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
void CopyCoordinates(const vtkHyperTreeGrid *output) override
JB Augented services on Coordinates.
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 DeepCopy(vtkDataObject *) override
Create deep copy of hyper tree grid.
bool ComputedZCoordinates
Keep track of whether coordinates have been explicitly computed.
vtkUniformHyperTreeGrid()
Constructor.
bool ComputedYCoordinates
Keep track of whether coordinates have been explicitly computed.
vtkDataArray * GetXCoordinates() override
Set/Get the grid coordinates in the x-direction.
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 long GetActualMemorySizeBytes() override
Return the actual size of the data bytes.
double GridScale[3]
Element sizes in each direction.
unsigned int FindDichotomicY(double value) const override
void ShallowCopy(vtkDataObject *) override
Create shallow copy of hyper tree grid.
vtkHyperTree * GetTree(vtkIdType, bool create=false) override
Return tree located at given index of hyper tree grid NB: This will construct a new HyperTree if grid...
vtkDataArray * GetZCoordinates() override
Set/Get the grid coordinates in the z-direction.
void SetYCoordinates(vtkDataArray *YCoordinates) override
Set/Get the grid coordinates in the y-direction.
unsigned int FindDichotomicX(double value) const override
void SetZCoordinates(vtkDataArray *ZCoordinates) override
Set/Get the grid coordinates in the z-direction.
unsigned int FindDichotomicZ(double value) const override
void GetLevelZeroOriginFromIndex(vtkIdType, double *) override
Convert the global index of a root to its Spacial coordinates origin and size.
int GetDataObjectType() override
Return what type of dataset this is.
void SetFixedCoordinates(unsigned int axis, double value) override
JB Augented services on Coordinates.
void CopyStructure(vtkDataObject *) override
Copy the internal geometric and topological structure of a vtkUniformHyperTreeGrid object.
#define vtkDataArray
#define VTK_UNIFORM_HYPER_TREE_GRID
Definition vtkType.h:116
int vtkIdType
Definition vtkType.h:332
#define VTK_SIZEHINT(...)