dune-grid
2.11
Toggle main menu visibility
Loading...
Searching...
No Matches
dune
grid
utility
utility/persistentcontainer.hh
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4
// vi: set et ts=4 sw=2 sts=2:
5
#ifndef DUNE_PERSISTENTCONTAINER_HH
6
#define DUNE_PERSISTENTCONTAINER_HH
7
8
#include <map>
9
10
#include <
dune/grid/utility/persistentcontainermap.hh
>
11
12
namespace
Dune
13
{
14
19
template
<
class
G,
class
T >
20
class
PersistentContainer
21
:
public
PersistentContainerMap
< G, typename G::LocalIdSet, std::map< typename G::LocalIdSet::IdType, T > >
22
{
23
typedef
PersistentContainerMap< G, typename G::LocalIdSet, std::map< typename G::LocalIdSet::IdType, T >
> Base;
24
25
public
:
26
typedef
typename
Base::Grid
Grid
;
27
typedef
typename
Base::Value
Value
;
28
29
PersistentContainer
(
const
Grid
&
grid
,
int
codim,
const
Value
&value =
Value
() )
30
: Base(
grid
, codim,
grid
.localIdSet(), value )
31
{}
32
};
33
35
template
<
class
Gr
id
,
class
T >
36
class
PersistentContainer
< const
Grid
, T >
37
:
public
PersistentContainer
< Grid, T >
38
{
39
typedef
PersistentContainer< Grid, T >
Base;
40
public
:
41
typedef
typename
Base::Value
Value
;
42
43
PersistentContainer
(
const
typename
Base::Grid
&
grid
,
int
codim,
const
Value
&value =
Value
() )
44
: Base(
grid
, codim, value)
45
{}
46
};
47
48
}
// namespace Dune
49
50
51
#if 0
52
53
// the following implementation can be used for a grid providing a hash for the id type
54
55
#include <unordered_map>
56
57
namespace
Dune
58
{
59
60
template
< G,
class
T >
61
class
PersistentContainer
62
:
public
PersistentContainerMap
< G, typename G::LocalIdSet, std::unordered_map< typename G::LocalIdSet::IdType, T > >
63
{
64
typedef
PersistentContainerMap< G, typename G::LocalIdSet, std::unordered_map< typename G::LocalIdSet::IdType, T >
> Base;
65
66
public
:
67
typedef
typename
Base::Grid
Grid
;
68
typedef
typename
Base::Value
Value
;
69
70
PersistentContainer
(
const
Grid
&
grid
,
int
codim,
const
Value
&value )
71
: Base(
grid
, codim,
grid
.localIdSet(), value )
72
{}
73
};
74
75
}
// namespace Dune
76
77
#endif
// #if 0
78
79
namespace
std
80
{
81
82
template
<
class
G,
class
T >
83
inline
void
swap
(
Dune::PersistentContainer< G, T >
&a,
Dune::PersistentContainer< G, T >
&b )
84
{
85
a.
swap
( b );
86
}
87
88
}
// namespace std
89
90
#endif
// #ifndef DUNE_PERSISTENTCONTAINER_HH
persistentcontainermap.hh
std
STL namespace.
std::swap
void swap(Dune::PersistentContainer< G, T > &a, Dune::PersistentContainer< G, T > &b)
Definition
utility/persistentcontainer.hh:83
Dune
Include standard header files.
Definition
agrid.hh:60
Dune::PersistentContainer< Grid, T >
Dune::PersistentContainer< HostGrid, Coordinate >::Value
Base::Value Value
Definition
utility/persistentcontainer.hh:27
Dune::PersistentContainer< HostGrid, Coordinate >::Grid
Base::Grid Grid
Definition
utility/persistentcontainer.hh:26
Dune::PersistentContainer::PersistentContainer
PersistentContainer(const Grid &grid, int codim, const Value &value=Value())
Definition
utility/persistentcontainer.hh:29
Dune::PersistentContainer< const Grid, T >::Value
Base::Value Value
Definition
utility/persistentcontainer.hh:41
Dune::PersistentContainer< const Grid, T >::PersistentContainer
PersistentContainer(const typename Base::Grid &grid, int codim, const Value &value=Value())
Definition
utility/persistentcontainer.hh:43
Dune::PersistentContainerMap
map-based implementation of the PersistentContainer
Definition
persistentcontainermap.hh:26
Dune::PersistentContainerMap::swap
void swap(This &other)
Definition
persistentcontainermap.hh:97
Dune::PersistentContainerMap::Grid
G Grid
Definition
persistentcontainermap.hh:34
Dune::PersistentContainerMap::Value
Map::mapped_type Value
Definition
persistentcontainermap.hh:36
Dune::PersistentContainer< HostGrid, Coordinate >::grid
const Grid & grid() const
Definition
persistentcontainermap.hh:114
Dune::PersistentContainerMap< G, G::LocalIdSet, std::map< G::LocalIdSet::IdType, T > >::PersistentContainerMap
PersistentContainerMap(const Grid &grid, int codim, const G::LocalIdSet &idSet, const Value &value)
Definition
persistentcontainermap.hh:42
Generated by
1.17.0