VTK  9.3.1
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 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkUniformGrid;
24 class VTKCOMMONDATAMODEL_EXPORT vtkAMRDataInternals : public vtkObject
25 {
26 public:
27  struct Block
28  {
30  unsigned int Index;
31  Block(unsigned int i, vtkUniformGrid* g);
32  };
33  typedef std::vector<vtkAMRDataInternals::Block> BlockList;
34 
35  static vtkAMRDataInternals* New();
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 
44  void CompositeShallowCopy(vtkObject* src);
45  void ShallowCopy(vtkObject* src);
46 
47  bool Empty() const { return this->GetNumberOfBlocks() == 0; }
48 
49 public:
50  unsigned int GetNumberOfBlocks() const { return static_cast<unsigned int>(this->Blocks.size()); }
51  const Block& GetBlock(unsigned int i) { return this->Blocks[i]; }
52  const BlockList& GetAllBlocks() const { return this->Blocks; }
53 
54 protected:
56  ~vtkAMRDataInternals() override;
57 
58  void GenerateIndex(bool force = false);
59 
60  std::vector<Block> Blocks;
61  std::vector<int>* InternalIndex; // map from the composite index to internal index
62  bool GetInternalIndex(unsigned int compositeIndex, unsigned int& internalIndex);
63 
64 private:
66  void operator=(const vtkAMRDataInternals&) = delete;
67 };
68 
69 VTK_ABI_NAMESPACE_END
70 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const Block & GetBlock(unsigned int i)
unsigned int GetNumberOfBlocks() const
a simple class to control print indentation
Definition: vtkIndent.h:28
container of vtkUniformGrid for an AMR data set
std::vector< int > * InternalIndex
image data with blanking
vtkSmartPointer< vtkUniformGrid > Grid
const BlockList & GetAllBlocks() const
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
std::vector< vtkAMRDataInternals::Block > BlockList
std::vector< Block > Blocks