VTK  9.7.1
vtkAMRMetaData.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
18 #ifndef vtkAMRMetaData_h
19 #define vtkAMRMetaData_h
20 
21 #include "vtkCommonDataModelModule.h" // For export macro
22 #include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
23 #include "vtkObject.h"
24 #include "vtkSmartPointer.h" // For vtkSmartPointer
25 #include "vtkStructuredData.h" // For VTK_STRUCTURED_INVALID
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 
30 class VTKCOMMONDATAMODEL_EXPORT vtkAMRMetaData : public vtkObject
31 {
32 public:
33  static vtkAMRMetaData* New();
34  vtkTypeMacro(vtkAMRMetaData, vtkObject);
35 
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40  bool operator==(const vtkAMRMetaData& other) const;
41  bool operator!=(const vtkAMRMetaData& other) const { return !(*this == other); }
42 
47  virtual void Initialize(const std::vector<unsigned int>& blocksPerLevel);
48 
54  VTK_DEPRECATED_IN_9_6_0("Use Initialize(const std::vector<unsigned int>&) instead")
55  virtual void Initialize(int numLevels, const int* blocksPerLevel);
56 
58 
61  [[nodiscard]] vtkGetMacro(GridDescription, int);
62  void SetGridDescription(int description);
64 
68  [[nodiscard]] unsigned int GetNumberOfLevels() const;
69 
74  [[nodiscard]] unsigned int GetNumberOfBlocks(unsigned int level) const;
75 
79  VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks(level) instead")
80  unsigned int GetNumberOfDataSets(unsigned int level) { return this->GetNumberOfBlocks(level); }
81 
85  [[nodiscard]] unsigned int GetNumberOfBlocks() const;
86 
90  VTK_DEPRECATED_IN_9_6_0("Use GetNumberOfBlocks instead")
91  virtual unsigned int GetTotalNumberOfBlocks() { return this->GetNumberOfBlocks(); }
92 
97  [[nodiscard]] int GetAbsoluteBlockIndex(unsigned int level, unsigned int relativeBlockIdx) const;
98 
102  VTK_DEPRECATED_IN_9_6_0("Use GetAbsoluteBlockIndex(level, id) instead")
103  int GetIndex(unsigned int level, unsigned int id) const
104  {
105  return this->GetAbsoluteBlockIndex(level, id);
106  }
107 
111  void ComputeIndexPair(unsigned int index, unsigned int& level, unsigned int& id);
112 
117  [[nodiscard]] const std::vector<int>& GetNumBlocks() const { return this->NumBlocks; }
118 
122  virtual void DeepCopy(vtkAMRMetaData* other);
123 
124 protected:
125  vtkAMRMetaData();
126  ~vtkAMRMetaData() override;
127 
128 private:
129  vtkAMRMetaData(const vtkAMRMetaData&) = delete;
130  void operator=(const vtkAMRMetaData&) = delete;
131 
132  void GenerateBlockLevel();
133 
134  //-------------------------------------------------------------------------
135  // Essential information that determines an AMR structure. Must be copied
136  //-------------------------------------------------------------------------
137 
138  // The type of grid stored in this AMR
139  int GridDescription = vtkStructuredData::VTK_STRUCTURED_INVALID;
140 
141  // NumBlocks[i] stores the total number of blocks from level 0 to level i-1
142  std::vector<int> NumBlocks = { 0 };
143 
144  //-------------------------------------------------------------------------
145  // Auxiliary information that be computed
146  //-------------------------------------------------------------------------
147 
148  // only necessary if need to call ComputeIndexPair
150 };
151 
152 VTK_ABI_NAMESPACE_END
153 #endif
dynamic, self-adjusting array of unsigned int
bool operator!=(const vtkAMRMetaData &other) const
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool VTKCOMMONCORE_EXPORT operator==(const std::string &a, const vtkStringToken &b)
#define VTK_DEPRECATED_IN_9_6_0(reason)
a simple class to control print indentation
Definition: vtkIndent.h:28
const std::vector< int > & GetNumBlocks() const
Returns internal vector of blocks.
Meta data that describes the structure of a generic AMR data set.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...