VTK
dox/Common/DataModel/vtkAMRDataInternals.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkAMRDataInternals.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00025 #ifndef __vtkAMRDataInternals_h
00026 #define __vtkAMRDataInternals_h
00027 
00028 #include "vtkCommonDataModelModule.h" // For export macro
00029 #include "vtkObject.h"
00030 #include <vtkSmartPointer.h> //for storing smart pointers to blocks
00031 #include <vector> //for storing blocks
00032 
00033 class vtkUniformGrid;
00034 class VTKCOMMONDATAMODEL_EXPORT vtkAMRDataInternals : public vtkObject
00035 {
00036 public:
00037   struct Block
00038   {
00039     vtkSmartPointer<vtkUniformGrid> Grid;
00040     unsigned int Index;
00041     Block(unsigned int i, vtkUniformGrid* g);
00042   };
00043   typedef std::vector<vtkAMRDataInternals::Block> BlockList;
00044 
00045   static vtkAMRDataInternals* New();
00046   vtkTypeMacro(vtkAMRDataInternals, vtkObject);
00047 
00048   void Initialize();
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00051   void Insert(unsigned int index, vtkUniformGrid* grid);
00052   vtkUniformGrid* GetDataSet(unsigned int compositeIndex);
00053 
00054   virtual void ShallowCopy(vtkObject *src);
00055 
00056   bool Empty()const{ return this->GetNumberOfBlocks()==0;}
00057 
00058 public:
00059   unsigned int GetNumberOfBlocks() const{ return static_cast<unsigned int>(this->Blocks.size());}
00060   const Block& GetBlock(unsigned int i) { return this->Blocks[i];}
00061   const BlockList& GetAllBlocks() const{ return this->Blocks;}
00062 
00063 protected:
00064 
00065   vtkAMRDataInternals();
00066   ~vtkAMRDataInternals();
00067 
00068   void GenerateIndex(bool force=false);
00069 
00070   std::vector<Block> Blocks;
00071   std::vector<int>* InternalIndex; //map from the composite index to internal index
00072   bool GetInternalIndex(unsigned int compositeIndex, unsigned int& internalIndex);
00073 
00074 private:
00075   vtkAMRDataInternals(const vtkAMRDataInternals&); // Not implemented.
00076   void operator=(const vtkAMRDataInternals&); // Not implemented
00077 };
00078 
00079 #endif