dune-grid  2.4.1
persistentcontainerinterface.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_PERSISTENTCONTAINERINTERFACE_HH
4 #define DUNE_PERSISTENTCONTAINERINTERFACE_HH
5 
6 #ifndef HEADERCHECK
7 #error "This header exists for documentation purposes only and should never be included directly."
8 #endif
9 
10 namespace Dune
11 {
12 
51  template< class G, class T >
53  {
55 
56  struct ImplementationDefined;
57 
58  public:
59  typedef G Grid;
60 
61  typedef T Value;
62 
63  typedef ImplementationDefined Size;
64  typedef ImplementationDefined ConstIterator;
65  typedef ImplementationDefined Iterator;
66 
67  // construction
68 
77  PersistentContainerInterface ( Grid &grid, int codim, const Value &value = Value() );
78 
80  PersistentContainerInterface ( const This &other );
81 
83  const This &operator= ( const This &other );
84 
85  // element access
86 
91  template< class Entity >
92  const Value &operator[] ( const Entity &entity ) const;
93 
98  template< class Entity >
99  Value &operator[] ( const Entity &entity );
100 
106  template< class Entity >
107  const Value &operator() ( const Entity &entity, int subEntity ) const;
108 
114  template< class Entity >
115  Value &operator() ( const Entity &entity, int subEntity );
116 
117  // capacity
118 
124  Size size () const;
125 
139  void resize ( const Value &value = Value() );
140 
154  void shrinkToFit ();
155 
156  // modifiers
157 
163  void fill ( const Value &value );
164 
169  void swap ( This &other );
170 
171  // iterators
172 
178  ConstIterator begin () const;
184  Iterator begin ();
185 
191  ConstIterator end () const;
197  Iterator end ();
198 
199  // information
200 
202  int codimension () const;
203  };
204 
205 } // namespace Dune
206 
207 #endif // #ifndef DUNE_PERSISTENTCONTAINERINTERFACE_HH
ImplementationDefined Size
Definition: persistentcontainerinterface.hh:63
ConstIterator begin() const
returns an iterator pointing to the first element of the container
ImplementationDefined Iterator
Definition: persistentcontainerinterface.hh:65
Persistent storage of data on all entities of a grid.
Definition: persistentcontainerinterface.hh:52
int codimension() const
return the codimension, the container attaches data to
void swap(This &other)
exchange the content of the container with another one
Wrapper class for entities.
Definition: common/entity.hh:61
T Value
Definition: persistentcontainerinterface.hh:61
ImplementationDefined ConstIterator
Definition: persistentcontainerinterface.hh:64
PersistentContainerInterface(Grid &grid, int codim, const Value &value=Value())
constuctor
const This & operator=(const This &other)
assignment operator
ConstIterator end() const
returns an iterator pointing to the last element of the container
const Value & operator[](const Entity &entity) const
access the data associated with an entity
Include standard header files.
Definition: agrid.hh:59
void resize(const Value &value=Value())
reserve memory for all entities in the grid
Size size() const
number of entries in the container
const Value & operator()(const Entity &entity, int subEntity) const
access the data associated with a subentity
void shrinkToFit()
remove unnecessary entries from container
G Grid
Definition: persistentcontainerinterface.hh:56
void fill(const Value &value)
set all accessible entries to a given value