6 #include <dune/common/std/apply.hh> 8 #include <amdis/common/Apply.hpp> 9 #include <amdis/common/Concepts.hpp> 10 #include <amdis/common/Logical.hpp> 11 #include <amdis/operations/Basic.hpp> 30 template <
class F,
class... Gs>
33 template <
class F_,
class... Gs_,
35 constexpr
Composer(F_&& f, Gs_&&... gs)
40 template <
class... Ts>
41 constexpr
auto operator()(Ts
const&... args)
const 43 auto eval = [&](
auto const& g) {
return g(args...); };
44 return Ranges::apply([&,
this](
auto const&... gs) {
return f_(eval(gs)...); }, gs_);
48 std::tuple<Gs...> gs_;
52 template <
class F,
class... Gs>
57 template <
class F_,
class... Gs_>
58 static constexpr
type build(F_&& f, Gs_&&... gs)
60 return type{FWD(f), FWD(gs)...};
66 template <
class F,
class... Gs>
67 constexpr
auto compose(F&& f, Gs&&... gs)
69 return ComposerBuilder<TYPEOF(f), TYPEOF(gs)...>::build(FWD(f), FWD(gs)...);
73 template <
class F,
class... Gs,
class... Int,
74 REQUIRES(Concepts::HasFunctorOrder<F,
sizeof...(Gs)>
75 && (Concepts::HasFunctorOrder<Gs,
sizeof...(Int)> &&...))>
78 auto deg = [&](
auto const& g) {
return order(g,
int(degrees)...); };
79 return Ranges::apply([&](
auto const&... gs) {
return order(c.f_, deg(gs)...); }, c.gs_);
84 template <
int J,
class F,
class... Gs>
98 static constexpr F build(F_&& f)
Composition of Functors.
Definition: Composer.hpp:31
A variadic type list.
Definition: TypeTraits.hpp:88
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
auto order(F const &f) -> decltype(&F::operator(), f.order())
polynomial order of functions
Definition: Order.hpp:11
constexpr bool Similar
Types are the same, up to decay of qualifiers.
Definition: Concepts.hpp:108
std::integral_constant< std::size_t, I > index_t
A wrapper for std::size_t type.
Definition: Index.hpp:31
Definition: Composer.hpp:53
(Unary-)Functor representing the identity
Definition: Basic.hpp:64