30 #if !defined( __FEELPP_VF_OPERATORS3_HPP )
31 #define __FEELPP_VF_OPERATORS3_HPP 1
33 # include <boost/preprocessor/stringize.hpp>
40 template <
typename LeftExprType,
typename RightExprType>
45 static const size_type context = LeftExprType::context|RightExprType::context;
47 static const uint16_type imorder = LeftExprType::imorder + RightExprType::imorder;
48 static const bool imIsPoly = LeftExprType::imIsPoly && RightExprType::imIsPoly;
50 typedef LeftExprType left_expression_type;
51 typedef RightExprType right_expression_type;
52 typedef OpDot<LeftExprType, RightExprType> this_type;
53 typedef this_type self_type;
54 typedef typename mpl::if_<mpl::greater<mpl::sizeof_<typename left_expression_type::value_type>,
55 mpl::sizeof_<typename right_expression_type::value_type> >,
56 mpl::identity<typename left_expression_type::value_type>,
57 mpl::identity<typename right_expression_type::value_type> >::type::type value_type;
59 OpDot ( left_expression_type
const& left,
60 right_expression_type
const& right )
65 DVLOG(2) <<
"[" BOOST_PP_STRINGIZE( OpDot )
"] default constructor\n";
68 OpDot( OpDot
const& op )
71 M_right ( op.M_right )
73 DVLOG(2) <<
"[" BOOST_PP_STRINGIZE( OpDot )
"] copy constructor\n";
77 left_expression_type
const& left()
const
81 right_expression_type
const& right()
const
86 template<
typename Geo_t,
typename Basis_i_t,
typename Basis_j_t = Basis_i_t>
89 typedef this_type expression_type;
90 typedef typename LeftExprType::template tensor<Geo_t, Basis_i_t, Basis_j_t> l_type;
91 typedef typename RightExprType::template tensor<Geo_t, Basis_i_t, Basis_j_t> r_type;
92 typedef typename strongest_numeric_type<
typename l_type::value_type,
93 typename r_type::value_type>::type value_type;
94 BOOST_STATIC_ASSERT( ( boost::is_same<
typename l_type::return_value_type,
95 typename r_type::return_value_type>::value ) );
97 typedef typename l_type::return_value_type return_value_type;
99 static const uint16_type rank = return_value_type::rank+1;
100 static const uint16_type nComponents = return_value_type::nComponents;
101 static const bool do_reduction = ( !boost::is_same<return_value_type,typename Basis_i_t::polyset_type>::value||
102 !boost::is_same<return_value_type,typename Basis_j_t::polyset_type>::value );
103 tensor( this_type
const& expr,
105 Basis_i_t
const& fev,
106 Basis_j_t
const& feu )
108 M_left( expr.left(), geom, fev, feu ),
109 M_right( expr.right(), geom, fev, feu )
112 void update( Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& feu )
114 M_left.update( geom, fev, feu );
115 M_right.update( geom, fev, feu );
117 void update( Geo_t
const& geom, Basis_i_t
const& fev )
119 M_left.update( geom, fev );
120 M_right.update( geom, fev );
122 void update( Geo_t
const& geom )
124 M_left.update( geom );
125 M_right.update( geom );
130 operator()( uint16_type i,
134 return this->operator()( i, j, q, mpl::bool_<do_reduction>() );
140 operator()( uint16_type i,
143 mpl::bool_<true> )
const
147 std::cout <<
"[dot] rank = "<< rank <<
" nc=" << return_value_type::nComponentsLast <<
"\n"
148 <<
"[dot] ranki= "<< uint16_type::rank <<
" rankj = "<< uint16_type::rank <<
"\n";
150 typename Basis_i_t::template Index<rank> i_up ( i );
151 typename Basis_i_t::template Index<rank> j_up ( j );
155 BOOST_MPL_ASSERT_MSG( rank == uint16_type::rank+1, INVALID_INDEX_RANK, ( mpl::int_<uint16_type::rank>, mpl::int_<rank> ) );
156 BOOST_MPL_ASSERT_MSG( rank == uint16_type::rank+1, INVALID_INDEX_RANK, ( mpl::int_<uint16_type::rank>, mpl::int_<rank> ) );
159 for (
int c = 0; c < return_value_type::nComponentsLast; ++c )
161 i_up.setIndex( rank-1, c );
162 j_up.setIndex( rank-1, c );
163 res += M_left( i_up, j_up, q ) * M_right( i_up, j_up, q );
170 operator()( uint16_type i,
173 mpl::bool_<false> )
const
175 return M_left( i, j, q ) * M_right( i, j, q );
188 left_expression_type
const& M_left;
189 right_expression_type
const& M_right;
191 template <
class LeftExprType,
typename RightExprType>
192 inline Expr< OpDot< LeftExprType, RightExprType> >
193 dot( LeftExprType
const& left, RightExprType
const& right )
195 typedef OpDot<LeftExprType, RightExprType> expr_t;
196 return Expr< expr_t >( expr_t( left, right ) );
size_t size_type
Indices (starting from 0)
Definition: feelcore/feel.hpp:319