Dune Core Modules (2.4.1)

persistentcontainer.hh
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
8#include <dune/grid/utility/persistentcontainermap.hh>
9
10namespace 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
33 template< class Grid, class T >
34 class PersistentContainer< const Grid, T >
35 : public PersistentContainer< Grid, T >
36 {
38 public:
39 typedef typename Base::Value Value;
40
41 PersistentContainer ( const typename Base::Grid &grid, int codim, const Value &value = Value() )
42 : Base(grid, codim, value)
43 {}
44 };
45
46} // namespace Dune
47
48
49#if 0
50
51// the following implementation can be used for a grid providing a hash for the id type
52
53#include <unordered_map>
54
55namespace Dune
56{
57
58 template< G, class T >
59 class PersistentContainer
60 : public PersistentContainerMap< G, typename G::LocalIdSet, std::unordered_map< typename G::LocalIdSet::IdType, T > >
61 {
62 typedef PersistentContainerMap< G, typename G::LocalIdSet, std::unordered_map< typename G::LocalIdSet::IdType, T > > Base;
63
64 public:
65 typedef typename Base::Grid Grid;
66 typedef typename Base::Value Value;
67
68 PersistentContainer ( const Grid &grid, int codim, const Value &value )
69 : Base( grid, codim, grid.localIdSet(), value )
70 {}
71 };
72
73} // namespace Dune
74
75#endif // #if 0
76
77namespace std
78{
79
80 template< class G, class T >
82 {
83 a.swap( b );
84 }
85
86} // namespace std
87
88#endif // #ifndef DUNE_PERSISTENTCONTAINER_HH
map-based implementation of the PersistentContainer
Definition: persistentcontainermap.hh:22
A class for storing data during an adaptation cycle.
Definition: persistentcontainer.hh:20
Dune namespace.
Definition: alignment.hh:10
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)