VTK  9.7.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 "vtkDeprecation.h" //for VTK_DEPRECATED_IN_9_6_0
19 #include "vtkObject.h"
20 #include "vtkSmartPointer.h" //for storing smart pointers to blocks
21 
22 #include <vector> //for storing blocks
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkUniformGrid;
26 class VTK_DEPRECATED_IN_9_6_0("This class is not used anymore and will be removed.")
27  VTKCOMMONDATAMODEL_EXPORT vtkAMRDataInternals : public vtkObject
28 {
29 public:
30  struct Block
31  {
33  unsigned int Index;
34  Block(unsigned int i, vtkUniformGrid* g);
35  };
36  typedef std::vector<vtkAMRDataInternals::Block> BlockList;
37 
38  static vtkAMRDataInternals* New();
40 
41  void Initialize();
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
44  void Insert(unsigned int index, vtkUniformGrid* grid);
45  vtkUniformGrid* GetDataSet(unsigned int compositeIndex);
46 
47  void CompositeShallowCopy(vtkObject* src);
48  void ShallowCopy(vtkObject* src);
49  void DeepCopy(vtkObject* src);
50 
51  bool Empty() const { return this->GetNumberOfBlocks() == 0; }
52 
53 public:
54  unsigned int GetNumberOfBlocks() const { return static_cast<unsigned int>(this->Blocks.size()); }
55  const Block& GetBlock(unsigned int i) { return this->Blocks[i]; }
56  const BlockList& GetAllBlocks() const { return this->Blocks; }
57 
58 protected:
60  ~vtkAMRDataInternals() override;
61 
62  void GenerateIndex(bool force = false);
63 
64  std::vector<Block> Blocks;
65  std::vector<int>* InternalIndex; // map from the composite index to internal index
66  bool GetInternalIndex(unsigned int compositeIndex, unsigned int& internalIndex);
67 
68 private:
70  void operator=(const vtkAMRDataInternals&) = delete;
71 };
72 
73 VTK_ABI_NAMESPACE_END
74 #endif
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.
const Block & GetBlock(unsigned int i)
unsigned int GetNumberOfBlocks() const
#define VTK_DEPRECATED_IN_9_6_0(reason)
a simple class to control print indentation
Definition: vtkIndent.h:28
container of vtkUniformGrid for an AMR data set
std::vector< int > * InternalIndex
Deprecated vtkImageData.
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