VTK  9.2.6
vtkHyperTreeGrid.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkHyperTreeGrid.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=========================================================================*/
61
62#ifndef vtkHyperTreeGrid_h
63#define vtkHyperTreeGrid_h
64
65#include "vtkCommonDataModelModule.h" // For export macro
66#include "vtkDataObject.h"
67
68#include "vtkDeprecation.h" // for deprecation macro
69#include "vtkNew.h" // vtkSmartPointer
70#include "vtkSmartPointer.h" // vtkSmartPointer
71
72#include <cassert> // std::assert
73#include <map> // std::map
74#include <memory> // std::shared_ptr
75
76class vtkBitArray;
77class vtkBoundingBox;
78class vtkCellLinks;
79class vtkCollection;
80class vtkDataArray;
81class vtkHyperTree;
90class vtkDoubleArray;
92class vtkIdTypeArray;
93class vtkLine;
94class vtkPixel;
95class vtkPoints;
96class vtkCellData;
98
99class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGrid : public vtkDataObject
100{
101public:
107
109 void PrintSelf(ostream& os, vtkIndent indent) override;
110
115 static constexpr vtkIdType InvalidIndex = ~0;
116
120 vtkSetStringMacro(ModeSqueeze); // By copy
121 vtkGetStringMacro(ModeSqueeze);
122
126 virtual void Squeeze();
127
131 int GetDataObjectType() override { return VTK_HYPER_TREE_GRID; }
132
138
143
144 // --------------------------------------------------------------------------
145 // RectilinearGrid common API
146 // --------------------------------------------------------------------------
147
149
152 void SetDimensions(const unsigned int dims[3]);
153 void SetDimensions(const int dims[3]);
154 void SetDimensions(unsigned int i, unsigned int j, unsigned int k);
155 void SetDimensions(int i, int j, int k);
157
159
163 const unsigned int* GetDimensions() const VTK_SIZEHINT(3);
164 // JB Dommage, car vtkGetVectorMacro(Dimensions,int,3); not const function
165 void GetDimensions(int dim[3]) const;
166 void GetDimensions(unsigned int dim[3]) const;
168
170
176 void SetExtent(const int extent[6]);
177 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
178 vtkGetVector6Macro(Extent, int);
180
182
187 const unsigned int* GetCellDims() const VTK_SIZEHINT(3);
188 void GetCellDims(int cellDims[3]) const;
189 void GetCellDims(unsigned int cellDims[3]) const;
191
192 // --------------------------------------------------------------------------
193
195
199 unsigned int GetDimension() const { return this->Dimension; }
201
203
206 void Get1DAxis(unsigned int& axis) const
207 {
208 assert("pre: valid_dim" && this->GetDimension() == 1);
209 axis = this->Axis[0];
210 }
211
212
214
217 void Get2DAxes(unsigned int& axis1, unsigned int& axis2) const
218 {
219 assert("pre: valid_dim" && this->GetDimension() == 2);
220 axis1 = this->Axis[0];
221 axis2 = this->Axis[1];
222 }
223
224
226
229 const unsigned int* GetAxes() const { return this->Axis; }
231
233
236 // vtkGetMacro(NumberOfChildren, unsigned int); not const
237 unsigned int GetNumberOfChildren() const { return this->NumberOfChildren; }
239
249 // JB ?? virtual void GetNumberOfTreesPerDimension(unsigned int dimsOut[3]);
250
252
256 vtkSetMacro(TransposedRootIndexing, bool);
257 vtkGetMacro(TransposedRootIndexing, bool);
261
263
269 unsigned int GetOrientation() const { return this->Orientation; }
271
273
276 vtkGetMacro(FreezeState, bool);
278
280
283 void SetBranchFactor(unsigned int);
284 unsigned int GetBranchFactor() const { return this->BranchFactor; }
286
291
295 VTK_DEPRECATED_IN_9_2_0("Please use the renamed version, GetNumberOfCells().")
297
302
307
312
316 unsigned int GetNumberOfLevels();
317
319
323 vtkGetObjectMacro(XCoordinates, vtkDataArray);
325
327
331 vtkGetObjectMacro(YCoordinates, vtkDataArray);
333
335
339 vtkGetObjectMacro(ZCoordinates, vtkDataArray);
341
343
346 virtual void CopyCoordinates(const vtkHyperTreeGrid* output);
347 virtual void SetFixedCoordinates(unsigned int axis, double value);
349
351
355 vtkGetObjectMacro(Mask, vtkBitArray);
357
361 bool HasMask();
362
364
367 vtkSetMacro(HasInterface, bool);
368 vtkGetMacro(HasInterface, bool);
369 vtkBooleanMacro(HasInterface, bool);
371
373
376 vtkSetStringMacro(InterfaceNormalsName);
377 vtkGetStringMacro(InterfaceNormalsName);
379
381
384 vtkSetStringMacro(InterfaceInterceptsName);
385 vtkGetStringMacro(InterfaceInterceptsName);
387
389
392 vtkSetMacro(DepthLimiter, unsigned int);
393 vtkGetMacro(DepthLimiter, unsigned int);
395
400 vtkHyperTreeGridOrientedCursor* cursor, vtkIdType index, bool create = false);
402
407 vtkHyperTreeGridOrientedGeometryCursor* cursor, vtkIdType index, bool create = false);
409 vtkIdType index, bool create = false);
410
415 vtkHyperTreeGridNonOrientedCursor* cursor, vtkIdType index, bool create = false);
417
422 vtkHyperTreeGridNonOrientedGeometryCursor* cursor, vtkIdType index, bool create = false);
424 vtkIdType index, bool create = false);
425
430
431private:
432 unsigned int RecurseDichotomic(
433 double value, vtkDoubleArray* coord, unsigned int ideb, unsigned int ifin) const;
434
435 unsigned int FindDichotomic(double value, vtkDataArray* coord) const;
436
437public:
438 virtual unsigned int FindDichotomicX(double value) const;
439 virtual unsigned int FindDichotomicY(double value) const;
440 virtual unsigned int FindDichotomicZ(double value) const;
441
446 vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* cursor, vtkIdType index, bool create = false);
448 vtkIdType index, bool create = false);
449
455 bool create = false);
457 vtkIdType index, bool create = false);
458
463 vtkHyperTreeGridNonOrientedMooreSuperCursor* cursor, vtkIdType index, bool create = false);
465 vtkIdType index, bool create = false);
466
471 vtkHyperTreeGridNonOrientedMooreSuperCursorLight* cursor, vtkIdType index, bool create = false);
473 vtkIdType index, bool create = false);
474
478 void Initialize() override;
479
484 virtual vtkHyperTree* GetTree(vtkIdType, bool create = false);
485
491
495 void ShallowCopy(vtkDataObject*) override;
496
500 void DeepCopy(vtkDataObject*) override;
501
505 int GetExtentType() override { return VTK_3D_EXTENT; }
506
515 virtual unsigned long GetActualMemorySizeBytes();
516
525 unsigned long GetActualMemorySize() override;
526
532
537
588 unsigned int GetChildMask(unsigned int);
589
593 void GetIndexFromLevelZeroCoordinates(vtkIdType&, unsigned int, unsigned int, unsigned int) const;
594
600 vtkIdType GetShiftedLevelZeroIndex(vtkIdType, unsigned int, unsigned int, unsigned int) const;
601
606 vtkIdType, unsigned int&, unsigned int&, unsigned int&) const;
607
611 virtual void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double*, double*);
612
617
627
634
638 bool HasAnyGhostCells() const;
639
645
652
657
661 class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGridIterator
662 {
663 public:
665
670
676
682
683 protected:
684 std::map<vtkIdType, vtkSmartPointer<vtkHyperTree>>::iterator Iterator;
686 };
687
693
695
701
707 virtual double* GetBounds() VTK_SIZEHINT(6);
708
714 void GetBounds(double bounds[6]);
715
721
726 void GetCenter(double center[3]);
727
733
740
746 vtkIdType GetNumberOfElements(int type) override;
747
753
754protected:
759
763 ~vtkHyperTreeGrid() override;
764
769
770 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
771 double Center[3]; // geometric center
772
774 unsigned int BranchFactor; // 2 or 3
775 unsigned int Dimension; // 1, 2, or 3
776
778
785private:
786 unsigned int Orientation; // 0, 1, or 2
787 unsigned int Axis[2];
788
789protected:
790 unsigned int NumberOfChildren;
792
793 // --------------------------------
794 // RectilinearGrid common fields
795 // --------------------------------
796private:
797 unsigned int Dimensions[3]; // Just for GetDimensions
798 unsigned int CellDims[3]; // Just for GetCellDims
799protected:
801 int Extent[6];
802
807 // --------------------------------
808
812
816
818
819 vtkNew<vtkCellData> CellData; // Scalars, vectors, etc. associated w/ each point
820
821 unsigned int DepthLimiter;
822
823private:
824 vtkHyperTreeGrid(const vtkHyperTreeGrid&) = delete;
825 void operator=(const vtkHyperTreeGrid&) = delete;
826};
827
828#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:37
Fast, simple class for representing and operating on 3D bounds.
represent and manipulate cell attribute data
Definition vtkCellData.h:42
create and manipulate ordered lists of objects
represent and manipulate attribute data in a dataset
dynamic, self-adjusting array of double
represent and manipulate fields of data
Objects for traversal a HyperTreeGrid.
Objects for traversal a HyperTreeGrid.
An iterator object to iteratively access trees in the grid.
std::map< vtkIdType, vtkSmartPointer< vtkHyperTree > >::iterator Iterator
vtkHyperTree * GetNextTree()
Get the next tree and set its index then increment the iterator.
vtkHyperTree * GetNextTree(vtkIdType &index)
Get the next tree and set its index then increment the iterator.
void Initialize(vtkHyperTreeGrid *)
Initialize the iterator on the tree set of the given grid.
bool HasMask()
Determine whether blanking mask is empty or not.
int GetExtentType() override
Structured extent.
vtkHyperTreeGridNonOrientedMooreSuperCursorLight * NewNonOrientedMooreSuperCursorLight(vtkIdType index, bool create=false)
vtkFieldData * GetAttributesAsFieldData(int type) override
Returns the hypertree node field data stored as cell data.
vtkHyperTreeGridNonOrientedCursor * NewNonOrientedCursor(vtkIdType index, bool create=false)
vtkIdType GetShiftedLevelZeroIndex(vtkIdType, unsigned int, unsigned int, unsigned int) const
Return the root index of a root cell with given index displaced.
vtkIdType GetNumberOfCells()
Return the number of cells.
const unsigned int * GetCellDims() const
JB Get grid sizes of this structured cells dataset.
virtual vtkHyperTree * GetTree(vtkIdType, bool create=false)
Return tree located at given index of hyper tree grid NB: This will construct a new HyperTree if grid...
vtkBitArray * PureMask
void SetMask(vtkBitArray *)
Set/Get the blanking mask of primal leaf cells.
virtual void CopyCoordinates(const vtkHyperTreeGrid *output)
JB Augented services on Coordinates.
void InitializeNonOrientedVonNeumannSuperCursorLight(vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight *cursor, vtkIdType index, bool create=false)
JB.
virtual void GetLevelZeroOriginFromIndex(vtkIdType, double *)
JB Convert the global index of a root to its Spacial coordinates origin and size.
vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight * NewNonOrientedVonNeumannSuperCursorLight(vtkIdType index, bool create=false)
vtkHyperTreeGridOrientedCursor * NewOrientedCursor(vtkIdType index, bool create=false)
const unsigned int * GetDimensions() const
Get dimensions of this rectilinear grid dataset.
vtkUnsignedCharArray * TreeGhostArray
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
double * GetCenter()
Get the center of the bounding box.
virtual unsigned int FindDichotomicX(double value) const
virtual void Squeeze()
Squeeze this representation.
bool TreeGhostArrayCached
These arrays pointers are caches used to avoid a string comparison (when getting ghost arrays using G...
std::map< vtkIdType, vtkSmartPointer< vtkHyperTree > > HyperTrees
virtual void SetFixedCoordinates(unsigned int axis, double value)
JB Augented services on Coordinates.
virtual void CopyEmptyStructure(vtkDataObject *)
Copy the internal structure with no data associated.
void DeepCopy(vtkDataObject *) override
Create deep copy of hyper tree grid.
void Get1DAxis(unsigned int &axis) const
JB retourne l'indice de la dimension valide.
static vtkHyperTreeGrid * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void GetIndexFromLevelZeroCoordinates(vtkIdType &, unsigned int, unsigned int, unsigned int) const
Convert the Cartesian coordinates of a root in the grid to its global index.
void InitializeOrientedGeometryCursor(vtkHyperTreeGridOrientedGeometryCursor *cursor, vtkIdType index, bool create=false)
JB.
virtual void CopyStructure(vtkDataObject *)
Copy the internal geometric and topological structure of a vtkHyperTreeGrid object.
const unsigned int * GetAxes() const
JB Get the axis information (used for CopyStructure)
unsigned int GetNumberOfLevels(vtkIdType)
Return the number of levels in an individual (primal) tree.
virtual void SetYCoordinates(vtkDataArray *)
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.
virtual void SetXCoordinates(vtkDataArray *)
Set/Get the grid coordinates in the x-direction.
bool RecursivelyInitializePureMask(vtkHyperTreeGridNonOrientedCursor *cursor, vtkDataArray *normale)
Recursively initialize pure material mask.
static vtkInformationIntegerKey * ORIENTATION()
vtkCellData * GetCellData()
Return a pointer to this dataset's hypertree node data.
vtkIdType GetNumberOfElements(int type) override
Returns the number of nodes.
vtkHyperTreeGridNonOrientedGeometryCursor * FindNonOrientedGeometryCursor(double x[3])
JB Retourne un curseur geometrique pointant une des mailles comportant la position spatiale x.
vtkUnsignedCharArray * GetTreeGhostArray()
Gets the array that defines the ghost type of each cell.
void Initialize() override
Restore data object to initial state.
unsigned int GetOrientation() const
Get the orientation of 1D or 2D grids:
static constexpr vtkIdType InvalidIndex
Invalid index that is returned for undefined nodes, for example for nodes that are out of bounds (the...
void SetIndexingModeToKJI()
Get the number or trees available along the 3 axis.
void SetTree(vtkIdType, vtkHyperTree *)
Assign given tree to given index of hyper tree grid NB: This will create a new slot in the grid if ne...
virtual void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double *, double *)
Convert the global index of a root to its Spacial coordinates origin and size.
void InitializeNonOrientedMooreSuperCursorLight(vtkHyperTreeGridNonOrientedMooreSuperCursorLight *cursor, vtkIdType index, bool create=false)
JB.
unsigned int DepthLimiter
void SetDimensions(unsigned int i, unsigned int j, unsigned int k)
Set/Get sizes of this rectilinear grid dataset.
vtkDataArray * ZCoordinates
vtkDataArray * YCoordinates
vtkUnsignedCharArray * AllocateTreeGhostArray()
Allocate ghost array for points.
vtkIdType GetNumberOfNonEmptyTrees()
Get the number of non empty trees in this grid.
virtual unsigned long GetActualMemorySizeBytes()
Return the actual size of the data in bytes.
vtkHyperTreeGridOrientedGeometryCursor * NewOrientedGeometryCursor(vtkIdType index, bool create=false)
char * ModeSqueeze
JB ModeSqueeze.
void Get2DAxes(unsigned int &axis1, unsigned int &axis2) const
JB Retourne l'indice des deux dimensions valides.
static vtkHyperTreeGrid * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
vtkHyperTreeGridNonOrientedGeometryCursor * NewNonOrientedGeometryCursor(vtkIdType index, bool create=false)
vtkIdType GetGlobalNodeIndexMax()
JB Retourne la valeur maximale du global index.
void InitializeOrientedCursor(vtkHyperTreeGridOrientedCursor *cursor, vtkIdType index, bool create=false)
JB.
void InitializeLocalIndexNode()
JB Permet d'initialiser les index locaux de chacun des HT de cet HTG une fois que TOUS les HTs aient ...
unsigned long GetActualMemorySize() override
Return the actual size of the data in kibibytes (1024 bytes).
void InitializeNonOrientedMooreSuperCursor(vtkHyperTreeGridNonOrientedMooreSuperCursor *cursor, vtkIdType index, bool create=false)
JB.
void InitializeTreeIterator(vtkHyperTreeGridIterator &)
Initialize an iterator to browse level 0 trees.
unsigned int Dimension
void SetDimensions(const unsigned int dims[3])
Set/Get sizes of this rectilinear grid dataset.
static vtkInformationIntegerKey * DIMENSION()
static vtkInformationIntegerKey * LEVELS()
void SetExtent(const int extent[6])
Different ways to set the extent of the data array.
void SetDimensions(int i, int j, int k)
Set/Get sizes of this rectilinear grid dataset.
unsigned int GetChildMask(unsigned int)
Return hard-coded bitcode correspondng to child mask Dimension 1: Factor 2: 0: 100,...
vtkUnsignedCharArray * GetGhostCells()
Gets the array that defines the ghost type of each cell.
virtual void SetZCoordinates(vtkDataArray *)
Set/Get the grid coordinates in the z-direction.
vtkHyperTreeGridNonOrientedVonNeumannSuperCursor * NewNonOrientedVonNeumannSuperCursor(vtkIdType index, bool create=false)
void SetIndexingModeToIJK()
Get the number or trees available along the 3 axis.
static vtkHyperTreeGrid * New()
vtkBitArray * GetPureMask()
Get or create pure material mask.
vtkIdType GetMaxNumberOfTrees()
Return the maximum number of trees in the level 0 grid.
bool HasAnyGhostCells() const
Returns true if a ghost cell array is defined.
void SetBranchFactor(unsigned int)
Set/Get the subdivision factor in the grid refinement scheme.
vtkIdType GetNumberOfLeaves()
Get the number of leaves in the primal tree grid.
void ShallowCopy(vtkDataObject *) override
Create shallow copy of hyper tree grid.
virtual unsigned int FindDichotomicZ(double value) const
virtual unsigned int FindDichotomicY(double value) const
virtual double * GetBounds()
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
static vtkInformationDoubleVectorKey * SIZES()
vtkHyperTreeGrid()
Constructor with default bounds (0,1, 0,1, 0,1).
unsigned int GetBranchFactor() const
Set/Get the subdivision factor in the grid refinement scheme.
vtkNew< vtkCellData > CellData
vtkHyperTreeGridNonOrientedMooreSuperCursor * NewNonOrientedMooreSuperCursor(vtkIdType index, bool create=false)
void InitializeNonOrientedGeometryCursor(vtkHyperTreeGridNonOrientedGeometryCursor *cursor, vtkIdType index, bool create=false)
JB.
void InitializeNonOrientedCursor(vtkHyperTreeGridNonOrientedCursor *cursor, vtkIdType index, bool create=false)
JB.
unsigned int GetDimension() const
JB Get the dimensionality of the grid deduite a partir de Dimensions/Extent.
unsigned int GetNumberOfChildren() const
The number of children each node can have.
void InitializeNonOrientedVonNeumannSuperCursor(vtkHyperTreeGridNonOrientedVonNeumannSuperCursor *cursor, vtkIdType index, bool create=false)
JB.
void GetLevelZeroCoordinatesFromIndex(vtkIdType, unsigned int &, unsigned int &, unsigned int &) const
Convert the global index of a root to its Cartesian coordinates in the grid.
int GetDataObjectType() override
Return what type of dataset this is.
virtual void SetTransposedRootIndexing(bool)
Get the number or trees available along the 3 axis.
unsigned int NumberOfChildren
unsigned int BranchFactor
vtkDataArray * XCoordinates
vtkIdType GetNumberOfVertices()
Get the number of vertices in the primal tree grid.
void SetDimensions(const int dims[3])
Set/Get sizes of this rectilinear grid dataset.
A data object structured as a tree.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:40
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
cell represents a 1D line
Definition vtkLine.h:34
Allocate and hold a VTK object.
Definition vtkNew.h:62
a cell that represents an orthogonal quadrilateral
Definition vtkPixel.h:38
represent and manipulate 3D points
Definition vtkPoints.h:40
Hold a reference to a vtkObjectBase instance.
dynamic, self-adjusting array of unsigned char
#define vtkDataArray
#define VTK_3D_EXTENT
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition vtkType.h:332
#define VTK_HYPER_TREE_GRID
Definition vtkType.h:109
#define VTK_SIZEHINT(...)