VTK  9.1.0
vtkUniformGridAMR.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkHierarchicalBoxDataSet.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 =========================================================================*/
15 //
16 // .SECTION Description
17 // vtkUniformGridAMR is a concrete implementation of
18 // vtkCompositeDataSet. The dataset type is restricted to
19 // vtkUniformGrid.
20 
21 #ifndef vtkUniformGridAMR_h
22 #define vtkUniformGridAMR_h
23 
24 #include "vtkCommonDataModelModule.h" // For export macro
25 #include "vtkCompositeDataSet.h"
26 
28 class vtkUniformGrid;
29 class vtkAMRInformation;
31 
32 class VTKCOMMONDATAMODEL_EXPORT vtkUniformGridAMR : public vtkCompositeDataSet
33 {
34 public:
37 
38  // Description:
39  // Return a new iterator (the iterator has to be deleted by the user).
41 
42  // Description:
43  // Return class name of data type (see vtkType.h for definitions).
44  int GetDataObjectType() override { return VTK_UNIFORM_GRID_AMR; }
45 
46  // Description: // Print internal states
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
49  // Description:
50  // Restore data object to initial
51  void Initialize() override;
52 
53  // Description:
54  // Initialize the AMR.
55  virtual void Initialize(int numLevels, const int* blocksPerLevel);
56 
57  // Description:
58  // Set/Get the data description of this uniform grid instance,
59  // e.g. VTK_XYZ_GRID
60  void SetGridDescription(int gridDescription);
62 
63  // Description:
64  // Return the number of levels
65  unsigned int GetNumberOfLevels();
66 
67  // Description:
68  // Return the total number of blocks, including nullptr blocks
69  virtual unsigned int GetTotalNumberOfBlocks();
70 
71  // Description:
72  // Returns the number of datasets at the given level, including null blocks
73  unsigned int GetNumberOfDataSets(const unsigned int level);
74 
75  // Description:
76  // Retrieve the bounds of the AMR domain
77  void GetBounds(double bounds[6]);
78  const double* GetBounds();
79  void GetMin(double min[3]);
80  void GetMax(double max[3]);
81 
82  // Description:
83  // Unhiding superclass method.
84  void SetDataSet(vtkCompositeDataIterator* iter, vtkDataObject* dataObj) override;
85 
86  // Description:
87  // At the passed in level, set grid as the idx'th block at that level.
88  // idx must be less than the number of data sets at that level.
89  virtual void SetDataSet(unsigned int level, unsigned int idx, vtkUniformGrid* grid);
90 
91  // Description:
92  // Return the data set pointed to by iter
94 
95  // Description:
96  // Get the data set using the index pair
97  vtkUniformGrid* GetDataSet(unsigned int level, unsigned int idx);
98 
99  // Description:
100  // Retrieves the composite index associated with the data at the given
101  // (level,index) pair.
102  int GetCompositeIndex(const unsigned int level, const unsigned int index);
103 
104  // Description:
105  // Given the compositeIdx (as set by SetCompositeIdx) this method returns the
106  // corresponding level and dataset index within the level.
107  void GetLevelAndIndex(const unsigned int compositeIdx, unsigned int& level, unsigned int& idx);
108 
109  // Description:
110  // Override ShallowCopy/DeepCopy and CopyStructure
111  void ShallowCopy(vtkDataObject* src) override;
112  void DeepCopy(vtkDataObject* src) override;
113  void CopyStructure(vtkCompositeDataSet* src) override;
114  void RecursiveShallowCopy(vtkDataObject* src) override;
115 
116  // Retrieve an instance of this class from an information object.
119 
120 protected:
122  ~vtkUniformGridAMR() override;
123 
124  // Description:
125  // Get/Set the meta AMR meta data
126  vtkGetObjectMacro(AMRData, vtkAMRDataInternals);
127 
130  double Bounds[6];
131 
132  // Description:
133  // Get/Set the meta AMR meta data
134  vtkGetObjectMacro(AMRInfo, vtkAMRInformation);
136 
137 private:
138  vtkUniformGridAMR(const vtkUniformGridAMR&) = delete;
139  void operator=(const vtkUniformGridAMR&) = delete;
140 
142 };
143 
144 #endif
container of vtkUniformGrid for an AMR data set
Meta data that describes the structure of an AMR data set.
superclass for composite data iterators
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
Definition: vtkDataObject.h:60
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
subclass of vtkCompositeDataIterator with API to get current level and dataset index.
void GetMin(double min[3])
void GetLevelAndIndex(const unsigned int compositeIdx, unsigned int &level, unsigned int &idx)
vtkUniformGrid * GetDataSet(unsigned int level, unsigned int idx)
virtual void SetDataSet(unsigned int level, unsigned int idx, vtkUniformGrid *grid)
vtkAMRDataInternals * AMRData
void ShallowCopy(vtkDataObject *src) override
Shallow and Deep copy.
static vtkUniformGridAMR * GetData(vtkInformationVector *v, int i=0)
vtkDataObject * GetDataSet(vtkCompositeDataIterator *iter) override
Returns the dataset located at the positiong pointed by the iterator.
unsigned int GetNumberOfDataSets(const unsigned int level)
static vtkUniformGridAMR * GetData(vtkInformation *info)
virtual void Initialize(int numLevels, const int *blocksPerLevel)
unsigned int GetNumberOfLevels()
void GetMax(double max[3])
vtkCompositeDataIterator * NewIterator() override
Return a new iterator (the iterator has to be deleted by user).
void DeepCopy(vtkDataObject *src) override
Shallow and Deep copy.
int GetDataObjectType() override
Return class name of data type (see vtkType.h for definitions).
void Initialize() override
Restore data object to initial state,.
const double * GetBounds()
void SetDataSet(vtkCompositeDataIterator *iter, vtkDataObject *dataObj) override
Sets the data set at the location pointed by the iterator.
static vtkUniformGridAMR * New()
void GetBounds(double bounds[6])
void CopyStructure(vtkCompositeDataSet *src) override
Copies the tree structure from the input.
void RecursiveShallowCopy(vtkDataObject *src) override
For historical reasons, vtkCompositeDataSet::ShallowCopy simply pass pointers to the leaf non-composi...
virtual void SetAMRInfo(vtkAMRInformation *)
~vtkUniformGridAMR() override
int GetCompositeIndex(const unsigned int level, const unsigned int index)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAMRInformation * AMRInfo
void SetGridDescription(int gridDescription)
virtual unsigned int GetTotalNumberOfBlocks()
image data with blanking
@ info
Definition: vtkX3D.h:382
@ level
Definition: vtkX3D.h:401
@ index
Definition: vtkX3D.h:252
#define VTK_UNIFORM_GRID_AMR
Definition: vtkType.h:106
#define VTK_NEWINSTANCE
#define max(a, b)