30 #define __TwoValued_H 1
33 #include <boost/fusion/container/generation/make_map.hpp>
47 template<
typename ExprT>
52 static const size_type context = ExprT::context;
53 static const bool is_terminal =
false;
55 static const uint16_type imorder = ExprT::imorder;
56 static const bool imIsPoly = ExprT::imIsPoly;
58 template<
typename Func>
59 struct HasTestFunction
61 static const bool result =
false;
64 template<
typename Func>
65 struct HasTrialFunction
67 static const bool result =
false;
75 typedef ExprT expression_type;
76 typedef typename expression_type::value_type value_type;
77 typedef SumvExpr<ExprT> this_type;
85 explicit SumvExpr( expression_type
const & __expr )
98 template<
typename Geo_t,
typename Basis_i_t = fusion::map<fusion::pair<vf::detail::gmc<0>,boost::shared_ptr<vf::detail::gmc<0> > > >,
typename Basis_j_t = Basis_i_t>
101 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
104 typedef typename mpl::if_<mpl::equal_to<map_size,mpl::int_<2> >,
106 vf::detail::gmc<0> >::type gmc1;
108 typedef typename fusion::result_of::value_at_key<Geo_t,vf::detail::gmc<0> >::type left_gmc_ptrtype;
109 typedef typename fusion::result_of::value_at_key<Geo_t,vf::detail::gmc<0> >::type::element_type left_gmc_type;
110 typedef typename fusion::result_of::value_at_key<Geo_t,gmc1 >::type right_gmc_ptrtype;
111 typedef typename fusion::result_of::value_at_key<Geo_t,gmc1 >::type::element_type right_gmc_type;
113 typedef fusion::map<fusion::pair<vf::detail::gmc<0>, left_gmc_ptrtype> > map_left_gmc_type;
114 typedef fusion::map<fusion::pair<vf::detail::gmc<0>, right_gmc_ptrtype> > map_right_gmc_type;
116 typedef typename expression_type::template tensor<map_left_gmc_type, Basis_i_t, Basis_j_t> left_tensor_expr_type;
117 typedef typename expression_type::template tensor<map_right_gmc_type, Basis_i_t, Basis_j_t> right_tensor_expr_type;
118 typedef typename left_tensor_expr_type::value_type value_type;
120 typedef typename left_tensor_expr_type::shape shape;
124 static const bool value =
false;
127 template <
class Args>
struct sig
129 typedef value_type type;
132 tensor( this_type
const& expr,
133 Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& feu )
135 M_gmc_left( fusion::at_key<vf::detail::gmc<0> >( geom ) ),
136 M_gmc_right( fusion::at_key<gmc1 >( geom ) ),
137 M_left_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_left ) ),
138 M_right_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_right ) ),
139 M_tensor_expr_left( expr.expression(), M_left_map, fev, feu ),
140 M_tensor_expr_right( expr.expression(), M_right_map, fev, feu )
143 tensor( this_type
const& expr,
144 Geo_t
const& geom, Basis_i_t
const& fev )
146 M_gmc_left( fusion::at_key<vf::detail::gmc<0> >( geom ) ),
147 M_gmc_right( fusion::at_key<gmc1 >( geom ) ),
148 M_left_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_left ) ),
149 M_right_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_right ) ),
150 M_tensor_expr_left( expr.expression(), M_left_map, fev ),
151 M_tensor_expr_right( expr.expression(), M_right_map, fev )
154 tensor( this_type
const& expr, Geo_t
const& geom )
156 M_gmc_left( fusion::at_key<vf::detail::gmc<0> >( geom ) ),
157 M_gmc_right( fusion::at_key<gmc1 >( geom ) ),
158 M_left_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_left ) ),
159 M_right_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_right ) ),
160 M_tensor_expr_left( expr.expression(), M_left_map ),
161 M_tensor_expr_right( expr.expression(), M_right_map )
165 template<
typename IM>
166 void init( IM
const& im )
168 M_tensor_expr_left.init( im );
169 M_tensor_expr_right.init( im );
171 void update( Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& feu )
173 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
174 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
176 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
177 M_gmc_right = fusion::at_key<gmc1 >( geom );
178 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
180 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
181 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
182 M_tensor_expr_left.update( M_left_map );
183 M_tensor_expr_right.update( M_right_map );
185 void update( Geo_t
const& geom, Basis_i_t
const& fev )
187 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
188 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
190 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
191 M_gmc_right = fusion::at_key<gmc1 >( geom );
192 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
194 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
195 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
196 M_tensor_expr_left.update( M_left_map );
197 M_tensor_expr_right.update( M_right_map );
199 void update( Geo_t
const& geom )
201 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
202 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
204 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
205 M_gmc_right = fusion::at_key<gmc1 >( geom );
206 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
208 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
209 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
210 M_tensor_expr_left.update( M_left_map );
211 M_tensor_expr_right.update( M_right_map );
215 void update( Geo_t
const& geom, uint16_type face )
217 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
218 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
220 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
221 M_gmc_right = fusion::at_key<gmc1 >( geom );
222 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
224 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
225 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
226 M_tensor_expr_left.update( M_left_map, face );
227 M_tensor_expr_right.update( M_right_map, face );
234 evalij( uint16_type i, uint16_type j )
const
236 return M_tensor_expr_left.evalij( i, j ) + M_tensor_expr_right.evalij( i, j );
241 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q )
const
243 return M_tensor_expr_left.evalq( c1, c2, q ) + M_tensor_expr_right.evalq( c1, c2, q );
245 template<
int PatternContext>
247 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
248 mpl::int_<PatternContext> )
const
250 return M_tensor_expr_left.evalq( c1, c2, q, mpl::int_<PatternContext>() ) +
251 M_tensor_expr_right.evalq( c1, c2, q, mpl::int_<PatternContext>() );
256 evaliq( uint16_type i, uint16_type c1, uint16_type c2, uint16_type q )
const
260 Feel::detail::ignore_unused_variable_warning( i );
261 value_type resl = M_tensor_expr_left.evalq( c1, c2, q );
262 value_type resr = M_tensor_expr_right.evalq( c1, c2, q );
263 value_type res = resl + resr;
271 evalq( uint16_type c1, uint16_type c2, uint16_type q )
const
275 return M_tensor_expr_left.evalq( c1, c2, q )+M_tensor_expr_right.evalq( c1, c2, q );
279 left_gmc_ptrtype M_gmc_left;
280 right_gmc_ptrtype M_gmc_right;
281 map_left_gmc_type M_left_map;
282 map_right_gmc_type M_right_map;
283 left_tensor_expr_type M_tensor_expr_left;
284 right_tensor_expr_type M_tensor_expr_right;
293 bool isSymetric()
const
295 return M_expr.isSymetric();
298 expression_type
const& expression()
const
321 expression_type M_expr;
333 template<
typename ExprT,
int S
ide>
338 static const size_type context = ExprT::context;
339 static const bool is_terminal =
false;
341 static const uint16_type imorder = ExprT::imorder;
342 static const bool imIsPoly = ExprT::imIsPoly;
344 template<
typename Func>
345 struct HasTestFunction
347 static const bool result = ExprT::template HasTestFunction<Func>::result;
350 template<
typename Func>
351 struct HasTrialFunction
353 static const bool result =
false;
361 typedef ExprT expression_type;
362 typedef typename expression_type::value_type value_type;
363 typedef SumExpr<ExprT,Side> this_type;
371 explicit SumExpr( expression_type
const & __expr )
384 template<
typename Geo_t,
typename Basis_i_t,
typename Basis_j_t>
387 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
390 typedef typename mpl::if_<mpl::equal_to<map_size,mpl::int_<2> >,
392 vf::detail::gmc<0> >::type gmc1;
394 typedef typename mpl::if_<typename fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<0> >,
395 mpl::identity<vf::detail::gmc<0> >,
396 mpl::identity<vf::detail::gmc<1> > >::type::type key_type;
400 typedef typename T::geometric_mapping_context_type type;
404 typedef typename fusion::result_of::value_at_key<Geo_t,key_type >::type::element_type type;
406 typedef typename fusion::result_of::value_at_key<Basis_i_t,key_type >::type::element_type e_type;
407 typedef typename mpl::if_<boost::is_same<e_type,key_type >,
409 mpl::identity<ttt<e_type> > >::type::type::type gmc_type;
411 typedef boost::shared_ptr<gmc_type> gmc_ptrtype;
414 typedef fusion::map<fusion::pair<key_type, gmc_ptrtype> > map_gmc_type;
416 typedef typename expression_type::template tensor<map_gmc_type, Basis_i_t, Basis_j_t> tensor_expr_type;
418 typedef typename tensor_expr_type::value_type value_type;
420 typedef typename tensor_expr_type::shape shape;
422 template <
class Args>
struct sig
424 typedef value_type type;
429 static const bool value = !fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<Side> >::value;
433 tensor( this_type
const& expr,
434 Geo_t
const& , Basis_i_t
const& fev, Basis_j_t
const& )
436 M_gmc( fusion::at_key<key_type >( fev )->gmContext() ),
437 M_map( fusion::make_map<key_type >( M_gmc ) ),
438 M_tensor_expr( expr.expression(), M_map, fev )
440 DVLOG(2) <<
"expr SumExpr<" << Side <<
"> is_zero " << is_zero::value <<
"\n";
443 tensor( this_type
const& expr,
444 Geo_t
const& , Basis_i_t
const& fev )
446 M_gmc( fusion::at_key<key_type >( fev )->gmContext() ),
447 M_map( fusion::make_map<key_type >( M_gmc ) ),
448 M_tensor_expr( expr.expression(), M_map, fev )
450 DVLOG(2) <<
"expr SumExpr is_zero " << is_zero::value <<
"\n";
453 template<
typename IM>
454 void init( IM
const& im )
456 M_tensor_expr.init( im );
458 void update( Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& )
460 update( geom, fev, fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<Side> >() );
462 void update( Geo_t
const& geom, Basis_i_t
const& fev )
464 update( geom, fev, fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<Side> >() );
466 void update( Geo_t
const& , Basis_i_t
const& fev, mpl::true_ )
468 M_gmc = fusion::at_key<vf::detail::gmc<Side> >( fev )->gmContext();
469 M_map = fusion::make_map<vf::detail::gmc<Side> >( M_gmc );
470 M_tensor_expr.update( M_map, fev );
472 void update( Geo_t
const& , Basis_i_t
const& , mpl::false_ )
479 evalij( uint16_type i, uint16_type j )
const
481 return M_tensor_expr.evalij( i, j );
486 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q )
const
488 Feel::detail::ignore_unused_variable_warning( j );
489 return evaliq( i, c1, c2, q, fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<Side> >() );
491 template<
int PatternContext>
493 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
494 mpl::int_<PatternContext> )
const
496 Feel::detail::ignore_unused_variable_warning( j );
497 return evaliq( i, c1, c2, q, fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<Side> >() );
502 evaliq( uint16_type i, uint16_type c1, uint16_type c2, uint16_type q )
const
504 return evaliq( i, c1, c2, q, fusion::result_of::has_key<Basis_i_t,vf::detail::gmc<Side> >() );
508 evaliq( uint16_type i, uint16_type c1, uint16_type c2, uint16_type q, mpl::true_ )
const
510 return M_tensor_expr.evaliq( i, c1, c2, q );
514 evaliq( uint16_type i, uint16_type c1, uint16_type c2, uint16_type q, mpl::false_ )
const
516 Feel::detail::ignore_unused_variable_warning( i );
517 Feel::detail::ignore_unused_variable_warning( c1 );
518 Feel::detail::ignore_unused_variable_warning( c2 );
519 Feel::detail::ignore_unused_variable_warning( q );
520 return value_type( 0 );
525 tensor_expr_type M_tensor_expr;
534 bool isSymetric()
const
536 return M_expr.isSymetric();
539 expression_type
const& expression()
const
562 expression_type M_expr;
572 template<
typename ExprT,
int S
ide>
577 static const size_type context = ExprT::context;
578 static const bool is_terminal =
false;
580 static const uint16_type imorder = ExprT::imorder;
581 static const bool imIsPoly = ExprT::imIsPoly;
583 template<
typename Func>
584 struct HasTestFunction
586 static const bool result =
false;
589 template<
typename Func>
590 struct HasTrialFunction
592 static const bool result = ExprT::template HasTrialFunction<Func>::result;
599 typedef ExprT expression_type;
600 typedef typename expression_type::value_type value_type;
601 typedef SumTExpr<ExprT,Side> this_type;
609 explicit SumTExpr( expression_type
const & __expr )
622 template<
typename Geo_t,
typename Basis_i_t,
typename Basis_j_t>
625 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
628 typedef typename mpl::if_<mpl::equal_to<map_size,mpl::int_<2> >,
630 vf::detail::gmc<0> >::type gmc1;
632 typedef typename mpl::if_<typename fusion::result_of::has_key<Basis_j_t,vf::detail::gmc<0> >,
633 mpl::identity<vf::detail::gmc<0> >,
634 mpl::identity<vf::detail::gmc<1> > >::type::type key_type;
639 typedef typename T::geometric_mapping_context_type type;
643 typedef typename fusion::result_of::value_at_key<Geo_t,key_type >::type::element_type type;
645 typedef typename fusion::result_of::value_at_key<Basis_j_t,key_type >::type::element_type e_type;
646 typedef typename mpl::if_<boost::is_same<e_type,key_type >,
648 mpl::identity<ttt<e_type> > >::type::type::type gmc_type;
650 typedef boost::shared_ptr<gmc_type> gmc_ptrtype;
652 typedef fusion::map<fusion::pair<key_type, gmc_ptrtype> > map_gmc_type;
654 typedef typename expression_type::template tensor<map_gmc_type, Basis_i_t, Basis_j_t> tensor_expr_type;
656 typedef typename tensor_expr_type::value_type value_type;
658 typedef typename tensor_expr_type::shape shape;
660 template <
class Args>
struct sig
662 typedef value_type type;
667 static const bool value = !fusion::result_of::has_key<Basis_j_t,vf::detail::gmc<Side> >::value;
671 tensor( this_type
const& expr,
672 Geo_t
const& , Basis_i_t
const& fev, Basis_j_t
const& feu )
674 M_gmc( fusion::at_key<key_type>( feu )->gmContext() ),
675 M_map( fusion::make_map<key_type>( M_gmc ) ),
676 M_tensor_expr( expr.expression(), M_map, fev, feu )
678 DVLOG(2) <<
"expr SumTExpr<" << Side <<
"> is_zero " << is_zero::value <<
"\n";
681 template<
typename IM>
682 void init( IM
const& im )
684 M_tensor_expr.init( im );
686 void update( Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& feu )
688 update( geom, fev, feu, fusion::result_of::has_key<Basis_j_t,vf::detail::gmc<Side> >() );
690 void update( Geo_t
const& , Basis_i_t
const& fev, Basis_j_t
const& feu, mpl::true_ )
692 M_gmc = fusion::at_key<key_type>( feu )->gmContext();
693 M_map = fusion::make_map<key_type>( M_gmc );
694 M_tensor_expr.update( M_map, fev, feu );
696 void update( Geo_t
const& , Basis_i_t
const& fev, Basis_j_t
const& feu, mpl::false_ )
698 Feel::detail::ignore_unused_variable_warning( fev );
699 Feel::detail::ignore_unused_variable_warning( feu );
704 evalij( uint16_type i, uint16_type j )
const
706 return M_tensor_expr.evalij( i, j );
711 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q )
const
713 return evalijq( i, j, c1,c2, q, fusion::result_of::has_key<Basis_j_t,vf::detail::gmc<Side> >() );
715 template<
int PatternContext>
717 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
718 mpl::int_<PatternContext> )
const
720 return evalijq( i, j, c1,c2, q, mpl::int_<PatternContext>(), fusion::result_of::has_key<Basis_j_t,vf::detail::gmc<Side> >() );
725 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q, mpl::true_ )
const
727 return M_tensor_expr.evalijq( i, j, c1, c2, q );
731 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q, mpl::false_ )
const
733 Feel::detail::ignore_unused_variable_warning( i );
734 Feel::detail::ignore_unused_variable_warning( j );
735 Feel::detail::ignore_unused_variable_warning( c1 );
736 Feel::detail::ignore_unused_variable_warning( c2 );
737 Feel::detail::ignore_unused_variable_warning( q );
738 return value_type( 0 );
740 template<
int PatternContext>
742 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
743 mpl::int_<PatternContext>, mpl::true_ )
const
745 return M_tensor_expr.evalijq( i, j, c1, c2, q, mpl::int_<PatternContext>() );
747 template<
int PatternContext>
749 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
750 mpl::int_<PatternContext>, mpl::false_ )
const
752 Feel::detail::ignore_unused_variable_warning( i );
753 Feel::detail::ignore_unused_variable_warning( j );
754 Feel::detail::ignore_unused_variable_warning( c1 );
755 Feel::detail::ignore_unused_variable_warning( c2 );
756 Feel::detail::ignore_unused_variable_warning( q );
757 return value_type( 0 );
764 tensor_expr_type M_tensor_expr;
773 expression_type
const& expression()
const
796 expression_type M_expr;
809 template<
typename ExprT,
double func(
double,
double )>
814 static const size_type context = ExprT::context;
815 static const bool is_terminal =
false;
817 static const uint16_type imorder = ExprT::imorder;
818 static const bool imIsPoly = ExprT::imIsPoly;
820 template<
typename Func>
821 struct HasTestFunction
823 static const bool result = ExprT::template HasTestFunction<Func>::result;
826 template<
typename Func>
827 struct HasTrialFunction
829 static const bool result = ExprT::template HasTrialFunction<Func>::result;
836 typedef ExprT expression_type;
837 typedef typename expression_type::value_type value_type;
838 typedef FaceExprV<ExprT, func> this_type;
846 explicit FaceExprV( expression_type
const & __expr )
859 template<
typename Geo_t,
typename Basis_i_t = fusion::map<fusion::pair<vf::detail::gmc<0>,boost::shared_ptr<vf::detail::gmc<0> > > >,
typename Basis_j_t = Basis_i_t>
862 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
865 typedef typename mpl::if_<mpl::equal_to<map_size,mpl::int_<2> >,
867 vf::detail::gmc<0> >::type gmc1;
869 typedef typename fusion::result_of::value_at_key<Geo_t,vf::detail::gmc<0> >::type left_gmc_ptrtype;
870 typedef typename fusion::result_of::value_at_key<Geo_t,vf::detail::gmc<0> >::type::element_type left_gmc_type;
871 typedef typename fusion::result_of::value_at_key<Geo_t,gmc1 >::type right_gmc_ptrtype;
872 typedef typename fusion::result_of::value_at_key<Geo_t,gmc1 >::type::element_type right_gmc_type;
874 typedef fusion::map<fusion::pair<vf::detail::gmc<0>, left_gmc_ptrtype> > map_left_gmc_type;
875 typedef fusion::map<fusion::pair<vf::detail::gmc<0>, right_gmc_ptrtype> > map_right_gmc_type;
877 typedef typename expression_type::template tensor<map_left_gmc_type, Basis_i_t, Basis_j_t> left_tensor_expr_type;
878 typedef typename expression_type::template tensor<map_right_gmc_type, Basis_i_t, Basis_j_t> right_tensor_expr_type;
879 typedef typename left_tensor_expr_type::value_type value_type;
881 typedef typename left_tensor_expr_type::shape shape;
883 template <
class Args>
struct sig
885 typedef value_type type;
890 static const bool value =
false;
893 tensor( this_type
const& expr,
894 Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& feu )
896 M_gmc_left( fusion::at_key<vf::detail::gmc<0> >( geom ) ),
897 M_gmc_right( fusion::at_key<gmc1 >( geom ) ),
898 M_left_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_left ) ),
899 M_right_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_right ) ),
900 M_tensor_expr_left( expr.expression(), M_left_map, fev, feu ),
901 M_tensor_expr_right( expr.expression(), M_right_map, fev, feu )
904 tensor( this_type
const& expr,
905 Geo_t
const& geom, Basis_i_t
const& fev )
907 M_gmc_left( fusion::at_key<vf::detail::gmc<0> >( geom ) ),
908 M_gmc_right( fusion::at_key<gmc1 >( geom ) ),
909 M_left_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_left ) ),
910 M_right_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_right ) ),
911 M_tensor_expr_left( expr.expression(), M_left_map, fev ),
912 M_tensor_expr_right( expr.expression(), M_right_map, fev )
915 tensor( this_type
const& expr, Geo_t
const& geom )
917 M_gmc_left( fusion::at_key<vf::detail::gmc<0> >( geom ) ),
918 M_gmc_right( fusion::at_key<gmc1 >( geom ) ),
919 M_left_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_left ) ),
920 M_right_map( fusion::make_map<vf::detail::gmc<0> >( M_gmc_right ) ),
921 M_tensor_expr_left( expr.expression(), M_left_map ),
922 M_tensor_expr_right( expr.expression(), M_right_map )
925 template<
typename IM>
926 void init( IM
const& im )
928 M_tensor_expr_left.init( im );
929 M_tensor_expr_right.init( im );
931 void update( Geo_t
const& geom, Basis_i_t
const& fev, Basis_j_t
const& feu )
933 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
934 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
936 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
937 M_gmc_right = fusion::at_key<gmc1 >( geom );
938 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
940 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
941 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
942 M_tensor_expr_left.update( M_left_map );
943 M_tensor_expr_right.update( M_right_map );
945 void update( Geo_t
const& geom, Basis_i_t
const& )
947 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
948 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
950 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
951 M_gmc_right = fusion::at_key<gmc1 >( geom );
952 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
954 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
955 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
956 M_tensor_expr_left.update( M_left_map );
957 M_tensor_expr_right.update( M_right_map );
959 void update( Geo_t
const& geom )
962 void update( Geo_t
const& geom, uint16_type face )
964 typedef mpl::int_<fusion::result_of::template size<Geo_t>::type::value> map_size;
965 FEELPP_ASSERT( map_size::value == 2 )( map_size::value ).error(
"invalid map size (should be 2)" );
967 M_gmc_left = fusion::at_key<vf::detail::gmc<0> >( geom );
968 M_gmc_right = fusion::at_key<gmc1 >( geom );
969 FEELPP_ASSERT( M_gmc_left != M_gmc_right )( M_gmc_left->id() )( M_gmc_right->id() ).error(
"same geomap, something is wrong" );
971 M_left_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_left );
972 M_right_map = fusion::make_map<vf::detail::gmc<0> >( M_gmc_right );
973 M_tensor_expr_left.update( M_left_map, face );
974 M_tensor_expr_right.update( M_right_map, face );
980 evalij( uint16_type i, uint16_type j )
const
982 return func( M_tensor_expr_left.evalij( i, j ), M_tensor_expr_right.evalij( i, j ) );
987 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q )
const
989 return func( M_tensor_expr_left.evalijq( i, j, c1, c2, q ),
990 M_tensor_expr_right.evalijq( i, j, c1, c2, q ) );
992 template<
int PatternContext>
994 evalijq( uint16_type i, uint16_type j, uint16_type c1, uint16_type c2, uint16_type q,
995 mpl::int_<PatternContext> )
const
997 return func( M_tensor_expr_left.evalijq( i, j, c1, c2, q, mpl::int_<PatternContext>() ),
998 M_tensor_expr_right.evalijq( i, j, c1, c2, q, mpl::int_<PatternContext>() ) );
1003 evaliq( uint16_type i, uint16_type c1, uint16_type c2, uint16_type q )
const
1005 return func( M_tensor_expr_left.evaliq( i, c1, c2, q ),
1006 M_tensor_expr_right.evaliq( i, c1, c2, q ) );
1010 evalq( uint16_type c1, uint16_type c2, uint16_type q )
const
1012 return func( M_tensor_expr_left.evalq( c1, c2, q ),
1013 M_tensor_expr_right.evalq( c1, c2, q ) );
1017 left_gmc_ptrtype M_gmc_left;
1018 right_gmc_ptrtype M_gmc_right;
1019 map_left_gmc_type M_left_map;
1020 map_right_gmc_type M_right_map;
1021 left_tensor_expr_type M_tensor_expr_left;
1022 right_tensor_expr_type M_tensor_expr_right;
1031 bool isSymetric()
const
1033 return M_expr.isSymetric();
1036 expression_type
const& expression()
const
1059 expression_type M_expr;
1064 inline double max(
double a,
double b )
1066 return std::max( a, b );
1068 inline double min(
double a,
double b )
1070 return std::min( a, b );
1073 inline double left(
double a,
double )
1077 inline double right(
double ,
double b )
1085 template<
typename ExprT>
1088 sumv( ExprT
const& v ) -> decltype( expr( SumvExpr<ExprT>( v ) ) )
1090 typedef SumvExpr<ExprT> sumv_t;
1091 return expr( sumv_t( v ) );
1094 template<
typename ExprT>
1097 leftface( ExprT
const& v ) -> decltype( expr( SumExpr<ExprT,0>( v ) ) )
1099 typedef SumExpr<ExprT,0> sumT_t;
1100 return expr( sumT_t( v ) );
1103 template<
typename ExprT>
1106 rightface( ExprT
const& v ) -> decltype( expr( SumExpr<ExprT,1>( v ) ) )
1108 typedef SumExpr<ExprT,1> sumT_t;
1109 return expr( sumT_t( v ) );
1116 template<
typename ExprT>
1118 Expr< SumTExpr<ExprT, 0> >
1119 leftfacet( ExprT
const& v )
1121 typedef SumTExpr<ExprT,0> sumT_t;
1122 return expr( sumT_t( v ) );
1128 template<
typename ExprT>
1130 Expr< SumTExpr<ExprT, 1> >
1131 rightfacet( ExprT
const& v )
1133 typedef SumTExpr<ExprT,1> sumT_t;
1134 return expr( sumT_t( v ) );
1141 template<
typename U>
1143 jump( U
const& u ) -> decltype( leftface( u*N() ) + rightface( u*N() ) )
1145 return ( leftface( u*N() ) + rightface( u *N() ) );
1150 template<
typename U>
1152 jumpt( U
const& u ) -> decltype( leftfacet( u*N() ) + rightfacet( u*N() ) )
1154 return ( leftfacet( u*N() ) + rightfacet( u*N() ) );
1159 template<
typename U>
1161 average( U
const& u ) -> decltype( 0.5*( leftface( u )+rightface( u ) ) )
1163 return 0.5*( leftface( u )+rightface( u ) );
1168 template<
typename U>
1170 averaget( U
const&u ) -> decltype( 0.5*( leftfacet( u )+rightfacet( u ) ) )
1172 return 0.5*( leftfacet( u )+rightfacet( u ) );
1175 #define jump( u ) (::Feel::vf::leftface((u)*::Feel::vf::N())+::Feel::vf::rightface((u)*::Feel::vf::N()))
1176 #define average( u ) (.5*(::Feel::vf::leftface((u))+::Feel::vf::rightface((u))))
1178 #define jumpt( u ) (::Feel::vf::leftfacet((u)*::Feel::vf::N())+::Feel::vf::rightfacet((u)*::Feel::vf::N()))
1179 #define averaget( u ) (.5*(::Feel::vf::leftfacet((u))+::Feel::vf::rightfacet((u))))
1183 template<
typename ExprT>
1185 Expr< FaceExprV<ExprT,vf::detail::max > >
1186 maxface( ExprT
const& v )
1188 typedef FaceExprV<ExprT,vf::detail::max > maxface_t;
1189 return Expr< maxface_t >( maxface_t( v ) );
1191 template<
typename ExprT>
1193 Expr< FaceExprV<ExprT,vf::detail::min > >
1194 minface( ExprT
const& v )
1196 typedef FaceExprV<ExprT,vf::detail::min > minface_t;
1197 return Expr< minface_t >( minface_t( v ) );
1201 template<
typename ExprT>
1203 Expr< FaceExprV<ExprT,vf::detail::left> >
1204 leftfacev( ExprT
const& v )
1206 typedef FaceExprV<ExprT,vf::detail::left> leftface_t;
1207 return Expr< leftface_t >( leftface_t( v ) );
1209 template<
typename ExprT>
1211 Expr< FaceExprV<ExprT,vf::detail::right> >
1212 rightfacev( ExprT
const& v )
1214 typedef FaceExprV<ExprT,vf::detail::right> rightface_t;
1215 return Expr< rightface_t >( rightface_t( v ) );
1222 template<
typename U>
1224 jumpv( U
const& u ) -> decltype( ( leftfacev( u*N() )+rightfacev( u*N() ) ) )
1226 return leftfacev( u*N() )+rightfacev( u*N() );
1231 template<
typename U>
1233 averagev( U
const& u ) -> decltype( .5*( leftfacev( u )+rightfacev( u ) ) )
1235 return .5*( leftfacev( u )+rightfacev( u ) );
1238 #define jumpv( u ) (::Feel::vf::leftfacev((u)*::Feel::vf::N())+::Feel::vf::rightfacev((u)*::Feel::vf::N()))
1242 #define averagev( u ) (.5*(::Feel::vf::leftfacev((u))+::Feel::vf::rightfacev((u))))