3 #ifndef DUNE_PDELAB_GRIDFUNCTIONSPACE_LOCALVECTOR_HH 4 #define DUNE_PDELAB_GRIDFUNCTIONSPACE_LOCALVECTOR_HH 78 template<
typename LFS>
79 void accumulate(
const LFS& lfs, size_type n, value_type v)
82 _container(lfs,n) += _weight * v;
90 template<
typename LFS>
94 _container(lfs,n) += v;
99 : _container(container)
107 return _container.size();
143 return _container.base();
147 const BaseContainer&
base()
const 149 return _container.base();
170 template<
typename T,
typename LFSFlavorTag = AnySpaceTag,
typename W = T>
212 template<
typename LFS>
215 return _container[lfs.localIndex(i)];
224 template<
typename LFS>
225 const_reference
operator()(
const LFS& lfs, size_type i)
const 227 return _container[lfs.localIndex(i)];
233 std::fill(_container.begin(),_container.end(),v);
240 std::transform(_container.begin(),_container.end(),_container.begin(),std::bind1st(std::multiplies<value_type>(),v));
247 return _container.size();
253 _container.resize(size);
259 _container.assign(size,value);
269 const BaseContainer&
base()
const 290 BaseContainer _container;
301 template<
typename T,
typename Tag,
typename W>
320 template<
typename T,
typename Tag,
typename W>
340 #endif // DUNE_PDELAB_GRIDFUNCTIONSPACE_LOCALVECTOR_HH BaseContainer & base()
Returns the storage container of the underlying LocalVector.
Definition: localvector.hh:140
An accumulate-only view on a local vector that automatically takes into account an accumulation weigh...
Definition: localvector.hh:26
WeightedVectorAccumulationView(C &container, weight_type weight)
Constructor.
Definition: localvector.hh:98
void setWeight(weight_type weight)
Resets the weighting coefficient of the view.
Definition: localvector.hh:72
C Container
The type of the underlying LocalVector.
Definition: localvector.hh:31
Container::BaseContainer BaseContainer
The type of the storage container underlying the LocalVector.
Definition: localvector.hh:34
LocalVector & operator=(const value_type &v)
Assigns v to all entries.
Definition: localvector.hh:231
void resetModified()
Resets the modification state of the view to not modified.
Definition: localvector.hh:121
BaseContainer::size_type size_type
The size type of this container.
Definition: localvector.hh:182
void accumulate(const LFS &lfs, size_type n, value_type v)
Applies the current weight to v and adds the result to the n-th degree of freedom of the lfs...
Definition: localvector.hh:79
weight_type weight()
Returns the weight associated with this view.
Definition: localvector.hh:61
reference operator()(const LFS &lfs, size_type i)
Access the value in this container associated with the i-th degree of freedom of the LocalFunctionSpa...
Definition: localvector.hh:213
const BaseContainer & base() const
Returns the underlying, std::vector-like storage container (const version).
Definition: localvector.hh:269
W weight_type
The weight type of this container.
Definition: localvector.hh:195
LocalVector & operator*=(const value_type &v)
Multiplies all entries by v.
Definition: localvector.hh:238
Container::value_type value_type
The value type of the entries.
Definition: localvector.hh:37
For backward compatibility – Do not use this!
Definition: adaptivity.hh:27
const Container & container() const
Returns the container (of type LocalVector) that this view is based on (const version).
Definition: localvector.hh:134
const_reference operator()(const LFS &lfs, size_type i) const
Access the value in this container associated with the i-th degree of freedom of the LocalFunctionSpa...
Definition: localvector.hh:225
A container for storing data associated with the degrees of freedom of a LocalFunctionSpace.
Definition: localvector.hh:171
Container::weight_type weight_type
The type of the weight applied when accumulating contributions.
Definition: localvector.hh:40
size_type size() const
Returns the size of the underlying container.
Definition: localvector.hh:105
void resize(size_type size)
Resize the container.
Definition: localvector.hh:251
WeightedVectorAccumulationView WeightedAccumulationView
Export this type for uniform handling of the containers themselves and their views.
Definition: localvector.hh:44
WeightedVectorAccumulationView< LocalVector > WeightedAccumulationView
An accumulate-only view of this container that automatically applies a weight to all contributions...
Definition: localvector.hh:198
BaseContainer::value_type value_type
The value type of this container.
Definition: localvector.hh:179
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
bool modified() const
Returns whether this view has been written to.
Definition: localvector.hh:111
BaseContainer & base()
Returns the underlying, std::vector-like storage container.
Definition: localvector.hh:263
LocalVector(size_type n)
Construct a LocalVector with size n.
Definition: localvector.hh:279
Container::size_type size_type
The size_type of the underlying container.
Definition: localvector.hh:54
BaseContainer::reference reference
The reference type of this container.
Definition: localvector.hh:185
WeightedAccumulationView weightedAccumulationView(weight_type weight)
Returns a WeighedAccumulationView of this container with the given weight.
Definition: localvector.hh:201
void assign(size_type size, const T &value)
Resize the container to size and assign the passed value to all entries.
Definition: localvector.hh:257
LocalVector()
Default constructor.
Definition: localvector.hh:275
Container & container()
Returns the container (of type LocalVector) that this view is based on.
Definition: localvector.hh:127
std::vector< T > BaseContainer
The type of the underlying storage container.
Definition: localvector.hh:176
BaseContainer::const_reference const_reference
The const reference type of this container.
Definition: localvector.hh:188
void rawAccumulate(const LFS &lfs, size_type n, value_type v)
Adds v to the n-th degree of freedom of the lfs without applying the current weight.
Definition: localvector.hh:91
LocalVector(size_type n, const value_type &v)
Construct a LocalVector with size n and initialize all entries with v.
Definition: localvector.hh:284
const BaseContainer & base() const
Returns the storage container of the underlying LocalVector (const version).
Definition: localvector.hh:147
C & accessBaseContainer(C &c)
Definition: localvector.hh:296
WeightedAccumulationView weightedAccumulationView(weight_type weight)
Returns a WeighedAccumulationView with some weight in addition to this view's weight.
Definition: localvector.hh:48
size_type size() const
The size of the container.
Definition: localvector.hh:245