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=========================================================================*/
59#ifndef vtkHyperTreeGrid_h
60#define vtkHyperTreeGrid_h
61
62#include "vtkCommonDataModelModule.h" // For export macro
63#include "vtkDataObject.h"
64
65#include "vtkDeprecation.h" // for deprecation macro
66#include "vtkNew.h" // vtkSmartPointer
67#include "vtkSmartPointer.h" // vtkSmartPointer
68
69#include <cassert> // std::assert
70#include <map> // std::map
71#include <memory> // std::shared_ptr
72
73class vtkBitArray;
74class vtkBoundingBox;
75class vtkCellLinks;
76class vtkCollection;
77class vtkDataArray;
78class vtkHyperTree;
87class vtkDoubleArray;
89class vtkIdTypeArray;
90class vtkLine;
91class vtkPixel;
92class vtkPoints;
93class vtkCellData;
95
96class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGrid : public vtkDataObject
97{
98public:
104
106 void PrintSelf(ostream& os, vtkIndent indent) override;
107
112 static constexpr vtkIdType InvalidIndex = ~0;
113
117 vtkSetStringMacro(ModeSqueeze); // By copy
118 vtkGetStringMacro(ModeSqueeze);
119
123 virtual void Squeeze();
124
128 int GetDataObjectType() override { return VTK_HYPER_TREE_GRID; }
129
135
140
141 // --------------------------------------------------------------------------
142 // RectilinearGrid common API
143 // --------------------------------------------------------------------------
144
146
149 void SetDimensions(const unsigned int dims[3]);
150 void SetDimensions(const int dims[3]);
151 void SetDimensions(unsigned int i, unsigned int j, unsigned int k);
152 void SetDimensions(int i, int j, int k);
154
156
160 const unsigned int* GetDimensions() const VTK_SIZEHINT(3);
161 // JB Dommage, car vtkGetVectorMacro(Dimensions,int,3); not const function
162 void GetDimensions(int dim[3]) const;
163 void GetDimensions(unsigned int dim[3]) const;
165
167
173 void SetExtent(const int extent[6]);
174 void SetExtent(int x1, int x2, int y1, int y2, int z1, int z2);
175 vtkGetVector6Macro(Extent, int);
177
179
184 const unsigned int* GetCellDims() const VTK_SIZEHINT(3);
185 void GetCellDims(int cellDims[3]) const;
186 void GetCellDims(unsigned int cellDims[3]) const;
188
189 // --------------------------------------------------------------------------
190
192
196 unsigned int GetDimension() const { return this->Dimension; }
198
200
203 void Get1DAxis(unsigned int& axis) const
204 {
205 assert("pre: valid_dim" && this->GetDimension() == 1);
206 axis = this->Axis[0];
207 }
209
211
214 void Get2DAxes(unsigned int& axis1, unsigned int& axis2) const
215 {
216 assert("pre: valid_dim" && this->GetDimension() == 2);
217 axis1 = this->Axis[0];
218 axis2 = this->Axis[1];
219 }
221
223
226 const unsigned int* GetAxes() const { return this->Axis; }
228
230
233 // vtkGetMacro(NumberOfChildren, unsigned int); not const
234 unsigned int GetNumberOfChildren() const { return this->NumberOfChildren; }
236
246 // JB ?? virtual void GetNumberOfTreesPerDimension(unsigned int dimsOut[3]);
247
249
253 vtkSetMacro(TransposedRootIndexing, bool);
254 vtkGetMacro(TransposedRootIndexing, bool);
255 void SetIndexingModeToKJI() { this->SetTransposedRootIndexing(false); }
256 void SetIndexingModeToIJK() { this->SetTransposedRootIndexing(true); }
258
260
266 unsigned int GetOrientation() const { return this->Orientation; }
268
270
273 vtkGetMacro(FreezeState, bool);
275
277
280 void SetBranchFactor(unsigned int);
281 unsigned int GetBranchFactor() const { return this->BranchFactor; }
283
288
292 VTK_DEPRECATED_IN_9_2_0("Please use the renamed version, GetNumberOfCells().")
293 vtkIdType GetNumberOfVertices();
294
298 vtkIdType GetNumberOfNonEmptyTrees();
299
303 vtkIdType GetNumberOfLeaves();
304
308 unsigned int GetNumberOfLevels(vtkIdType);
309
313 unsigned int GetNumberOfLevels();
314
316
319 virtual void SetXCoordinates(vtkDataArray*);
320 vtkGetObjectMacro(XCoordinates, vtkDataArray);
322
324
327 virtual void SetYCoordinates(vtkDataArray*);
328 vtkGetObjectMacro(YCoordinates, vtkDataArray);
330
332
335 virtual void SetZCoordinates(vtkDataArray*);
336 vtkGetObjectMacro(ZCoordinates, vtkDataArray);
338
340
343 virtual void CopyCoordinates(const vtkHyperTreeGrid* output);
344 virtual void SetFixedCoordinates(unsigned int axis, double value);
346
348
351 void SetMask(vtkBitArray*);
352 vtkGetObjectMacro(Mask, vtkBitArray);
354
358 bool HasMask();
359
361
364 vtkSetMacro(HasInterface, bool);
365 vtkGetMacro(HasInterface, bool);
366 vtkBooleanMacro(HasInterface, bool);
368
370
373 vtkSetStringMacro(InterfaceNormalsName);
374 vtkGetStringMacro(InterfaceNormalsName);
376
378
381 vtkSetStringMacro(InterfaceInterceptsName);
382 vtkGetStringMacro(InterfaceInterceptsName);
384
386
389 vtkSetMacro(DepthLimiter, unsigned int);
390 vtkGetMacro(DepthLimiter, unsigned int);
392
396 void InitializeOrientedCursor(
397 vtkHyperTreeGridOrientedCursor* cursor, vtkIdType index, bool create = false);
398 vtkHyperTreeGridOrientedCursor* NewOrientedCursor(vtkIdType index, bool create = false);
399
403 void InitializeOrientedGeometryCursor(
404 vtkHyperTreeGridOrientedGeometryCursor* cursor, vtkIdType index, bool create = false);
405 vtkHyperTreeGridOrientedGeometryCursor* NewOrientedGeometryCursor(
406 vtkIdType index, bool create = false);
407
411 void InitializeNonOrientedCursor(
412 vtkHyperTreeGridNonOrientedCursor* cursor, vtkIdType index, bool create = false);
413 vtkHyperTreeGridNonOrientedCursor* NewNonOrientedCursor(vtkIdType index, bool create = false);
414
418 void InitializeNonOrientedGeometryCursor(
419 vtkHyperTreeGridNonOrientedGeometryCursor* cursor, vtkIdType index, bool create = false);
420 vtkHyperTreeGridNonOrientedGeometryCursor* NewNonOrientedGeometryCursor(
421 vtkIdType index, bool create = false);
422
426 vtkHyperTreeGridNonOrientedGeometryCursor* FindNonOrientedGeometryCursor(double x[3]);
427
428private:
429 unsigned int RecurseDichotomic(
430 double value, vtkDoubleArray* coord, unsigned int ideb, unsigned int ifin) const;
431
432 unsigned int FindDichotomic(double value, vtkDataArray* coord) const;
433
434public:
435 virtual unsigned int FindDichotomicX(double value) const;
436 virtual unsigned int FindDichotomicY(double value) const;
437 virtual unsigned int FindDichotomicZ(double value) const;
438
442 void InitializeNonOrientedVonNeumannSuperCursor(
443 vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* cursor, vtkIdType index, bool create = false);
444 vtkHyperTreeGridNonOrientedVonNeumannSuperCursor* NewNonOrientedVonNeumannSuperCursor(
445 vtkIdType index, bool create = false);
446
450 void InitializeNonOrientedVonNeumannSuperCursorLight(
452 bool create = false);
453 vtkHyperTreeGridNonOrientedVonNeumannSuperCursorLight* NewNonOrientedVonNeumannSuperCursorLight(
454 vtkIdType index, bool create = false);
455
459 void InitializeNonOrientedMooreSuperCursor(
460 vtkHyperTreeGridNonOrientedMooreSuperCursor* cursor, vtkIdType index, bool create = false);
461 vtkHyperTreeGridNonOrientedMooreSuperCursor* NewNonOrientedMooreSuperCursor(
462 vtkIdType index, bool create = false);
463
467 void InitializeNonOrientedMooreSuperCursorLight(
468 vtkHyperTreeGridNonOrientedMooreSuperCursorLight* cursor, vtkIdType index, bool create = false);
469 vtkHyperTreeGridNonOrientedMooreSuperCursorLight* NewNonOrientedMooreSuperCursorLight(
470 vtkIdType index, bool create = false);
471
475 void Initialize() override;
476
481 virtual vtkHyperTree* GetTree(vtkIdType, bool create = false);
482
487 void SetTree(vtkIdType, vtkHyperTree*);
488
492 void ShallowCopy(vtkDataObject*) override;
493
497 void DeepCopy(vtkDataObject*) override;
498
502 int GetExtentType() override { return VTK_3D_EXTENT; }
503
512 virtual unsigned long GetActualMemorySizeBytes();
513
522 unsigned long GetActualMemorySize() override;
523
529
534
585 unsigned int GetChildMask(unsigned int);
586
590 void GetIndexFromLevelZeroCoordinates(vtkIdType&, unsigned int, unsigned int, unsigned int) const;
591
597 vtkIdType GetShiftedLevelZeroIndex(vtkIdType, unsigned int, unsigned int, unsigned int) const;
598
603 vtkIdType, unsigned int&, unsigned int&, unsigned int&) const;
604
608 virtual void GetLevelZeroOriginAndSizeFromIndex(vtkIdType, double*, double*);
609
614
624
631
635 bool HasAnyGhostCells() const;
636
642
649
654
658 class VTKCOMMONDATAMODEL_EXPORT vtkHyperTreeGridIterator
659 {
660 public:
662
667
673
679
680 protected:
681 std::map<vtkIdType, vtkSmartPointer<vtkHyperTree>>::iterator Iterator;
683 };
684
690
692
698
704 virtual double* GetBounds() VTK_SIZEHINT(6);
705
711 void GetBounds(double bounds[6]);
712
717 double* GetCenter() VTK_SIZEHINT(3);
718
723 void GetCenter(double center[3]);
724
729 vtkCellData* GetCellData();
730
736 vtkFieldData* GetAttributesAsFieldData(int type) override;
737
743 vtkIdType GetNumberOfElements(int type) override;
744
749 vtkIdType GetNumberOfCells();
750
751protected:
756
760 ~vtkHyperTreeGrid() override;
761
765 char* ModeSqueeze;
766
767 double Bounds[6]; // (xmin,xmax, ymin,ymax, zmin,zmax) geometric bounds
768 double Center[3]; // geometric center
769
770 bool FreezeState;
771 unsigned int BranchFactor; // 2 or 3
772 unsigned int Dimension; // 1, 2, or 3
773
775
779 vtkUnsignedCharArray* TreeGhostArray;
780 bool TreeGhostArrayCached;
782private:
783 unsigned int Orientation; // 0, 1, or 2
784 unsigned int Axis[2];
785
786protected:
787 unsigned int NumberOfChildren;
788 bool TransposedRootIndexing;
789
790 // --------------------------------
791 // RectilinearGrid common fields
792 // --------------------------------
793private:
794 unsigned int Dimensions[3]; // Just for GetDimensions
795 unsigned int CellDims[3]; // Just for GetCellDims
796protected:
797 int DataDescription;
798 int Extent[6];
799
800 bool WithCoordinates;
801 vtkDataArray* XCoordinates;
802 vtkDataArray* YCoordinates;
803 vtkDataArray* ZCoordinates;
804 // --------------------------------
805
807 vtkBitArray* PureMask;
808 bool InitPureMask;
809
810 bool HasInterface;
811 char* InterfaceNormalsName;
812 char* InterfaceInterceptsName;
813
814 std::map<vtkIdType, vtkSmartPointer<vtkHyperTree>> HyperTrees;
815
816 vtkNew<vtkCellData> CellData; // Scalars, vectors, etc. associated w/ each point
817
818 unsigned int DepthLimiter;
819
820private:
821 vtkHyperTreeGrid(const vtkHyperTreeGrid&) = delete;
822 void operator=(const vtkHyperTreeGrid&) = delete;
823};
824
825#endif
dynamic, self-adjusting array of bits
Definition vtkBitArray.h:34
Fast, simple class for representing and operating on 3D bounds.
represent and manipulate cell attribute data
Definition vtkCellData.h:36
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:34
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:31
Allocate and hold a VTK object.
Definition vtkNew.h:56
a cell that represents an orthogonal quadrilateral
Definition vtkPixel.h:35
represent and manipulate 3D points
Definition vtkPoints.h:34
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:332
#define VTK_HYPER_TREE_GRID
Definition vtkType.h:109
#define VTK_SIZEHINT(...)