1#ifndef __DUNE_ACFEM_FUNCTOR_HH__
2#define __DUNE_ACFEM_FUNCTOR_HH__
20 template<
class LocalArray,
class GlobalArray>
24 const GlobalArray& globalArray)
25 : localArray_(localArray), globalArray_(globalArray)
28 template<
class GlobalKey>
29 void operator()(
const std::size_t local,
const GlobalKey &global)
const
31 localArray_[local] = globalArray_[global];
35 LocalArray& localArray_;
36 const GlobalArray& globalArray_;
43 template<
class T,
class GlobalArray>
47 const GlobalArray& globalArray)
48 : localArray_(localArray), globalArray_(globalArray)
51 template<
class GlobalKey>
52 void operator()(
const std::size_t local,
const GlobalKey &global)
const
54 localArray_[local] = globalArray_[global];
59 const GlobalArray& globalArray_;
65 template<
class FunctorOne,
class FunctorTwo>
69 : one_(
one), two_(two)
73 void operator()(
const std::size_t local,
const Value& value)
const
90 template<
class FunctorOne,
class FunctorTwo>
94 std::forward<FunctorTwo>(func2));
101 template<
class... Types>
104 typedef std::tuple<Types&...> TupleType;
110 template<
class Value>
111 void operator()(
const std::size_t local,
const Value& value)
const
113 FunctorHelper<TupleType, std::tuple_size<TupleType>::value-1>::apply(
114 functorTuple_, local, value);
118 template<
class Tuple,
unsigned index>
121 template<
class Value>
122 static void apply(
const Tuple& tuple,
const std::size_t local,
const Value& value)
124 FunctorHelper<Tuple, index - 1>::apply(tuple, local, value);
125 std::get<index>(tuple)(local, value);
128 template<
class Tuple>
129 struct FunctorHelper<Tuple, 0>
131 template<
class Value>
132 static void apply(
const Tuple& tuple,
const std::size_t local,
const Value& value)
134 std::get<0>(tuple)(local, value);
138 const TupleType functorTuple_;
145 template<
class... Types>
149 return TupleFunctor<Types...>(std::forward_as_tuple(std::forward<Types>(args)...));
TupleFunctor< Types... > makeTupleFunctor(Types &&... args)
Combine several functors into one.
Definition: functor.hh:146
PairFunctor< FunctorOne, FunctorTwo > makePairFunctor(FunctorOne &&func1, FunctorTwo &&func2)
Combine two functors into one.
Definition: functor.hh:91
constexpr auto one(T &&t)
Use the one fraction as canonical zero element for scalars.
Definition: constantoperations.hh:88
Generate a compound functor out of two functors.
Definition: functor.hh:67
Generate a compound functor out of a tuple of functors.
Definition: functor.hh:103