VTK  9.7.20260709
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
44
45#ifndef vtkAMRDataObject_h
46#define vtkAMRDataObject_h
47
48#include "vtkCommonDataModelModule.h" // For export macro
49#include "vtkNew.h" // for vtkNew
51#include "vtkSmartPointer.h" // for vtkSmartPointer
52
53VTK_ABI_NAMESPACE_BEGIN
54class vtkAMRMetaData;
57class vtkDataSet;
58class vtkImageData;
60class vtkUniformGrid;
61class VTKCOMMONDATAMODEL_EXPORT vtkAMRDataObject : public vtkPartitionedDataSetCollection
62{
63public:
66 void PrintSelf(ostream& os, vtkIndent indent) override;
67
72
76 int GetDataObjectType() VTK_FUTURE_CONST override { return VTK_AMR_DATA_OBJECT; }
77
81 void Initialize() override;
82
86 virtual void Initialize(const std::vector<unsigned int>& blocksPerLevel);
87
91 virtual void Initialize(vtkAMRMetaData* metadata);
92
94
98 void SetGridDescription(int gridDescription);
101
106 [[nodiscard]] unsigned int GetNumberOfLevels() const;
107
113 [[nodiscard]] unsigned int GetNumberOfBlocks() const;
114
119 [[nodiscard]] unsigned int GetNumberOfBlocks(unsigned int level) const;
120
122
125 void GetBounds(double bounds[6]);
126 virtual const double* GetBounds();
127 void GetMin(double min[3]);
128 void GetMax(double max[3]);
130
136 virtual void SetDataSet(unsigned int level, unsigned int idx, vtkDataSet* grid);
137
141 vtkCartesianGrid* GetDataSetAsCartesianGrid(unsigned int level, unsigned int idx);
142
146 vtkImageData* GetDataSetAsImageData(unsigned int level, unsigned int idx);
147
151 vtkRectilinearGrid* GetDataSetAsRectilinearGrid(unsigned int level, unsigned int idx);
152
158 [[nodiscard]] int GetAbsoluteBlockIndex(unsigned int level, unsigned int index) const;
159
164 void ComputeIndexPair(unsigned int index, unsigned int& level, unsigned int& id);
165
167
171 void ShallowCopy(vtkDataObject* src) override;
173
177 void DeepCopy(vtkDataObject* src) override;
178
183
185
191
193
199
201
204 void SetPartition(unsigned int idx, unsigned int partition, vtkDataObject* object) override;
205 vtkDataSet* GetPartition(unsigned int idx, unsigned int partition) override;
207
208protected:
211
215 virtual void InstantiateMetaData();
216
217private:
218 vtkAMRDataObject(const vtkAMRDataObject&) = delete;
219 void operator=(const vtkAMRDataObject&) = delete;
220
221 void InitializeInternal();
222
223 double Bounds[6] = {
230 };
232};
233
234VTK_ABI_NAMESPACE_END
235#endif
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 GetNumberOfLevels() const
Get number of levels.
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...
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).
vtkDataSet * GetPartition(unsigned int idx, unsigned int partition) override
Overrides that call SetDataSet and GetDataSetAsCartesianGrid under the hood.
void Initialize() override
Restore data object to initial state.
void SetPartition(unsigned int idx, unsigned int partition, vtkDataObject *object) override
Overrides that call SetDataSet and GetDataSetAsCartesianGrid under the hood.
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.
unsigned int GetNumberOfBlocks() const
Get the number of blocks for all levels including nullptr blocks.
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.
int GetGridDescription()
Set/Get the data description of this uniform grid instance, e.g.
void DeepCopy(vtkDataObject *src) override
DeepCopy.
void GetBounds(double bounds[6])
Get the (min/max) bounds of the AMR domain.
static vtkAMRDataObject * New()
void SetGridDescription(int gridDescription)
Set/Get the data description of this uniform grid instance, e.g.
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
virtual void SetDataSet(vtkCompositeDataIterator *iter, vtkDataObject *dataObj)=0
Sets the data set at the location pointed by the iterator.
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.
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_DOUBLE_MIN
Definition vtkType.h:201
#define VTK_DOUBLE_MAX
Definition vtkType.h:202
@ VTK_AMR_DATA_OBJECT
Definition vtkType.h:159
#define VTK_NEWINSTANCE
#define max(a, b)