3#ifndef DUNE_PERSISTENTCONTAINERVECTOR_HH 
    4#define DUNE_PERSISTENTCONTAINERVECTOR_HH 
   47  template< 
class G, 
class IndexSet, 
class Vector >
 
   55    typedef typename Vector::value_type Value;
 
   56    typedef typename Vector::size_type Size;
 
   57    typedef typename Vector::const_iterator ConstIterator;
 
   58    typedef typename Vector::iterator Iterator;
 
   60    typedef typename Vector::allocator_type Allocator;
 
   63                                const Allocator &allocator = Allocator() )
 
   65        indexSet_( &indexSet ),
 
   66        data_( indexSet.size( codim ), value, allocator )
 
   69    template< 
class Entity >
 
   70    const Value &operator[] ( 
const Entity &entity )
 const 
   73      const Size index = indexSet().
index( entity );
 
   74      assert( index < data_.size() );
 
   75      return data_[ index ];
 
   78    template< 
class Entity >
 
   79    Value &operator[] ( 
const Entity &entity )
 
   82      const Size index = indexSet().
index( entity );
 
   83      assert( index < data_.size() );
 
   84      return data_[ index ];
 
   87    template< 
class Entity >
 
   88    const Value &operator() ( 
const Entity &entity, 
int subEntity )
 const 
   90      const Size index = indexSet().
subIndex( entity, subEntity, codimension() );
 
   91      assert( index < data_.size() );
 
   92      return data_[ index ];
 
   95    template< 
class Entity >
 
   96    Value &operator() ( 
const Entity &entity, 
int subEntity )
 
   98      const Size index = indexSet().
subIndex( entity, subEntity, codimension() );
 
   99      assert( index < data_.size() );
 
  100      return data_[ index ];
 
  103    Size size ()
 const { 
return data_.size(); }
 
  105    void resize ( 
const Value &value = Value() )
 
  107      const Size indexSetSize = indexSet().size( codimension() );
 
  108      data_.resize( indexSetSize, value );
 
  111    void shrinkToFit () {}
 
  113    void fill ( 
const Value &value ) { std::fill( begin(), end(), value ); }
 
  115    void swap ( 
This &other )
 
  117      std::swap( codim_, other.codim_ );
 
  118      std::swap( indexSet_, other.indexSet_ );
 
  119      std::swap( data_, other.data_ );
 
  122    ConstIterator begin ()
 const { 
return data_.begin(); }
 
  123    Iterator begin () { 
return data_.begin(); }
 
  125    ConstIterator end ()
 const { 
return data_.end(); }
 
  126    Iterator end () { 
return data_.end(); }
 
  128    int codimension ()
 const { 
return codim_; }
 
  131    const IndexSet &indexSet ()
 const { 
return *indexSet_; }
 
Wrapper class for entities.
Definition: entity.hh:62
 
@ codimension
Know your own codimension.
Definition: entity.hh:104
 
Index Set Interface base class.
Definition: indexidset.hh:76
 
IndexType subIndex(const typename Traits::template Codim< cc >::Entity &e, int i, unsigned int codim) const
Map a subentity to an index.
Definition: indexidset.hh:153
 
IndexType index(const typename Traits::template Codim< cc >::Entity &e) const
Map entity to index. The result of calling this method with an entity that is not in the index set is...
Definition: indexidset.hh:115
 
vector-based implementation of the PersistentContainer
Definition: persistentcontainervector.hh:49
 
Dune namespace.
Definition: alignment.hh:10