5#ifndef DUNE_PERSISTENTCONTAINERWRAPPER_HH
6#define DUNE_PERSISTENTCONTAINERWRAPPER_HH
8#include <dune/grid/utility/hostgridaccess.hh>
9#include <dune/grid/utility/persistentcontainer.hh>
17 template<
class G,
class T >
18 class PersistentContainerWrapper
20 typedef PersistentContainerWrapper< G, T > This;
24 typedef typename HostGridAccess::HostGrid HostGrid;
30 typedef typename PersistentContainer< HostGrid, T >::Value Value;
31 typedef typename PersistentContainer< HostGrid, T >::Size Size;
33 typedef typename PersistentContainer< HostGrid, T >::Iterator Iterator;
34 typedef typename PersistentContainer< HostGrid, T >::ConstIterator ConstIterator;
36 PersistentContainerWrapper (
const Grid &grid,
int codim,
const Value &value = Value() )
37 : hostContainer_( HostGridAccess::hostGrid( grid ), codim, value )
40 template<
class Entity >
41 const Value &operator[] (
const Entity &entity )
const
43 return hostContainer_[ HostGridAccess::hostEntity( entity ) ];
46 template<
class Entity >
47 Value &operator[] (
const Entity &entity )
49 return hostContainer_[ HostGridAccess::hostEntity( entity ) ];
52 template<
class Entity >
53 const Value &operator() (
const Entity &entity,
int subEntity )
const
55 return hostContainer_( HostGridAccess::hostEntity( entity ), subEntity );
58 template<
class Entity >
59 Value &operator() (
const Entity &entity,
int subEntity )
61 return hostContainer_( HostGridAccess::hostEntity( entity ), subEntity );
64 Size size ()
const {
return hostContainer_.size(); }
66 void resize (
const Value &value = Value() ) { hostContainer_.resize( value ); }
67 void shrinkToFit () {
return hostContainer_.shrinkToFit(); }
69 void fill (
const Value &value = Value() ) { hostContainer_.fill( value ); }
71 void swap ( This &other ) { hostContainer_.swap( other.hostContainer_ ); }
73 ConstIterator begin ()
const {
return hostContainer_.begin(); }
74 Iterator begin () {
return hostContainer_.begin(); }
76 ConstIterator end ()
const {
return hostContainer_.end(); }
77 Iterator end () {
return hostContainer_.end(); }
79 int codimension ()
const {
return hostContainer_.codimension(); }
Dune namespace.
Definition: alignedallocator.hh:13
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37