VTK
vtkAMRDataInternals.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAMRDataInternals.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
25 #ifndef vtkAMRDataInternals_h
26 #define vtkAMRDataInternals_h
27 
28 #include "vtkCommonDataModelModule.h" // For export macro
29 #include "vtkObject.h"
30 #include "vtkSmartPointer.h" //for storing smart pointers to blocks
31 #include <vector> //for storing blocks
32 
33 class vtkUniformGrid;
35 {
36 public:
37  struct Block
38  {
40  unsigned int Index;
41  Block(unsigned int i, vtkUniformGrid* g);
42  };
43  typedef std::vector<vtkAMRDataInternals::Block> BlockList;
44 
45  static vtkAMRDataInternals* New();
47 
48  void Initialize();
49  void PrintSelf(ostream& os, vtkIndent indent);
50 
51  void Insert(unsigned int index, vtkUniformGrid* grid);
52  vtkUniformGrid* GetDataSet(unsigned int compositeIndex);
53 
54  virtual void ShallowCopy(vtkObject *src);
55 
56  bool Empty()const{ return this->GetNumberOfBlocks()==0;}
57 
58 public:
59  unsigned int GetNumberOfBlocks() const{ return static_cast<unsigned int>(this->Blocks.size());}
60  const Block& GetBlock(unsigned int i) { return this->Blocks[i];}
61  const BlockList& GetAllBlocks() const{ return this->Blocks;}
62 
63 protected:
64 
67 
68  void GenerateIndex(bool force=false);
69 
70  std::vector<Block> Blocks;
71  std::vector<int>* InternalIndex; //map from the composite index to internal index
72  bool GetInternalIndex(unsigned int compositeIndex, unsigned int& internalIndex);
73 
74 private:
75  vtkAMRDataInternals(const vtkAMRDataInternals&); // Not implemented.
76  void operator=(const vtkAMRDataInternals&); // Not implemented
77 };
78 
79 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
const Block & GetBlock(unsigned int i)
struct tagBlock Block
unsigned int GetNumberOfBlocks() const
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
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()
std::vector< vtkAMRDataInternals::Block > BlockList
#define VTKCOMMONDATAMODEL_EXPORT
std::vector< Block > Blocks