dune-grid
2.2.0
|
00001 #ifndef DUNE_ALU_PERSISTENTCONTAINER_HH 00002 #define DUNE_ALU_PERSISTENTCONTAINER_HH 00003 00004 #ifdef ENABLE_ALUGRID 00005 #include <dune/grid/utility/persistentcontainer.hh> 00006 #include <dune/grid/alugrid.hh> 00007 00008 namespace Dune 00009 { 00010 // PersistentContainer for ALUGrid 00011 // ------------------------------- 00012 00013 template< int dim, int dimworld, class Data, class Allocator > 00014 class PersistentContainer< ALUConformGrid< dim, dimworld >, Data, Allocator > 00015 : public PersistentContainerVector< ALUConformGrid< dim, dimworld >, 00016 typename ALUConformGrid< dim, dimworld >::HierarchicIndexSet, 00017 std::vector<Data,Allocator> > 00018 { 00019 public: 00020 typedef ALUConformGrid< dim, dimworld > GridType; 00021 private: 00022 typedef PersistentContainerVector< GridType, typename GridType::HierarchicIndexSet, std::vector<Data,Allocator> > BaseType; 00023 00024 public: 00027 PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() ) 00028 : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator ) 00029 {} 00030 }; 00031 00032 template< int dim, int dimworld, class Data, class Allocator > 00033 class PersistentContainer< ALUCubeGrid< dim, dimworld >, Data, Allocator > 00034 : public PersistentContainerVector< ALUCubeGrid< dim, dimworld >, 00035 typename ALUCubeGrid< dim, dimworld >::HierarchicIndexSet, 00036 std::vector<Data,Allocator> > 00037 { 00038 public: 00039 typedef ALUCubeGrid< dim, dimworld > GridType; 00040 private: 00041 typedef PersistentContainerVector< GridType, typename GridType::HierarchicIndexSet, std::vector<Data,Allocator> > BaseType; 00042 00043 public: 00046 PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() ) 00047 : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator ) 00048 {} 00049 }; 00050 00051 template< int dim, int dimworld, class Data, class Allocator > 00052 class PersistentContainer< ALUSimplexGrid< dim, dimworld >, Data, Allocator > 00053 : public PersistentContainerVector< ALUSimplexGrid< dim, dimworld >, 00054 typename ALUSimplexGrid< dim, dimworld >::HierarchicIndexSet, 00055 std::vector<Data,Allocator> > 00056 { 00057 public: 00058 typedef ALUSimplexGrid< dim, dimworld > GridType; 00059 private: 00060 typedef PersistentContainerVector< GridType, typename GridType::HierarchicIndexSet, std::vector<Data,Allocator> > BaseType; 00061 00062 public: 00065 PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() ) 00066 : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator ) 00067 {} 00068 }; 00069 00070 template< int dim, int dimworld, ALUGridElementType eltype, ALUGridRefinementType refinementtype, class Comm, 00071 class Data, class Allocator > 00072 class PersistentContainer< ALUGrid< dim, dimworld, eltype, refinementtype, Comm >, Data, Allocator > 00073 : public PersistentContainerVector< ALUGrid< dim, dimworld, eltype, refinementtype, Comm >, 00074 typename ALUGrid< dim, dimworld, eltype, refinementtype, Comm >::HierarchicIndexSet, 00075 std::vector<Data,Allocator> > 00076 { 00077 public: 00078 typedef ALUGrid< dim, dimworld, eltype, refinementtype, Comm > GridType; 00079 private: 00080 typedef PersistentContainerVector< GridType, typename GridType::HierarchicIndexSet, std::vector<Data,Allocator> > BaseType; 00081 00082 public: 00085 PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() ) 00086 : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator ) 00087 {} 00088 }; 00089 00090 template< int dim, int dimworld, ALU2DSPACE ElementType elType, class Data, class Allocator > 00091 class PersistentContainer< ALU2dGrid< dim, dimworld, elType >, Data, Allocator > 00092 : public PersistentContainerVector< ALU2dGrid< dim, dimworld, elType >, 00093 typename ALU2dGrid< dim, dimworld, elType >::HierarchicIndexSet, 00094 std::vector<Data,Allocator> > 00095 { 00096 public: 00097 typedef ALU2dGrid< dim, dimworld, elType > GridType; 00098 private: 00099 typedef PersistentContainerVector< GridType, typename GridType::HierarchicIndexSet, std::vector<Data,Allocator> > BaseType; 00100 00101 public: 00104 PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() ) 00105 : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator ) 00106 {} 00107 }; 00108 00109 template< ALU3dGridElementType elType, class Comm, class Data, class Allocator > 00110 class PersistentContainer< ALU3dGrid< elType, Comm >, Data, Allocator > 00111 : public PersistentContainerVector< ALU3dGrid< elType, Comm >, 00112 typename ALU3dGrid< elType, Comm >::HierarchicIndexSet, 00113 std::vector<Data,Allocator> > 00114 { 00115 public: 00116 typedef ALU3dGrid< elType, Comm > GridType; 00117 private: 00118 typedef PersistentContainerVector< GridType, typename GridType::HierarchicIndexSet, std::vector<Data,Allocator> > BaseType; 00119 00120 protected: 00121 using BaseType :: index_; 00122 using BaseType :: data_; 00123 00124 public: 00127 PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() ) 00128 : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator ) 00129 {} 00130 00133 const Data& getData ( const size_t idx ) const 00134 { 00135 assert( idx < data_.size() ); 00136 return data_[ idx ]; 00137 } 00138 }; 00139 00140 } // end namespace Dune 00141 #endif // ENABLE_ALU 00142 00143 #endif // end DUNE_ALU_PERSISTENTCONTAINER_HH