dune-grid  2.6-git
persistentcontainerwrapper.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_PERSISTENTCONTAINERWRAPPER_HH
4 #define DUNE_PERSISTENTCONTAINERWRAPPER_HH
5 
8 
9 namespace Dune
10 {
11 
12  // PersistentContainerWrapper
13  // --------------------------
14 
15  template< class G, class T >
17  {
19 
21 
22  typedef typename HostGridAccess::HostGrid HostGrid;
24 
25  public:
26  typedef G Grid;
27 
30 
33 
34  PersistentContainerWrapper ( const Grid &grid, int codim, const Value &value = Value() )
35  : hostContainer_( HostGridAccess::hostGrid( grid ), codim, value )
36  {}
37 
38  template< class Entity >
39  const Value &operator[] ( const Entity &entity ) const
40  {
41  return hostContainer_[ HostGridAccess::hostEntity( entity ) ];
42  }
43 
44  template< class Entity >
45  Value &operator[] ( const Entity &entity )
46  {
47  return hostContainer_[ HostGridAccess::hostEntity( entity ) ];
48  }
49 
50  template< class Entity >
51  const Value &operator() ( const Entity &entity, int subEntity ) const
52  {
53  return hostContainer_( HostGridAccess::hostEntity( entity ), subEntity );
54  }
55 
56  template< class Entity >
57  Value &operator() ( const Entity &entity, int subEntity )
58  {
59  return hostContainer_( HostGridAccess::hostEntity( entity ), subEntity );
60  }
61 
62  Size size () const { return hostContainer_.size(); }
63 
64  void resize ( const Value &value = Value() ) { hostContainer_.resize( value ); }
65  void shrinkToFit () { return hostContainer_.shrinkToFit(); }
66 
67  void fill ( const Value &value = Value() ) { hostContainer_.fill( value ); }
68 
69  void swap ( This &other ) { hostContainer_.swap( other.hostContainer_ ); }
70 
71  ConstIterator begin () const { return hostContainer_.begin(); }
72  Iterator begin () { return hostContainer_.begin(); }
73 
74  ConstIterator end () const { return hostContainer_.end(); }
75  Iterator end () { return hostContainer_.end(); }
76 
77  int codimension () const { return hostContainer_.codimension(); }
78 
79  protected:
81  };
82 
83 } // namespace Dune
84 
85 #endif // #ifndef DUNE_PERSISTENTCONTAINERWRAPPER_HH
Include standard header files.
Definition: agrid.hh:58
void swap(This &other)
Definition: persistentcontainermap.hh:94
void shrinkToFit()
Definition: persistentcontainerwrapper.hh:65
PersistentContainerWrapper(const Grid &grid, int codim, const Value &value=Value())
Definition: persistentcontainerwrapper.hh:34
Iterator end()
Definition: persistentcontainerwrapper.hh:75
void resize(const Value &value=Value())
Definition: persistentcontainerwrapper.hh:64
Iterator begin()
Definition: persistentcontainerwrapper.hh:72
PersistentContainer< HostGrid, T >::Value Value
Definition: persistentcontainerwrapper.hh:28
PersistentContainer< HostGrid, T >::Size Size
Definition: persistentcontainerwrapper.hh:29
Wrapper class for entities.
Definition: common/entity.hh:63
void fill(const Value &value)
Definition: persistentcontainermap.hh:92
ConstIterator begin() const
Definition: persistentcontainerwrapper.hh:71
PersistentContainer< HostGrid, T >::ConstIterator ConstIterator
Definition: persistentcontainerwrapper.hh:32
ConstIterator end() const
Definition: persistentcontainerwrapper.hh:74
ConstIterator end() const
Definition: persistentcontainermap.hh:187
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:36
int codimension() const
Definition: persistentcontainermap.hh:108
int codimension() const
Definition: persistentcontainerwrapper.hh:77
void resize(const Value &value=Value())
Definition: persistentcontainermap.hh:84
void fill(const Value &value=Value())
Definition: persistentcontainerwrapper.hh:67
Size size() const
Definition: persistentcontainermap.hh:82
const Value & operator()(const Entity &entity, int subEntity) const
Definition: persistentcontainerwrapper.hh:51
const Value & operator[](const Entity &entity) const
Definition: persistentcontainerwrapper.hh:39
void shrinkToFit()
Definition: persistentcontainermap.hh:90
ConstIterator begin() const
Definition: persistentcontainermap.hh:172
PersistentContainer< HostGrid, T >::Iterator Iterator
Definition: persistentcontainerwrapper.hh:31
G Grid
Definition: persistentcontainerwrapper.hh:26
Definition: persistentcontainerwrapper.hh:16
void swap(This &other)
Definition: persistentcontainerwrapper.hh:69
Size size() const
Definition: persistentcontainerwrapper.hh:62
PersistentContainer< HostGrid, T > hostContainer_
Definition: persistentcontainerwrapper.hh:80