VTK  9.7.20260812
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_8_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
50
53 [[nodiscard]] vtkGetMacro(GridDescription, int);
54 void SetGridDescription(int description);
56
60 [[nodiscard]] unsigned int GetNumberOfLevels() const;
61
66 [[nodiscard]] unsigned int GetNumberOfBlocks(unsigned int level) const;
67
71 [[nodiscard]] unsigned int GetNumberOfBlocks() const;
72
77 [[nodiscard]] int GetAbsoluteBlockIndex(unsigned int level, unsigned int relativeBlockIdx) const;
78
82 void ComputeIndexPair(unsigned int index, unsigned int& level, unsigned int& id);
83
87 VTK_DEPRECATED_IN_9_8_0("Use vtkAMRMetaData methods instead")
88 [[nodiscard]] const std::vector<int>& GetNumBlocks() const { return this->NumBlocks; }
89
93 virtual void DeepCopy(vtkAMRMetaData* other);
94
95protected:
97 ~vtkAMRMetaData() override;
98
99private:
100 vtkAMRMetaData(const vtkAMRMetaData&) = delete;
101 void operator=(const vtkAMRMetaData&) = delete;
102
103 void GenerateBlockLevel();
104
105 //-------------------------------------------------------------------------
106 // Essential information that determines an AMR structure. Must be copied
107 //-------------------------------------------------------------------------
108
109 // The type of grid stored in this AMR
110 int GridDescription = vtkStructuredData::VTK_STRUCTURED_INVALID;
111
112 // NumBlocks[i] stores the total number of blocks from level 0 to level i-1
113 std::vector<int> NumBlocks = { 0 };
114
115 //-------------------------------------------------------------------------
116 // Auxiliary information that be computed
117 //-------------------------------------------------------------------------
118
119 // only necessary if need to call ComputeIndexPair
121};
122
123VTK_ABI_NAMESPACE_END
124#endif
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 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.
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_8_0(reason)