1#ifndef DUNE_FEM_REFERENCEVECTOR_HH
2#define DUNE_FEM_REFERENCEVECTOR_HH
13#include <dune/fem/misc/bartonnackmaninterface.hh>
21 template<
class K,
class A = std::allocator< K* > >
22 class DynamicReferenceVector;
26 template<
class K,
class A >
27 struct DenseMatVecTraits< Fem::DynamicReferenceVector< K, A > >
29 typedef Fem::DynamicReferenceVector< K, A > derived_type;
30 typedef std::vector< K*, typename A::template rebind< K* >::other > container_type;
33 typedef typename container_type::size_type size_type;
36 template<
class K,
class A >
37 struct FieldTraits< Fem::DynamicReferenceVector< K, A > >
39 typedef typename FieldTraits< K >::field_type field_type;
40 typedef typename FieldTraits< K >::real_type real_type;
51 template<
class K,
class A >
60 typedef value_type FieldType;
61 typedef typename DenseMatVecTraits< ThisType >::container_type DofStorageType;
70 : data_( n, nullptr, a )
81 : data_(
std::move( other.data_ ) )
88 ThisType& operator= (
const value_type& k)
90 for (size_type i=0; i<size(); i++)
98 assert( data_.size() == other.
size() );
103 ThisType & operator= (
const ThisType &other )
105 assert( data_.size() == other.size() );
110 ThisType & operator= ( ThisType &&other )
112 data_ = std::move( other.data_ );
116 size_type capacity ()
const
118 return data_.capacity();
121 void resize ( size_type n )
123 data_.resize( n,
nullptr );
126 void reserve ( size_type n )
132 void bind ( size_type i, K& u )
134 assert( i < data_.size() );
141 asssert( i < data_.size() );
142 data_[ i ] =
nullptr;
145 size_type size ()
const
150 value_type &operator[] ( size_type i )
155 const value_type &operator[] ( size_type i )
const
162 for (std::size_t i=0;i<size();++i)
167 DofStorageType data_;
Interface for a class of dense vectors over a given field.
Definition: densevector.hh:229
Traits::value_type value_type
export the type representing the field
Definition: densevector.hh:250
Iterator begin()
begin iterator
Definition: densevector.hh:347
size_type size() const
size method
Definition: densevector.hh:336
Iterator end()
end iterator
Definition: densevector.hh:353
Traits::size_type size_type
The type used for the index access and size operation.
Definition: densevector.hh:259
An implementation of DenseVector which uses a std::vector of references as storage.
Definition: referencevector.hh:53
DynamicReferenceVector(ThisType &&other)
Move constructor.
Definition: referencevector.hh:80
void unbind(size_type i)
Unbind i-th entry.
Definition: referencevector.hh:139
DynamicReferenceVector(const ThisType &other)
Copy constructor.
Definition: referencevector.hh:74
DynamicReferenceVector(const A &a=A())
Constructor with uninitialized vector.
Definition: referencevector.hh:64
DynamicReferenceVector(size_type n, const A &a=A())
Constructor with uninitialized vector of size n.
Definition: referencevector.hh:69
void bind(size_type i, K &u)
Bind i-th entry to a reference.
Definition: referencevector.hh:132
Implements the dense vector interface, with an exchangeable storage class.
Type traits to determine the type of reals (when working with complex numbers)
Dune namespace.
Definition: alignedallocator.hh:13