VTK  9.5.20251120
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
17
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
27VTK_ABI_NAMESPACE_BEGIN
28
30class VTKCOMMONDATAMODEL_EXPORT vtkAMRMetaData : public vtkObject
31{
32public:
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 [[nodiscard]] 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
124protected:
126 ~vtkAMRMetaData() override;
127
128private:
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
152VTK_ABI_NAMESPACE_END
153#endif
int GetIndex(unsigned int level, unsigned int id) const
Deprecated, forward to GetAbsoluteBlockIndex.
int GetAbsoluteBlockIndex(unsigned int level, unsigned int relativeBlockIdx) const
Returns the absolute block index from a level and a relative block index or -1 if level is invalid.
void PrintSelf(ostream &os, vtkIndent indent) override
Print members.
unsigned int GetNumberOfBlocks(unsigned int level) const
Returns the number of blocks at the given level or zero if level is higher or equal than numLevels.
const std::vector< int > & GetNumBlocks() const
Returns internal vector of blocks.
void SetGridDescription(int description)
returns the grid description used for all blocks
static vtkAMRMetaData * New()
unsigned int GetNumberOfLevels() const
Return the number of levels.
bool operator!=(const vtkAMRMetaData &other) const
unsigned int GetNumberOfDataSets(unsigned int level)
Deprecated, forward to GetNumberOfBlocks(level)
unsigned int GetNumberOfBlocks() const
Returns number of blocks for all levels.
virtual void DeepCopy(vtkAMRMetaData *other)
Copy internal fields from other into this.
void ComputeIndexPair(unsigned int index, unsigned int &level, unsigned int &id)
Returns the an index pair (level, relative index) given a absolute block index.
virtual unsigned int GetTotalNumberOfBlocks()
Deprecated, forward to GetNumberOfBlocks.
bool operator==(const vtkAMRMetaData &other) const
virtual void Initialize(const std::vector< unsigned int > &blocksPerLevel)
Initialize the meta information blocksPerLevel is the number of blocks for each levels.
~vtkAMRMetaData() override
a simple class to control print indentation
Definition vtkIndent.h:108
Hold a reference to a vtkObjectBase instance.
dynamic, self-adjusting array of unsigned int
#define VTK_DEPRECATED_IN_9_6_0(reason)