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=========================================================================*/
29
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
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
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
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
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
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:34
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(...)