VTK  9.5.20250906
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
34#ifndef vtkUniformGridAMR_h
35#define vtkUniformGridAMR_h
36
37#include "vtkCommonDataModelModule.h" // For export macro
38#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
39#include "vtkNew.h" // for vtkNew
41#include "vtkSmartPointer.h" // for vtkSmartPointer
42
43VTK_ABI_NAMESPACE_BEGIN
44class vtkAMRDataInternals; // VTK_DEPRECATED_IN_9_6_0
45class vtkAMRMetaData;
47class vtkOverlappingAMRMetaData; // VTK_DEPRECATED_IN_9_6_0
48class vtkUniformGrid;
49
50class VTKCOMMONDATAMODEL_EXPORT vtkUniformGridAMR : public vtkPartitionedDataSetCollection
51{
52public:
55 void PrintSelf(ostream& os, vtkIndent indent) override;
56
61
65 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_UNIFORM_GRID_AMR; }
66
70 void Initialize() override;
71
75 virtual void Initialize(const std::vector<unsigned int>& blocksPerLevel);
76
80 virtual void Initialize(vtkAMRMetaData* metadata);
81
85 VTK_DEPRECATED_IN_9_6_0("Use Initialize(const std::vector<unsigned int>&) instead")
86 virtual void Initialize(int numLevels, const int* blocksPerLevel);
87
89
93 void SetGridDescription(int gridDescription);
94 int GetGridDescription();
96
101 [[nodiscard]] unsigned int GetNumberOfLevels() const;
102
108 [[nodiscard]] unsigned int GetNumberOfBlocks() const;
109
113 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks instead")
114 virtual unsigned int GetTotalNumberOfBlocks() { return this->GetNumberOfBlocks(); }
115
120 [[nodiscard]] unsigned int GetNumberOfBlocks(unsigned int level) const;
121
125 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks(level) instead")
126 unsigned int GetNumberOfDataSets(unsigned int level) { return this->GetNumberOfBlocks(level); }
127
129
132 void GetBounds(double bounds[6]);
133 virtual const double* GetBounds();
134 void GetMin(double min[3]);
135 void GetMax(double max[3]);
137
138 using Superclass::SetDataSet;
143 virtual void SetDataSet(unsigned int level, unsigned int idx, vtkUniformGrid* grid);
144
145 using Superclass::GetDataSet;
149 vtkUniformGrid* GetDataSet(unsigned int level, unsigned int idx);
150
156 [[nodiscard]] int GetAbsoluteBlockIndex(unsigned int level, unsigned int index) const;
157
162 VTK_DEPRECATED_IN_9_6_0("This function is deprecated, use GetAbsoluteBlockIndex() instead")
163 int GetCompositeIndex(unsigned int level, unsigned int index)
164 {
165 return this->GetAbsoluteBlockIndex(level, index);
166 }
167
172 void ComputeIndexPair(unsigned int index, unsigned int& level, unsigned int& id);
173
179 VTK_DEPRECATED_IN_9_6_0("This function is deprecated, use ComputeIndexPair() instead")
180 void GetLevelAndIndex(unsigned int compositeIdx, unsigned int& level, unsigned int& idx)
181 {
182 this->ComputeIndexPair(compositeIdx, level, idx);
183 }
184
186
190 void ShallowCopy(vtkDataObject* src) override;
192
196 void DeepCopy(vtkDataObject* src) override;
197
202
204
210
212
218
219protected:
222
226 virtual void InstantiateMetaData();
227
229
233 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be used, returns nullptr")
234 virtual vtkAMRDataInternals* GetAMRData() { return nullptr; }
235 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and has no effect")
236 virtual void SetAMRData(vtkAMRDataInternals*){};
238
240
244 "This function is deprecated and should not be inherited, use GetAMRMetaData() instead")
245 virtual vtkOverlappingAMRMetaData* GetAMRInfo() { return nullptr; };
246 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be inherited, use "
247 "SetAMRMetaData() or Initialize(vtkAMRMetaData*) instead")
248 virtual void SetAMRInfo(vtkOverlappingAMRMetaData*){};
250
251private:
252 vtkUniformGridAMR(const vtkUniformGridAMR&) = delete;
253 void operator=(const vtkUniformGridAMR&) = delete;
254
255 void InitializeInternal();
256
257 double Bounds[6] = {
264 };
266};
267
268VTK_ABI_NAMESPACE_END
269#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.
Meta data that describes the structure of an overlapping AMR data set.
Composite dataset that groups datasets as a collection.
Hold a reference to a vtkObjectBase instance.
a multi-resolution dataset based on vtkUniformGrid
void GetMin(double min[3])
Get the (min/max) bounds of the AMR domain.
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 plus this AMR current level Returns 0 if AMRMetaData is in...
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 for given level plus this AMR current level and a relative block ind...
virtual void Initialize(const std::vector< unsigned int > &blocksPerLevel)
Initialize the AMRMetaData and the AMR with the specified blocksPerLevel.
virtual const double * GetBounds()
Get the (min/max) bounds of the AMR domain.
virtual void Initialize(vtkAMRMetaData *metadata)
Initialize AMR using the provided metadata by reconstructing the blocksPerLevel.
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 vtkUniformGridAMRIterator (the iterator has to be deleted by the user).
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).
Deprecated vtkImageData.
#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)