dune-grid  2.2.0
alugrid/common/persistentcontainer.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALU_PERSISTENTCONTAINER_HH
2 #define DUNE_ALU_PERSISTENTCONTAINER_HH
3 
4 #ifdef ENABLE_ALUGRID
6 #include <dune/grid/alugrid.hh>
7 
8 namespace Dune
9 {
10  // PersistentContainer for ALUGrid
11  // -------------------------------
12 
13  template< int dim, int dimworld, class Data, class Allocator >
14  class PersistentContainer< ALUConformGrid< dim, dimworld >, Data, Allocator >
15  : public PersistentContainerVector< ALUConformGrid< dim, dimworld >,
16  typename ALUConformGrid< dim, dimworld >::HierarchicIndexSet,
17  std::vector<Data,Allocator> >
18  {
19  public:
21  private:
23 
24  public:
27  PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() )
28  : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator )
29  {}
30  };
31 
32  template< int dim, int dimworld, class Data, class Allocator >
33  class PersistentContainer< ALUCubeGrid< dim, dimworld >, Data, Allocator >
34  : public PersistentContainerVector< ALUCubeGrid< dim, dimworld >,
35  typename ALUCubeGrid< dim, dimworld >::HierarchicIndexSet,
36  std::vector<Data,Allocator> >
37  {
38  public:
39  typedef ALUCubeGrid< dim, dimworld > GridType;
40  private:
42 
43  public:
46  PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() )
47  : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator )
48  {}
49  };
50 
51  template< int dim, int dimworld, class Data, class Allocator >
52  class PersistentContainer< ALUSimplexGrid< dim, dimworld >, Data, Allocator >
53  : public PersistentContainerVector< ALUSimplexGrid< dim, dimworld >,
54  typename ALUSimplexGrid< dim, dimworld >::HierarchicIndexSet,
55  std::vector<Data,Allocator> >
56  {
57  public:
58  typedef ALUSimplexGrid< dim, dimworld > GridType;
59  private:
61 
62  public:
65  PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() )
66  : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator )
67  {}
68  };
69 
70  template< int dim, int dimworld, ALUGridElementType eltype, ALUGridRefinementType refinementtype, class Comm,
71  class Data, class Allocator >
72  class PersistentContainer< ALUGrid< dim, dimworld, eltype, refinementtype, Comm >, Data, Allocator >
73  : public PersistentContainerVector< ALUGrid< dim, dimworld, eltype, refinementtype, Comm >,
74  typename ALUGrid< dim, dimworld, eltype, refinementtype, Comm >::HierarchicIndexSet,
75  std::vector<Data,Allocator> >
76  {
77  public:
78  typedef ALUGrid< dim, dimworld, eltype, refinementtype, Comm > GridType;
79  private:
81 
82  public:
85  PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() )
86  : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator )
87  {}
88  };
89 
90  template< int dim, int dimworld, ALU2DSPACE ElementType elType, class Data, class Allocator >
91  class PersistentContainer< ALU2dGrid< dim, dimworld, elType >, Data, Allocator >
92  : public PersistentContainerVector< ALU2dGrid< dim, dimworld, elType >,
93  typename ALU2dGrid< dim, dimworld, elType >::HierarchicIndexSet,
94  std::vector<Data,Allocator> >
95  {
96  public:
98  private:
100 
101  public:
104  PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() )
105  : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator )
106  {}
107  };
108 
109  template< ALU3dGridElementType elType, class Comm, class Data, class Allocator >
110  class PersistentContainer< ALU3dGrid< elType, Comm >, Data, Allocator >
111  : public PersistentContainerVector< ALU3dGrid< elType, Comm >,
112  typename ALU3dGrid< elType, Comm >::HierarchicIndexSet,
113  std::vector<Data,Allocator> >
114  {
115  public:
117  private:
119 
120  protected:
121  using BaseType :: index_;
122  using BaseType :: data_;
123 
124  public:
127  PersistentContainer ( const GridType &grid, const int codim, const Allocator &allocator = Allocator() )
128  : BaseType( grid, codim, grid.hierarchicIndexSet(), 1.1, allocator )
129  {}
130 
133  const Data& getData ( const size_t idx ) const
134  {
135  assert( idx < data_.size() );
136  return data_[ idx ];
137  }
138  };
139 
140 } // end namespace Dune
141 #endif // ENABLE_ALU
142 
143 #endif // end DUNE_ALU_PERSISTENTCONTAINER_HH