1#ifndef DUNE_FEM_OPERATOR_COMMON_TUPLE_HH
2#define DUNE_FEM_OPERATOR_COMMON_TUPLE_HH
7#include <dune/fem/function/tuplediscretefunction.hh>
8#include <dune/fem/operator/common/operator.hh>
18 template<
class ... Operators >
22 namespace __TupleOperatorImp
28 template<
class ... Operators >
31 static_assert( Std::are_all_same<
typename Operators::DomainFunctionType ... >::value,
32 "TupleOperator< ColTraits > needs a common DomainFunction Type." );
33 typedef typename std::tuple_element< 0, std::tuple< Operators ... > >::type::DomainFunctionType DomainFunctionType;
34 typedef TupleDiscreteFunction<
typename Operators::RangeFunctionType ... > RangeFunctionType;
40 template<
class ... Operators >
43 typedef TupleDiscreteFunction<
typename Operators::DomainFunctionType ... > DomainFunctionType;
44 static_assert( Std::are_all_same<
typename Operators::RangeFunctionType ... >::value,
45 "TupleOperator< RowTraits > needs a common RangeFunction Type." );
46 typedef typename std::tuple_element< 0, std::tuple< Operators ... > >::type::RangeFunctionType RangeFunctionType;
55 template<
class ... Operators >
57 :
public Operator< typename __TupleOperatorImp::RowTraits< Operators ... >::DomainFunctionType,
58 typename __TupleOperatorImp::RowTraits< Operators ... >::RangeFunctionType >,
59 public std::tuple< Operators ... >
61 typedef TupleOperator< Operators ... > ThisType;
63 typedef typename __TupleOperatorImp::RowTraits< Operators ... > Traits;
64 typedef Operator< typename Traits::DomainFunctionType, typename Traits::RangeFunctionType > BaseType;
65 typedef std::tuple< Operators ... > TupleType;
71 template<
class ... Args >
72 TupleOperator ( Args&& ... args )
73 : TupleType(
std::forward< Args >( args ) ... )
76 void operator() (
const DomainFunctionType &arg, RangeFunctionType &dest )
const
79 RangeFunctionType tmp( dest );
80 apply( arg, dest, tmp, std::integral_constant< std::size_t, 0 >() );
84 template< std::
size_t I >
85 void apply (
const DomainFunctionType &arg, RangeFunctionType &dest,
86 RangeFunctionType &tmp, std::integral_constant< std::size_t, I > )
const
88 std::get< I >( *
this )( std::get< I >( arg ), tmp );
90 apply( arg, dest, tmp, std::integral_constant< std::size_t, I + 1 >() );
93 void apply (
const DomainFunctionType &arg, RangeFunctionType &dest,
94 RangeFunctionType &tmp, std::integral_constant< std::size_t,
sizeof ... (Operators ) > )
const
103 template<
class ... Operators >
104 class RowTupleOperator
105 :
public Operator< typename __TupleOperatorImp::ColTraits< Operators ... >::DomainFunctionType,
106 typename __TupleOperatorImp::ColTraits< Operators ... >::RangeFunctionType >,
107 public std::tuple< Operators ... >
109 typedef RowTupleOperator< Operators ... > ThisType;
111 typedef typename __TupleOperatorImp::ColTraits< Operators ... > Traits;
112 typedef Operator< typename Traits::DomainFunctionType, typename Traits::RangeFunctionType > BaseType;
113 typedef std::tuple< Operators ... > TupleType;
119 template<
class ... Args >
120 RowTupleOperator ( Args&& ... args )
121 : TupleType(
std::forward< Args >( args ) ... )
124 void operator() (
const DomainFunctionType &arg, RangeFunctionType &dest )
const
127 apply( arg, dest, std::integral_constant< std::size_t, 0 >() );
131 template< std::
size_t I >
132 void apply (
const DomainFunctionType &arg, RangeFunctionType &dest, std::integral_constant< std::size_t, I > )
const
134 std::get< I >( *
this )( arg, std::get< I >( dest ) );
135 apply( arg, dest, std::integral_constant< std::size_t, I + 1 >() );
138 void apply (
const DomainFunctionType &arg, RangeFunctionType &dest, std::integral_constant< std::size_t,
sizeof ... (Operators ) > )
const
Dune namespace.
Definition: alignedallocator.hh:13
DomainFunction DomainFunctionType
type of discrete function in the operator's domain
Definition: operator.hh:36
RangeFunction RangeFunctionType
type of discrete function in the operator's range
Definition: operator.hh:38