VTK  9.7.1
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 
54 VTK_ABI_NAMESPACE_BEGIN
55 class vtkAMRDataInternals; // VTK_DEPRECATED_IN_9_6_0
56 class vtkAMRMetaData;
57 class vtkCartesianGrid;
59 class vtkDataSet;
60 class vtkImageData;
61 class vtkOverlappingAMRMetaData; // VTK_DEPRECATED_IN_9_6_0
62 class vtkRectilinearGrid;
63 class vtkUniformGrid;
64 class VTKCOMMONDATAMODEL_EXPORT vtkAMRDataObject : public vtkPartitionedDataSetCollection
65 {
66 public:
67  static vtkAMRDataObject* New();
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 
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 
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 
220  void CompositeShallowCopy(vtkCompositeDataSet* src) override;
221  void ShallowCopy(vtkDataObject* src) override;
223 
227  void DeepCopy(vtkDataObject* src) override;
228 
232  void CopyStructure(vtkCompositeDataSet* src) override;
233 
235 
239  static vtkAMRDataObject* GetData(vtkInformationVector* v, int i = 0);
241 
243 
246  [[nodiscard]] vtkAMRMetaData* GetAMRMetaData();
247  void SetAMRMetaData(vtkAMRMetaData* metadata);
249 
251 
254  void SetPartition(unsigned int idx, unsigned int partition, vtkDataObject* object) override;
255  vtkDataSet* GetPartition(unsigned int idx, unsigned int partition) override;
257 
258 protected:
260  ~vtkAMRDataObject() override;
261 
265  virtual void InstantiateMetaData();
266 
268 
272  VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be used, returns nullptr")
273  virtual vtkAMRDataInternals* GetAMRData() { return nullptr; }
274  VTK_DEPRECATED_IN_9_6_0("This function is deprecated and has no effect")
275  virtual void SetAMRData(vtkAMRDataInternals*) {};
277 
279 
283  "This function is deprecated and should not be inherited, use GetAMRMetaData() instead")
284  virtual vtkOverlappingAMRMetaData* GetAMRInfo() { return nullptr; };
285  VTK_DEPRECATED_IN_9_6_0("This function is deprecated and should not be inherited, use "
286  "SetAMRMetaData() or Initialize(vtkAMRMetaData*) instead")
287  virtual void SetAMRInfo(vtkOverlappingAMRMetaData*) {};
289 
290 private:
291  vtkAMRDataObject(const vtkAMRDataObject&) = delete;
292  void operator=(const vtkAMRDataObject&) = delete;
293 
294  void InitializeInternal();
295 
296  double Bounds[6] = {
303  };
305 };
306 
307 VTK_ABI_NAMESPACE_END
308 #endif
void CompositeShallowCopy(vtkCompositeDataSet *src) override
Overridden to handle vtkDataAssembly.
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
void DeepCopy(vtkDataObject *src) override
Overridden to handle vtkDataAssembly.
static vtkPartitionedDataSetCollection * GetData(vtkInformation *info)
Retrieve an instance of this class from an information object.
#define VTK_DOUBLE_MAX
Definition: vtkType.h:202
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataObject * GetDataSet(vtkCompositeDataIterator *iter) override
Returns the dataset located at the position pointed by the iterator.
void SetDataSet(vtkCompositeDataIterator *iter, vtkDataObject *dataObj) override
Sets the data set at the location pointed by the iterator.
void ShallowCopy(vtkDataObject *src) override
Overridden to handle vtkDataAssembly.
superclass for composite data iterators
#define VTK_DEPRECATED_IN_9_6_0(reason)
vtkCompositeDataIterator * NewIterator() override
Return a new iterator (the iterator has to be deleted by user).
abstract superclass for composite (multi-block or AMR) datasets
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
virtual vtkDataSet * GetPartition(unsigned int idx, unsigned int partition)
API to get/set partitions using a tuple index.
void GetBounds(double bounds[6])
Return the geometric bounding box in the form (xmin,xmax, ymin,ymax, zmin,zmax).
Meta data that describes the structure of an overlapping AMR data set.
a multi-resolution dataset based on vtkCartesianGrid
void CopyStructure(vtkCompositeDataSet *input) override
Overridden to handle vtkDataAssembly.
container of vtkUniformGrid for an AMR data set
#define VTK_DOUBLE_MIN
Definition: vtkType.h:201
#define VTK_NEWINSTANCE
Deprecated vtkImageData.
void Initialize() override
Overridden to handle vtkDataAssembly.
Meta data that describes the structure of a generic AMR data set.
static vtkPartitionedDataSetCollection * New()
Store zero or more vtkInformation instances.
Abstract API for vtkImageData and vtkRectilinearGrid.
general representation of visualization data
Definition: vtkDataObject.h:55
virtual void SetPartition(unsigned int idx, unsigned int partition, vtkDataObject *object)
API to get/set partitions using a tuple index.
int GetDataObjectType() VTK_FUTURE_CONST override
Return class name of data type (see vtkType.h for definitions).
#define max(a, b)
Composite dataset that groups datasets as a collection.