VTK  9.3.0
vtkHyperTreeGrid.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
50#ifndef vtkHyperTreeGrid_h
51#define vtkHyperTreeGrid_h
52
53#include "vtkCommonDataModelModule.h" // For export macro
54#include "vtkDataObject.h"
55
56#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
57#include "vtkNew.h" // vtkSmartPointer
58#include "vtkSmartPointer.h" // vtkSmartPointer
59
60#include <cassert> // std::assert
61#include <map> // std::map
62#include <memory> // std::shared_ptr
63
64VTK_ABI_NAMESPACE_BEGIN
65class vtkBitArray;
66class vtkBoundingBox;
67class vtkCellLinks;
68class vtkCollection;
69class vtkDataArray;
70class vtkHyperTree;
81class vtkDoubleArray;
83class vtkIdTypeArray;
84class vtkLine;
85class vtkPixel;
86class vtkPoints;
87class vtkCellData;
89
90class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGrid : public vtkDataObject
91{
92public:
98
100 void PrintSelf(ostream& os, vtkIndent indent) override;
101
106 static constexpr vtkIdType InvalidIndex = ~0;
107
111 vtkSetStringMacro(ModeSqueeze); // By copy
112 vtkGetStringMacro(ModeSqueeze);
113
117 virtual void Squeeze();
118
122 int GetDataObjectType() override { return VTK_HYPER_TREE_GRID; }
123
129
134
135 // --------------------------------------------------------------------------
136 // RectilinearGrid common API
137 // --------------------------------------------------------------------------
138
140
143 void SetDimensions(const unsigned int dims[3]);
144 void SetDimensions(const int dims[3]);
145 void SetDimensions(unsigned int i, unsigned int j, unsigned int k);
146 void SetDimensions(int i, int j, int k);
148
150
154 const unsigned int* GetDimensions() const VTK_SIZEHINT(3);
155 // JB Dommage, car vtkGetVectorMacro(Dimensions,int,3); not const function
156 void GetDimensions(int dim[3]) const;
157 void GetDimensions(unsigned int dim[3]) const;
159
161
167 void SetExtent(const int extent[6]);
168 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
169 vtkGetVector6Macro(Extent, int);
171
173
178 const unsigned int* GetCellDims() const VTK_SIZEHINT(3);
179 void GetCellDims(int cellDims[3]) const;
180 void GetCellDims(unsigned int cellDims[3]) const;
182
183 // --------------------------------------------------------------------------
184
186
190 unsigned int GetDimension() const { return this->Dimension; }
192
194
197 void Get1DAxis(unsigned int& axis) const
198 {
199 assert("pre: valid_dim" && this->GetDimension() == 1);
200 axis = this->Axis[0];
201 }
203
205
208 void Get2DAxes(unsigned int& axis1, unsigned int& axis2) const
209 {
210 assert("pre: valid_dim" && this->GetDimension() == 2);
211 axis1 = this->Axis[0];
212 axis2 = this->Axis[1];
213 }
215
217
220 const unsigned int* GetAxes() const { return this->Axis; }
222
224
227 // vtkGetMacro(NumberOfChildren, unsigned int); not const
228 unsigned int GetNumberOfChildren() const { return this->NumberOfChildren; }
230
240 // JB ?? virtual void GetNumberOfTreesPerDimension(unsigned int dimsOut[3]);
241
243
247 vtkSetMacro(TransposedRootIndexing, bool);
248 vtkGetMacro(TransposedRootIndexing, bool);
249 void SetIndexingModeToKJI() { this->SetTransposedRootIndexing(false); }
250 void SetIndexingModeToIJK() { this->SetTransposedRootIndexing(true); }
252
254
260 unsigned int GetOrientation() const { return this->Orientation; }
262
264
267 vtkGetMacro(FreezeState, bool);
269
271
274 void SetBranchFactor(unsigned int);
275 unsigned int GetBranchFactor() const { return this->BranchFactor; }
277
282
286 VTK_DEPRECATED_IN_9_2_0("Please use the renamed version, GetNumberOfCells().")
287 vtkIdType GetNumberOfVertices();
288
292 vtkIdType GetNumberOfNonEmptyTrees();
293
297 vtkIdType GetNumberOfLeaves();
298
302 unsigned int GetNumberOfLevels(vtkIdType);
303
307 unsigned int GetNumberOfLevels();
308
310
313 virtual void SetXCoordinates(vtkDataArray*);
314 vtkGetObjectMacro(XCoordinates, vtkDataArray);
316
318
321 virtual void SetYCoordinates(vtkDataArray*);
322 vtkGetObjectMacro(YCoordinates, vtkDataArray);
324
326
329 virtual void SetZCoordinates(vtkDataArray*);
330 vtkGetObjectMacro(ZCoordinates, vtkDataArray);
332
334
337 virtual void CopyCoordinates(const vtkHyperTreeGrid* output);
338 virtual void SetFixedCoordinates(unsigned int axis, double value);
340
342
345 void SetMask(vtkBitArray*);
346 vtkGetObjectMacro(Mask, vtkBitArray);
348
352 bool HasMask();
353
355
358 vtkSetMacro(HasInterface, bool);
359 vtkGetMacro(HasInterface, bool);
360 vtkBooleanMacro(HasInterface, bool);
362
364
367 vtkSetStringMacro(InterfaceNormalsName);
368 vtkGetStringMacro(InterfaceNormalsName);
370
372
375 vtkSetStringMacro(InterfaceInterceptsName);
376 vtkGetStringMacro(InterfaceInterceptsName);
378
380
383 vtkSetMacro(DepthLimiter, unsigned int);
384 vtkGetMacro(DepthLimiter, unsigned int);
386
388
397 void InitializeOrientedCursor(
398 vtkHyperTreeGridOrientedCursor* cursor, vtkIdType index, bool create = false);
400 vtkHyperTreeGridOrientedCursor* NewOrientedCursor(vtkIdType index, bool create = false);
401
402 void InitializeOrientedGeometryCursor(
403 vtkHyperTreeGridOrientedGeometryCursor* cursor, vtkIdType index, bool create = false);
405 vtkHyperTreeGridOrientedGeometryCursor* NewOrientedGeometryCursor(
406 vtkIdType index, bool create = false);
407
408 void InitializeNonOrientedCursor(
409 vtkHyperTreeGridNonOrientedCursor* cursor, vtkIdType index, bool create = false);
411 vtkHyperTreeGridNonOrientedCursor* NewNonOrientedCursor(vtkIdType index, bool create = false);
412
413 void InitializeNonOrientedGeometryCursor(
414 vtkHyperTreeGridNonOrientedGeometryCursor* cursor, vtkIdType index, bool create = false);
416 vtkHyperTreeGridNonOrientedGeometryCursor* NewNonOrientedGeometryCursor(
417 vtkIdType index, bool create = false);
418
419 void InitializeNonOrientedUnlimitedGeometryCursor(
421 bool create = false);
423 vtkHyperTreeGridNonOrientedUnlimitedGeometryCursor* NewNonOrientedUnlimitedGeometryCursor(
424 vtkIdType index, bool create = false);
426
430 vtkHyperTreeGridNonOrientedGeometryCursor* FindNonOrientedGeometryCursor(double x[3]);
431
432private:
433 unsigned int RecurseDichotomic(
434 double value, vtkDoubleArray* coord, double tol, unsigned int ideb, unsigned int ifin) const;
435
436 unsigned int FindDichotomic(double value, vtkDataArray* coord, double tol) const;
437
438public:
439 virtual unsigned int FindDichotomicX(double value, double tol = 0.0) const;
440 virtual unsigned int FindDichotomicY(double value, double tol = 0.0) const;
441 virtual unsigned int FindDichotomicZ(double value, double tol = 0.0) const;
442
444
453 void InitializeNonOrientedVonNeumannSuperCursor(
454 vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* cursor, vtkIdType index, bool create = false);
456 vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* NewNonOrientedVonNeumannSuperCursor(
457 vtkIdType index, bool create = false);
458
459 void InitializeNonOrientedVonNeumannSuperCursorLight(
461 bool create = false);
463 vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight* NewNonOrientedVonNeumannSuperCursorLight(
464 vtkIdType index, bool create = false);
465
466 void InitializeNonOrientedMooreSuperCursor(
467 vtkHyperTreeGridNonOrientedMooreSuperCursor* cursor, vtkIdType index, bool create = false);
469 vtkHyperTreeGridNonOrientedMooreSuperCursor* NewNonOrientedMooreSuperCursor(
470 vtkIdType index, bool create = false);
471
472 void InitializeNonOrientedMooreSuperCursorLight(
473 vtkHyperTreeGridNonOrientedMooreSuperCursorLight* cursor, vtkIdType index, bool create = false);
475 vtkHyperTreeGridNonOrientedMooreSuperCursorLight* NewNonOrientedMooreSuperCursorLight(
476 vtkIdType index, bool create = false);
477
478 void InitializeNonOrientedUnlimitedMooreSuperCursor(
480 bool create = false);
482 vtkHyperTreeGridNonOrientedUnlimitedMooreSuperCursor* NewNonOrientedUnlimitedMooreSuperCursor(
483 vtkIdType index, bool create = false);
485
489 void Initialize() override;
490
495 virtual vtkHyperTree* GetTree(vtkIdType, bool create = false);
496
501 void SetTree(vtkIdType, vtkHyperTree*);
502
506 void ShallowCopy(vtkDataObject*) override;
507
511 void DeepCopy(vtkDataObject*) override;
512
516 int GetExtentType() override { return VTK_3D_EXTENT; }
517
526 virtual unsigned long GetActualMemorySizeBytes();
527
536 unsigned long GetActualMemorySize() override;
537
543
548
599 unsigned int GetChildMask(unsigned int);
600
604 void GetIndexFromLevelZeroCoordinates(vtkIdType&, unsigned int, unsigned int, unsigned int) const;
605
611 vtkIdType GetShiftedLevelZeroIndex(vtkIdType, unsigned int, unsigned int, unsigned int) const;
612
617 vtkIdType, unsigned int&, unsigned int&, unsigned int&) const;
618
622 virtual void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double*, double*);
623
628
638
645
649 bool HasAnyGhostCells() const;
650
656
663
668
672 class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGridIterator
673 {
674 public:
676
681
687
693
694 protected:
695 std::map<vtkIdType, vtkSmartPointer<vtkHyperTree>>::iterator Iterator;
697 };
698
704
706
712
718 virtual double* GetBounds() VTK_SIZEHINT(6);
719
725 void GetBounds(double bounds[6]);
726
731 double* GetCenter() VTK_SIZEHINT(3);
732
737 void GetCenter(double center[3]);
738
743 vtkCellData* GetCellData();
744
750 vtkFieldData* GetAttributesAsFieldData(int type) override;
751
757 vtkIdType GetNumberOfElements(int type) override;
758
763 vtkIdType GetNumberOfCells();
764
765protected:
770
774 ~vtkHyperTreeGrid() override;
775
779 char* ModeSqueeze;
780
781 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
782 double Center[3]; // geometric center
783
784 bool FreezeState;
785 unsigned int BranchFactor; // 2 or 3
786 unsigned int Dimension; // 1, 2, or 3
787
789
793 vtkUnsignedCharArray* TreeGhostArray;
794 bool TreeGhostArrayCached;
796private:
797 unsigned int Orientation; // 0, 1, or 2
798 unsigned int Axis[2];
799
800protected:
801 unsigned int NumberOfChildren;
802 bool TransposedRootIndexing;
803
804 // --------------------------------
805 // RectilinearGrid common fields
806 // --------------------------------
807private:
808 unsigned int Dimensions[3]; // Just for GetDimensions
809 unsigned int CellDims[3]; // Just for GetCellDims
810protected:
811 int DataDescription;
812 int Extent[6];
813
814 bool WithCoordinates;
815 vtkDataArray* XCoordinates;
816 vtkDataArray* YCoordinates;
817 vtkDataArray* ZCoordinates;
818 // --------------------------------
819
821 vtkBitArray* PureMask;
822 bool InitPureMask;
823
824 bool HasInterface;
825 char* InterfaceNormalsName;
826 char* InterfaceInterceptsName;
827
829
830 vtkNew<vtkCellData> CellData; // Scalars, vectors, etc. associated w/ each point
831
832 unsigned int DepthLimiter;
833
834private:
835 vtkHyperTreeGrid(const vtkHyperTreeGrid&) = delete;
836 void operator=(const vtkHyperTreeGrid&) = delete;
837};
838
839VTK_ABI_NAMESPACE_END
840#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:29
Fast, simple class for representing and operating on 3D bounds.
represent and manipulate cell attribute data
Definition vtkCellData.h:31
create and manipulate ordered lists of objects
abstract superclass for arrays of numeric data
general representation of visualization data
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.
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
vtkIdType GetShiftedLevelZeroIndex(vtkIdType, unsigned int, unsigned int, unsigned int) const
Return the root index of a root cell with given index displaced.
virtual void GetLevelZeroOriginFromIndex(vtkIdType, double *)
JB Convert the global index of a root to its Spacial coordinates origin and size.
const unsigned int * GetDimensions() const
Get dimensions of this rectilinear grid dataset.
virtual void Squeeze()
Squeeze this representation.
virtual void CopyEmptyStructure(vtkDataObject *)
Copy the internal structure with no data associated.
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.
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)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool RecursivelyInitializePureMask(vtkHyperTreeGridNonOrientedCursor *cursor, vtkDataArray *normale)
Recursively initialize pure material mask.
static vtkInformationIntegerKey * ORIENTATION()
vtkUnsignedCharArray * GetTreeGhostArray()
Gets the array that defines the ghost type of each cell.
unsigned int GetOrientation() const
Get the orientation of 1D or 2D grids:
void SetIndexingModeToKJI()
Get the number or trees available along the 3 axis.
virtual void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double *, double *)
Convert the global index of a root to its Spacial coordinates origin and size.
void SetDimensions(unsigned int i, unsigned int j, unsigned int k)
Set/Get sizes of this rectilinear grid dataset.
vtkUnsignedCharArray * AllocateTreeGhostArray()
Allocate ghost array for points.
virtual unsigned long GetActualMemorySizeBytes()
Return the actual size of the data in bytes.
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.
vtkIdType GetGlobalNodeIndexMax()
JB Retourne la valeur maximale du global index.
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 InitializeTreeIterator(vtkHyperTreeGridIterator &)
Initialize an iterator to browse level 0 trees.
void SetDimensions(const unsigned int dims[3])
Set/Get sizes of this rectilinear grid dataset.
static vtkInformationIntegerKey * DIMENSION()
static vtkInformationIntegerKey * LEVELS()
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.
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.
virtual double * GetBounds()
Return a pointer to the geometry bounding box in the form (xmin,xmax, ymin,ymax, zmin,...
static vtkInformationDoubleVectorKey * SIZES()
unsigned int GetBranchFactor() const
Set/Get the subdivision factor in the grid refinement scheme.
unsigned int GetNumberOfChildren() const
The number of children each node can have.
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.
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:29
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:23
Allocate and hold a VTK object.
Definition vtkNew.h:51
a cell that represents an orthogonal quadrilateral
Definition vtkPixel.h:27
represent and manipulate 3D points
Definition vtkPoints.h:29
Hold a reference to a vtkObjectBase instance.
dynamic, self-adjusting array of unsigned char
#define VTK_3D_EXTENT
#define VTK_DEPRECATED_IN_9_2_0(reason)
int vtkIdType
Definition vtkType.h:315
#define VTK_HYPER_TREE_GRID
Definition vtkType.h:97
#define VTK_SIZEHINT(...)
#define VTK_NEWINSTANCE