VTK  9.5.20250718
vtkUniformGridAMR.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
16#ifndef vtkUniformGridAMR_h
17#define vtkUniformGridAMR_h
18
19#include "vtkCommonDataModelModule.h" // For export macro
20#include "vtkCompositeDataSet.h"
21#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
22#include "vtkNew.h" // for vtkNew
23#include "vtkSmartPointer.h" // for vtkSmartPointer
24
25VTK_ABI_NAMESPACE_BEGIN
27class vtkUniformGrid;
28class vtkAMRMetaData;
29class vtkOverlappingAMRMetaData; // VTK_DEPRECATED_IN_9_6_0
31
32class VTKCOMMONDATAMODEL_EXPORT vtkUniformGridAMR : public vtkCompositeDataSet
33{
34public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
43
47 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_UNIFORM_GRID_AMR; }
48
52 void Initialize() override;
53
57 virtual void Initialize(const std::vector<unsigned int>& blocksPerLevel);
58
62 VTK_DEPRECATED_IN_9_6_0("Use Initialize(const std::vector<unsigned int>&) instead")
63 virtual void Initialize(int numLevels, const int* blocksPerLevel);
64
66
70 void SetGridDescription(int gridDescription);
71 int GetGridDescription();
73
77 [[nodiscard]] unsigned int GetNumberOfLevels() const;
78
83 [[nodiscard]] unsigned int GetNumberOfBlocks() const;
84
88 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks instead")
89 virtual unsigned int GetTotalNumberOfBlocks() { return this->GetNumberOfBlocks(); }
90
95 [[nodiscard]] unsigned int GetNumberOfBlocks(unsigned int level) const;
96
100 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks(level) instead")
101 unsigned int GetNumberOfDataSets(unsigned int level) { return this->GetNumberOfBlocks(level); }
102
104
107 void GetBounds(double bounds[6]);
108 virtual const double* GetBounds();
109 void GetMin(double min[3]);
110 void GetMax(double max[3]);
112
116 void SetDataSet(vtkCompositeDataIterator* iter, vtkDataObject* dataObj) override;
117
122 virtual void SetDataSet(unsigned int level, unsigned int idx, vtkUniformGrid* grid);
123
124 // Needed because, otherwise vtkCompositeData::GetDataSet(unsigned int flatIndex) is hidden.
125 using Superclass::GetDataSet;
126
131
135 vtkUniformGrid* GetDataSet(unsigned int level, unsigned int idx);
136
142 [[nodiscard]] int GetAbsoluteBlockIndex(unsigned int level, unsigned int index) const;
143
150 VTK_DEPRECATED_IN_9_6_0("This function is deprecated, use GetAbsoluteBlockIndex() instead")
151 int GetCompositeIndex(unsigned int level, unsigned int index)
152 {
153 return this->GetAbsoluteBlockIndex(level, index);
154 }
155
160 void ComputeIndexPair(unsigned int index, unsigned int& level, unsigned int& id);
161
167 VTK_DEPRECATED_IN_9_6_0("This function is deprecated, use ComputeIndexPair() instead")
168 void GetLevelAndIndex(unsigned int compositeIdx, unsigned int& level, unsigned int& idx)
169 {
170 this->ComputeIndexPair(compositeIdx, level, idx);
171 }
172
174
178 void ShallowCopy(vtkDataObject* src) override;
180
184 void DeepCopy(vtkDataObject* src) override;
185
190
192
198
200
206
207protected:
210
214 virtual void InstantiateMetaData();
215
217
221 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be used")
222 virtual vtkAMRDataInternals* GetAMRData() { return this->AMRData; }
223 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and has no effect")
224 virtual void SetAMRData(vtkAMRDataInternals*){};
226
228
232 "This function is deprecated and should not be inherited, use GetAMRMetaData() instead")
233 virtual vtkOverlappingAMRMetaData* GetAMRInfo() { return nullptr; };
235 "This function is deprecated and should not be inherited, use SetAMRMetaData() instead")
236 virtual void SetAMRInfo(vtkOverlappingAMRMetaData*){};
238
239private:
240 vtkUniformGridAMR(const vtkUniformGridAMR&) = delete;
241 void operator=(const vtkUniformGridAMR&) = delete;
242
244
245 double Bounds[6] = {
252 };
255};
256
257VTK_ABI_NAMESPACE_END
258#endif
container of vtkUniformGrid for an AMR data set
Meta data that describes the structure of a generic AMR data set.
superclass for composite data iterators
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Allocate and hold a VTK object.
Definition vtkNew.h:167
Meta data that describes the structure of an overlapping AMR data set.
Hold a reference to a vtkObjectBase instance.
subclass of vtkCompositeDataIterator with API to get current level and dataset index.
a multi-resolution dataset based on vtkUniformGrid
void GetMin(double min[3])
Get the (min/max) bounds of the AMR domain.
vtkDataObject * GetDataSet(vtkCompositeDataIterator *iter) override
Get the data set pointed to by iter.
virtual void SetDataSet(unsigned int level, unsigned int idx, vtkUniformGrid *grid)
At the passed in level, set grid as the idx'th block at that level.
unsigned int GetNumberOfBlocks(unsigned int level) const
Get the number of block at the given level, including nullptr blocks, or 0 if AMRMetaData is invalid.
static vtkUniformGridAMR * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
void ShallowCopy(vtkDataObject *src) override
ShallowCopy.
int GetAbsoluteBlockIndex(unsigned int level, unsigned int index) const
Returns the absolute block index from a level and a relative block index or -1 if it doesn't exist.
virtual void Initialize(const std::vector< unsigned int > &blocksPerLevel)
Initialize the AMR with the specified blocksPerLevel.
virtual const double * GetBounds()
Get the (min/max) bounds of the AMR domain.
void ComputeIndexPair(unsigned int index, unsigned int &level, unsigned int &id)
Returns the an index pair (level, relative index) given a absolute block index Forward to the interna...
void GetMax(double max[3])
Get the (min/max) bounds of the AMR domain.
void DeepCopy(vtkDataObject *src) override
DeepCopy.
void Initialize() override
Restore data object to initial state.
void CompositeShallowCopy(vtkCompositeDataSet *src) override
ShallowCopy.
void SetAMRMetaData(vtkAMRMetaData *metadata)
Get/Set the AMR meta data.
vtkAMRMetaData * GetAMRMetaData()
Get/Set the AMR meta data.
vtkCompositeDataIterator * NewIterator() override
Return a new iterator (the iterator has to be deleted by the user).
void SetDataSet(vtkCompositeDataIterator *iter, vtkDataObject *dataObj) override
Overriding superclass method.
vtkUniformGrid * GetDataSet(unsigned int level, unsigned int idx)
Get the data set using the (level, index) pair.
void GetBounds(double bounds[6])
Get the (min/max) bounds of the AMR domain.
static vtkUniformGridAMR * New()
void CopyStructure(vtkCompositeDataSet *src) override
CopyStructure.
static vtkUniformGridAMR * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
~vtkUniformGridAMR() override
virtual void InstantiateMetaData()
Create and set a new vtkAMRMetaData as AMRMetaData.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int GetDataObjectType() VTK_FUTURE_CONST override
Return class name of data type (see vtkType.h for definitions).
image data with blanking
#define VTK_DEPRECATED_IN_9_6_0(reason)
#define VTK_DOUBLE_MIN
Definition vtkType.h:170
#define VTK_DOUBLE_MAX
Definition vtkType.h:171
@ VTK_UNIFORM_GRID_AMR
Definition vtkType.h:109
#define VTK_NEWINSTANCE
#define max(a, b)