VTK  9.4.20250114
vtkAMRDataInternals.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
14#ifndef vtkAMRDataInternals_h
15#define vtkAMRDataInternals_h
16
17#include "vtkCommonDataModelModule.h" // For export macro
18#include "vtkObject.h"
19#include "vtkSmartPointer.h" //for storing smart pointers to blocks
20#include <vector> //for storing blocks
21
22VTK_ABI_NAMESPACE_BEGIN
23class vtkUniformGrid;
24class VTKCOMMONDATAMODEL_EXPORT vtkAMRDataInternals : public vtkObject
25{
26public:
27 struct Block
28 {
30 unsigned int Index;
31 Block(unsigned int i, vtkUniformGrid* g);
32 };
33 typedef std::vector<vtkAMRDataInternals::Block> BlockList;
34
37
38 void Initialize();
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
41 void Insert(unsigned int index, vtkUniformGrid* grid);
42 vtkUniformGrid* GetDataSet(unsigned int compositeIndex);
43
46 void DeepCopy(vtkObject* src);
47
48 bool Empty() const { return this->GetNumberOfBlocks() == 0; }
49
50public:
51 unsigned int GetNumberOfBlocks() const { return static_cast<unsigned int>(this->Blocks.size()); }
52 const Block& GetBlock(unsigned int i) { return this->Blocks[i]; }
53 const BlockList& GetAllBlocks() const { return this->Blocks; }
54
55protected:
58
59 void GenerateIndex(bool force = false);
60
61 std::vector<Block> Blocks;
62 std::vector<int>* InternalIndex; // map from the composite index to internal index
63 bool GetInternalIndex(unsigned int compositeIndex, unsigned int& internalIndex);
64
65private:
67 void operator=(const vtkAMRDataInternals&) = delete;
68};
69
70VTK_ABI_NAMESPACE_END
71#endif
container of vtkUniformGrid for an AMR data set
void GenerateIndex(bool force=false)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void DeepCopy(vtkObject *src)
void Insert(unsigned int index, vtkUniformGrid *grid)
static vtkAMRDataInternals * New()
unsigned int GetNumberOfBlocks() const
void CompositeShallowCopy(vtkObject *src)
const BlockList & GetAllBlocks() const
vtkUniformGrid * GetDataSet(unsigned int compositeIndex)
bool GetInternalIndex(unsigned int compositeIndex, unsigned int &internalIndex)
~vtkAMRDataInternals() override
std::vector< vtkAMRDataInternals::Block > BlockList
std::vector< int > * InternalIndex
std::vector< Block > Blocks
void ShallowCopy(vtkObject *src)
const Block & GetBlock(unsigned int i)
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
Hold a reference to a vtkObjectBase instance.
image data with blanking
Block(unsigned int i, vtkUniformGrid *g)
vtkSmartPointer< vtkUniformGrid > Grid