VTK  9.5.20250913
vtkAMRDataObject.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
45#ifndef vtkAMRDataObject_h
46#define vtkAMRDataObject_h
47
48#include "vtkCommonDataModelModule.h" // For export macro
49#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
50#include "vtkNew.h" // for vtkNew
52#include "vtkSmartPointer.h" // for vtkSmartPointer
53
54VTK_ABI_NAMESPACE_BEGIN
55class vtkAMRDataInternals; // VTK_DEPRECATED_IN_9_6_0
56class vtkAMRMetaData;
59class vtkDataSet;
60class vtkImageData;
61class vtkOverlappingAMRMetaData; // VTK_DEPRECATED_IN_9_6_0
63class vtkUniformGrid;
64class VTKCOMMONDATAMODEL_EXPORT vtkAMRDataObject : public vtkPartitionedDataSetCollection
65{
66public:
69 void PrintSelf(ostream& os, vtkIndent indent) override;
70
75
79 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_AMR_DATA_OBJECT; }
80
84 void Initialize() override;
85
89 virtual void Initialize(const std::vector<unsigned int>& blocksPerLevel);
90
94 virtual void Initialize(vtkAMRMetaData* metadata);
95
99 VTK_DEPRECATED_IN_9_6_0("Use Initialize(const std::vector<unsigned int>&) instead")
100 virtual void Initialize(int numLevels, const int* blocksPerLevel);
101
103
107 void SetGridDescription(int gridDescription);
108 int GetGridDescription();
110
115 [[nodiscard]] unsigned int GetNumberOfLevels() const;
116
122 [[nodiscard]] unsigned int GetNumberOfBlocks() const;
123
127 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks instead")
128 virtual unsigned int GetTotalNumberOfBlocks() { return this->GetNumberOfBlocks(); }
129
134 [[nodiscard]] unsigned int GetNumberOfBlocks(unsigned int level) const;
135
139 VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks(level) instead")
140 unsigned int GetNumberOfDataSets(unsigned int level) { return this->GetNumberOfBlocks(level); }
141
143
146 void GetBounds(double bounds[6]);
147 virtual const double* GetBounds();
148 void GetMin(double min[3]);
149 void GetMax(double max[3]);
151
152 using Superclass::SetDataSet;
157 virtual void SetDataSet(unsigned int level, unsigned int idx, vtkDataSet* grid);
158
162 vtkCartesianGrid* GetDataSetAsCartesianGrid(unsigned int level, unsigned int idx);
163
167 vtkImageData* GetDataSetAsImageData(unsigned int level, unsigned int idx);
168
172 vtkRectilinearGrid* GetDataSetAsRectilinearGrid(unsigned int level, unsigned int idx);
173
174 using Superclass::GetDataSet;
179 VTK_DEPRECATED_IN_9_6_0("Use GetDataSetAsImageData or GetDataSetAsCartesianGrid instead")
180 vtkUniformGrid* GetDataSet(unsigned int level, unsigned int idx);
181
187 [[nodiscard]] int GetAbsoluteBlockIndex(unsigned int level, unsigned int index) const;
188
193 VTK_DEPRECATED_IN_9_6_0("This function is deprecated, use GetAbsoluteBlockIndex() instead")
194 int GetCompositeIndex(unsigned int level, unsigned int index)
195 {
196 return this->GetAbsoluteBlockIndex(level, index);
197 }
198
203 void ComputeIndexPair(unsigned int index, unsigned int& level, unsigned int& id);
204
210 VTK_DEPRECATED_IN_9_6_0("This function is deprecated, use ComputeIndexPair() instead")
211 void GetLevelAndIndex(unsigned int compositeIdx, unsigned int& level, unsigned int& idx)
212 {
213 this->ComputeIndexPair(compositeIdx, level, idx);
214 }
215
217
221 void ShallowCopy(vtkDataObject* src) override;
223
227 void DeepCopy(vtkDataObject* src) override;
228
233
235
241
243
249
250protected:
253
257 virtual void InstantiateMetaData();
258
260
264 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be used, returns nullptr")
265 virtual vtkAMRDataInternals* GetAMRData() { return nullptr; }
266 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and has no effect")
267 virtual void SetAMRData(vtkAMRDataInternals*){};
269
271
275 "This function is deprecated and should not be inherited, use GetAMRMetaData() instead")
276 virtual vtkOverlappingAMRMetaData* GetAMRInfo() { return nullptr; };
277 VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be inherited, use "
278 "SetAMRMetaData() or Initialize(vtkAMRMetaData*) instead")
279 virtual void SetAMRInfo(vtkOverlappingAMRMetaData*){};
281
282private:
283 vtkAMRDataObject(const vtkAMRDataObject&) = delete;
284 void operator=(const vtkAMRDataObject&) = delete;
285
286 void InitializeInternal();
287
288 double Bounds[6] = {
295 };
297};
298
299VTK_ABI_NAMESPACE_END
300#endif
container of vtkUniformGrid for an AMR data set
a multi-resolution dataset based on vtkCartesianGrid
void CompositeShallowCopy(vtkCompositeDataSet *src) override
ShallowCopy.
vtkImageData * GetDataSetAsImageData(unsigned int level, unsigned int idx)
Get the data set as an image data using the (level, index) pair.
virtual void SetDataSet(unsigned int level, unsigned int idx, vtkDataSet *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...
virtual const double * GetBounds()
Get the (min/max) bounds of the AMR domain.
vtkAMRMetaData * GetAMRMetaData()
Get/Set the AMR meta data.
static vtkAMRDataObject * GetData(vtkInformationVector *v, int i=0)
Retrieve an instance of this class from an information object.
virtual void InstantiateMetaData()
Create and set a new vtkAMRMetaData as AMRMetaData.
vtkCompositeDataIterator * NewIterator() override
Return a new vtkAMRIterator (the iterator has to be deleted by the user).
void Initialize() override
Restore data object to initial state.
int GetDataObjectType() VTK_FUTURE_CONST override
Return class name of data type (see vtkType.h for definitions).
virtual void Initialize(vtkAMRMetaData *metadata)
Initialize AMR using the provided metadata by reconstructing the blocksPerLevel.
~vtkAMRDataObject() override
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 PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkAMRDataObject * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
virtual void Initialize(const std::vector< unsigned int > &blocksPerLevel)
Initialize the AMRMetaData and the AMR with the specified blocksPerLevel.
vtkRectilinearGrid * GetDataSetAsRectilinearGrid(unsigned int level, unsigned int idx)
Get the data set as a rectilinear grid using the (level, index) pair.
void ShallowCopy(vtkDataObject *src) override
ShallowCopy.
void DeepCopy(vtkDataObject *src) override
DeepCopy.
void GetBounds(double bounds[6])
Get the (min/max) bounds of the AMR domain.
static vtkAMRDataObject * New()
void GetMax(double max[3])
Get the (min/max) bounds of the AMR domain.
void SetAMRMetaData(vtkAMRMetaData *metadata)
Get/Set the AMR meta data.
void GetMin(double min[3])
Get the (min/max) bounds of the AMR domain.
void CopyStructure(vtkCompositeDataSet *src) override
CopyStructure.
vtkCartesianGrid * GetDataSetAsCartesianGrid(unsigned int level, unsigned int idx)
Get the data set as a cartesian grid using the (level, index) pair.
Meta data that describes the structure of a generic AMR data set.
Abstract API for vtkImageData and vtkRectilinearGrid.
superclass for composite data iterators
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
topologically and geometrically regular array of 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.
a dataset that is topologically regular with variable spacing in the three coordinate directions
Hold a reference to a vtkObjectBase instance.
Deprecated vtkImageData.
#define VTK_DEPRECATED_IN_9_6_0(reason)
#define VTK_DOUBLE_MIN
Definition vtkType.h:171
#define VTK_DOUBLE_MAX
Definition vtkType.h:172
@ VTK_AMR_DATA_OBJECT
Definition vtkType.h:131
#define VTK_NEWINSTANCE
#define max(a, b)