1#ifndef __DUNE_ACFEM_FUNCTOR_HH__
2#define __DUNE_ACFEM_FUNCTOR_HH__
16 template<
class LocalArray,
class GlobalArray>
20 const GlobalArray& globalArray)
21 : localArray_(localArray), globalArray_(globalArray)
24 template<
class GlobalKey>
25 void operator()(
const std::size_t local,
const GlobalKey &global)
const
27 localArray_[local] = globalArray_[global];
31 LocalArray& localArray_;
32 const GlobalArray& globalArray_;
39 template<
class T,
class GlobalArray>
43 const GlobalArray& globalArray)
44 : localArray_(localArray), globalArray_(globalArray)
47 template<
class GlobalKey>
48 void operator()(
const std::size_t local,
const GlobalKey &global)
const
50 localArray_[local] = globalArray_[global];
55 const GlobalArray& globalArray_;
61 template<
class FunctorOne,
class FunctorTwo>
64 explicit PairFunctor(FunctorOne&& one, FunctorTwo&& two)
65 : one_(one), two_(two)
69 void operator()(
const std::size_t local,
const Value& value)
const
86 template<
class FunctorOne,
class FunctorTwo>
90 std::forward<FunctorTwo>(func2));
97 template<
class... Types>
100 typedef std::tuple<Types&...> TupleType;
106 template<
class Value>
107 void operator()(
const std::size_t local,
const Value& value)
const
109 FunctorHelper<TupleType, std::tuple_size<TupleType>::value-1>::apply(
110 functorTuple_, local, value);
114 template<
class Tuple,
unsigned index>
117 template<
class Value>
118 static void apply(
const Tuple& tuple,
const std::size_t local,
const Value& value)
120 FunctorHelper<Tuple, index - 1>::apply(tuple, local, value);
121 std::get<index>(tuple)(local, value);
124 template<
class Tuple>
125 struct FunctorHelper<Tuple, 0>
127 template<
class Value>
128 static void apply(
const Tuple& tuple,
const std::size_t local,
const Value& value)
130 std::get<0>(tuple)(local, value);
134 const TupleType functorTuple_;
141 template<
class... Types>
145 return TupleFunctor<Types...>(std::forward_as_tuple(args...));
TupleFunctor< Types... > makeTupleFunctor(Types &&... args)
Combine several functors into one.
Definition: functor.hh:142
PairFunctor< FunctorOne, FunctorTwo > makePairFunctor(FunctorOne &&func1, FunctorTwo &&func2)
Combine two functors into one.
Definition: functor.hh:87
Generate a compound functor out of two functors.
Definition: functor.hh:63
Generate a compound functor out of a tuple of functors.
Definition: functor.hh:99