Dune Core Modules (2.3.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
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
41namespace 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
63namespace 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
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:14
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)