1#ifndef DUNE_FEM_FUNCTION_COMMON_FUNCTOR_HH
2#define DUNE_FEM_FUNCTION_COMMON_FUNCTOR_HH
8#include <dune/fem/common/hybrid.hh>
9#include <dune/fem/misc/functor.hh>
10#include <dune/fem/space/basisfunctionset/functor.hh>
21 template<
class Vector >
24 LeftAdd (
const Vector &vector )
28 template<
class Value >
29 void operator() (
const std::size_t index, Value &&value )
const
31 value += vector_[ index ];
34 const Vector &vector_;
41 template<
class Vector,
class Scalar >
44 LeftAddScaled (
const Vector &vector,
const Scalar &s )
49 template<
class Value >
50 void operator() (
const std::size_t index, Value &&value )
const
52 axpy( s_, vector_[ index ], std::forward< Value >( value ) );
55 const Vector &vector_;
63 template<
class Vector >
66 LeftAssign (
const Vector &vector )
70 template<
class Value >
71 void operator() (
const std::size_t index, Value &&value )
const
73 value = vector_[ index ];
76 const Vector &vector_;
83 template<
class Vector >
84 struct AssignVectorReference
86 AssignVectorReference ( Vector &vector )
90 template<
class Value >
91 void operator() (
const std::size_t index, Value &&value )
const
93 vector_.bind( index, std::forward< Value > ( value ) );
104 template<
class DofVector,
class Functor >
105 struct DofBlockFunctor
107 typedef typename DofVector::BlockIndices BlockIndices;
108 static constexpr std::size_t blockSize = Hybrid::size( BlockIndices() );
110 DofBlockFunctor ( DofVector &dofVector, Functor functor )
111 : dofVector_( dofVector ), functor_( functor )
114 template <
class GlobalKey >
115 void operator () ( std::size_t local,
const GlobalKey& globalKey )
const
117 Hybrid::forEach( BlockIndices(), [
this, local, &globalKey ] (
auto &&i ) {
118 functor_( local*blockSize + i, dofVector_[ globalKey ][ i ] );
123 DofVector &dofVector_;
131 template<
class DofVector,
class Functor >
132 static inline DofBlockFunctor< DofVector, Functor > dofBlockFunctor ( DofVector &dofVector, Functor functor )
134 return DofBlockFunctor< DofVector, Functor >( dofVector, std::move( functor ) );
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:256
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition: interface.hh:235
Dune namespace.
Definition: alignedallocator.hh:13