dune-grid  2.3.1
utility/persistentcontainer.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_PERSISTENTCONTAINER_HH
4 #define DUNE_PERSISTENTCONTAINER_HH
5 
6 #include <map>
7 
9 
10 namespace Dune
11 {
12 
17  template< class G, class T >
19  : public PersistentContainerMap< G, typename G::LocalIdSet, std::map< typename G::LocalIdSet::IdType, T > >
20  {
22 
23  public:
24  typedef typename Base::Grid Grid;
25  typedef typename Base::Value Value;
26 
27  PersistentContainer ( const Grid &grid, int codim, const Value &value = Value() )
28  : Base( grid, codim, grid.localIdSet(), value )
29  {}
30  };
31 
32 } // namespace Dune
33 
34 
35 #if 0
36 
37 // the following implementation can be used for a grid providing a hash for the id type
38 
39 #include <unordered_map>
40 
41 namespace Dune
42 {
43 
44  template< G, class T >
45  class PersistentContainer
46  : public PersistentContainerMap< G, typename G::LocalIdSet, std::unordered_map< typename G::LocalIdSet::IdType, T > >
47  {
48  typedef PersistentContainerMap< G, typename G::LocalIdSet, std::unordered_map< typename G::LocalIdSet::IdType, T > > Base;
49 
50  public:
51  typedef typename Base::Grid Grid;
52  typedef typename Base::Value Value;
53 
54  PersistentContainer ( const Grid &grid, int codim, const Value &value )
55  : Base( grid, codim, grid.localIdSet(), value )
56  {}
57  };
58 
59 } // namespace Dune
60 
61 #endif // #if 0
62 
63 namespace std
64 {
65 
66  template< class G, class T >
68  {
69  a.swap( b );
70  }
71 
72 } // namespace std
73 
74 #endif // #ifndef DUNE_PERSISTENTCONTAINER_HH
PersistentContainer(const Grid &grid, int codim, const Value &value=Value())
Definition: utility/persistentcontainer.hh:27
map-based implementation of the PersistentContainer
Definition: persistentcontainermap.hh:21
void swap(This &other)
Definition: persistentcontainermap.hh:95
A class for storing data during an adaptation cycle.
Definition: utility/persistentcontainer.hh:18
const Grid & grid() const
Definition: persistentcontainermap.hh:134
Base::Value Value
Definition: utility/persistentcontainer.hh:25
G Grid
Definition: persistentcontainermap.hh:30
Base::Grid Grid
Definition: utility/persistentcontainer.hh:24
Map::mapped_type Value
Definition: persistentcontainermap.hh:35