1 #ifndef _RHEOLEF_FIELD_EXPR_VARIATIONAL_H
2 #define _RHEOLEF_FIELD_EXPR_VARIATIONAL_H
45 #include "rheolef/field_expr_variational_terminal.h"
57 template <
class UnaryFunction,
class Expr>
97 _expr.initialize (pops, iopt);
100 _expr.initialize (
gh, pops, iopt);
106 template<
class Result,
class Arg,
class Status>
112 const geo_element& K, Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
114 fatal_macro (
"invalid type resolution: Result="<<typename_macro(Result)
115 <<
", Arg="<<typename_macro(Arg)
116 <<
", UnaryFunction="<<typename_macro(UnaryFunction)
120 template<
class Result,
class Arg>
127 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
129 Eigen::Matrix<Arg,Eigen::Dynamic,Eigen::Dynamic> arg_value;
130 obj.
_expr.evaluate (omega_K, K, arg_value);
131 value = arg_value.unaryExpr (obj.
_f);
139 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
140 bool do_local_component_assembly)
const
142 Eigen::Matrix<Arg,Eigen::Dynamic,Eigen::Dynamic> arg_value;
143 obj.
_expr.evaluate_on_side (omega_K, K, sid, arg_value, do_local_component_assembly);
144 value = arg_value.unaryExpr (obj.
_f);
147 template<
class Result,
class Arg,
class M>
151 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
160 eval (*
this, omega_K, K,
value);
162 template<
class Result,
class Arg,
class M>
167 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
168 bool do_local_component_assembly)
const
177 eval (*
this, omega_K, K, sid,
value, do_local_component_assembly);
180 template<
class This,
class Result,
class Arg,
class Status>
187 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
189 obj.template evaluate_internal<Result, Arg> (omega_K, K,
value);
197 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
198 bool do_local_component_assembly)
const
200 obj.template evaluate_internal<Result, Arg> (omega_K, K, sid,
value, do_local_component_assembly);
204 template<
class This,
class Result,
class Arg>
211 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
215 switch (arg_valued_tag) {
216 #define _RHEOLEF_switch(VALUED,VALUE) \
217 case space_constant::VALUED: \
218 obj.template evaluate_internal<Result, VALUE>(omega_K, K, value); break;
225 #undef _RHEOLEF_switch
226 default:
error_macro (
"unexpected argument valued tag="<<arg_valued_tag);
235 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
236 bool do_local_component_assembly)
const
240 switch (arg_valued_tag) {
241 #define _RHEOLEF_switch(VALUED,VALUE) \
242 case space_constant::VALUED: \
243 obj.template evaluate_internal<Result, VALUE>(omega_K, K, sid,value, do_local_component_assembly); break;
250 #undef _RHEOLEF_switch
251 default:
error_macro (
"unexpected argument valued tag="<<arg_valued_tag);
255 template<
class Result,
class M>
259 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
265 eval (*
this, omega_K, K,
value);
267 template<
class Result,
class M>
272 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
273 bool do_local_component_assembly)
const
279 eval (*
this, omega_K, K, sid,
value, do_local_component_assembly);
281 template<
class Result>
300 #define _RHEOLEF_make_field_expr_v2_variational_unary_operator(FUNCTION,FUNCTOR) \
301 template<class Expr> \
305 details::is_field_expr_v2_variational_arg<Expr>::value \
306 ,details::field_expr_v2_variational_unary< \
311 FUNCTION (const Expr& expr) \
313 return details::field_expr_v2_variational_unary <FUNCTOR,Expr> (FUNCTOR(), expr); \
320 #undef _RHEOLEF_make_field_expr_v2_variational_unary_operator
331 template<
class BinaryFunction,
class Expr1,
class Expr2>
340 typename Expr1::value_type
343 typename Expr1::value_type
344 ,
typename Expr2::value_type
350 typename Expr1::vf_tag_type,
379 _expr1.initialize (pops, iopt);
380 _expr2.initialize (pops, iopt);
387 template<
class Result,
class Arg1,
class Arg2,
class Status>
393 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
402 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
407 template<
class Result,
class Arg1,
class Arg2>
413 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
415 Eigen::Matrix<Arg1,Eigen::Dynamic,Eigen::Dynamic> value1; obj.
_expr1.evaluate (omega_K, K, value1);
416 Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> value2; obj.
_expr2.evaluate (omega_K, K, value2);
418 value.resize (value1.rows(), value1.cols());
419 for (
size_type loc_inod = 0, loc_nnod = value1.rows(); loc_inod < loc_nnod; ++loc_inod) {
420 for (
size_type loc_jdof = 0, loc_ndof = value1.cols(); loc_jdof < loc_ndof; ++loc_jdof) {
421 value(loc_inod,loc_jdof) = obj.
_f (value1(loc_inod,loc_jdof), value2(loc_inod,loc_jdof));
429 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
430 bool do_local_component_assembly)
const
432 Eigen::Matrix<Arg1,Eigen::Dynamic,Eigen::Dynamic> value1; obj.
_expr1.evaluate_on_side (omega_K, K, sid, value1, do_local_component_assembly);
433 Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> value2; obj.
_expr2.evaluate_on_side (omega_K, K, sid, value2, do_local_component_assembly);
435 value.resize (value1.rows(), value1.cols());
436 for (
size_type loc_inod = 0, loc_nnod = value1.rows(); loc_inod < loc_nnod; ++loc_inod) {
437 for (
size_type loc_jdof = 0, loc_ndof = value1.cols(); loc_jdof < loc_ndof; ++loc_jdof) {
438 value(loc_inod,loc_jdof) = obj.
_f (value1(loc_inod,loc_jdof), value2(loc_inod,loc_jdof));
442 template<
class Result,
class Arg1,
class Arg2>
446 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
452 eval (*
this, omega_K, K,
value);
454 template<
class Result,
class Arg1,
class Arg2>
459 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
460 bool do_local_component_assembly)
const
466 eval (*
this, omega_K, K, sid,
value, do_local_component_assembly);
468 template<
class This,
class Result,
class Arg1,
class Arg2,
class Undet1,
class Undet2>
473 template<
class This,
class Result,
class Arg1,
class Arg2>
479 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
481 obj.template evaluate_internal<Result, Arg1, Arg2> (omega_K, K,
value);
488 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
489 bool do_local_component_assembly)
const
491 obj.template evaluate_on_side_internal<Result, Arg1, Arg2> (omega_K, K, sid,
value, do_local_component_assembly);
497 template<
class This,
class Result,
class Arg1,
class Arg2>
503 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
507 switch (arg1_valued_tag) {
508 #define _RHEOLEF_switch1(VALUED1,VALUE1) \
509 case space_constant::VALUED1: \
510 obj.template evaluate_internal<Result, VALUE1, Arg2>(omega_K, K, value); break;
517 #undef _RHEOLEF_switch1
518 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
526 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
527 bool do_local_component_assembly)
const
531 switch (arg1_valued_tag) {
532 #define _RHEOLEF_switch1(VALUED1,VALUE1) \
533 case space_constant::VALUED1: \
534 obj.template evaluate_on_side_internal<Result, VALUE1, Arg2>(omega_K, K, sid, value, do_local_component_assembly); break;
541 #undef _RHEOLEF_switch1
542 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
549 template<
class This,
class Result,
class Arg1,
class Arg2>
555 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
559 switch (arg2_valued_tag) {
560 #define _RHEOLEF_switch2(VALUED2,VALUE2) \
561 case space_constant::VALUED2: \
562 obj.template evaluate_internal<Result, Arg1, VALUE2>(omega_K, K, value); break;
569 #undef _RHEOLEF_switch2
570 default:
error_macro (
"unexpected second argument valued tag="<<arg2_valued_tag);
578 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
579 bool do_local_component_assembly)
const
583 switch (arg2_valued_tag) {
584 #define _RHEOLEF_switch2(VALUED2,VALUE2) \
585 case space_constant::VALUED2: \
586 obj.template evaluate_on_side_internal<Result, Arg1, VALUE2>(omega_K, K, sid, value, do_local_component_assembly); break;
593 #undef _RHEOLEF_switch2
594 default:
error_macro (
"unexpected second argument valued tag="<<arg2_valued_tag);
601 template<
class This,
class Result,
class Arg1,
class Arg2>
607 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
613 switch (arg1_valued_tag) {
614 #define _RHEOLEF_switch2(VALUE1,VALUED2,VALUE2) \
615 case space_constant::VALUED2: \
616 obj.template evaluate_internal<Result, VALUE1, VALUE2>(omega_K, K, value); break;
617 #define _RHEOLEF_switch1(VALUED1,VALUE1) \
618 case space_constant::VALUED1: { \
619 switch (arg2_valued_tag) { \
620 _RHEOLEF_switch2(VALUE1,scalar,T2) \
621 _RHEOLEF_switch2(VALUE1,vector,point_basic<T2>) \
622 _RHEOLEF_switch2(VALUE1,tensor,tensor_basic<T2>) \
623 _RHEOLEF_switch2(VALUE1,unsymmetric_tensor,tensor_basic<T2>) \
624 _RHEOLEF_switch2(VALUE1,tensor3,tensor3_basic<T2>) \
625 _RHEOLEF_switch2(VALUE1,tensor4,tensor4_basic<T2>) \
626 default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag); \
636 #undef _RHEOLEF_switch2
637 #undef _RHEOLEF_switch1
638 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
646 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
647 bool do_local_component_assembly)
const
653 switch (arg1_valued_tag) {
654 #define _RHEOLEF_switch2(VALUE1,VALUED2,VALUE2) \
655 case space_constant::VALUED2: \
656 obj.template evaluate_on_side_internal<Result, VALUE1, VALUE2>(omega_K, K, sid, value, do_local_component_assembly); break;
657 #define _RHEOLEF_switch1(VALUED1,VALUE1) \
658 case space_constant::VALUED1: { \
659 switch (arg2_valued_tag) { \
660 _RHEOLEF_switch2(VALUE1,scalar,T2) \
661 _RHEOLEF_switch2(VALUE1,vector,point_basic<T2>) \
662 _RHEOLEF_switch2(VALUE1,tensor,tensor_basic<T2>) \
663 _RHEOLEF_switch2(VALUE1,unsymmetric_tensor,tensor_basic<T2>) \
664 _RHEOLEF_switch2(VALUE1,tensor3,tensor3_basic<T2>) \
665 _RHEOLEF_switch2(VALUE1,tensor4,tensor4_basic<T2>) \
666 default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag); \
676 #undef _RHEOLEF_switch2
677 #undef _RHEOLEF_switch1
678 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
685 template<
class Result>
688 typename Expr1::value_type
689 ,
typename Expr2::value_type
690 ,Result>::first_argument_type
A1;
692 typename Expr1::value_type
693 ,
typename Expr2::value_type
694 ,Result>::second_argument_type
A2;
696 template<
class Result>
700 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
707 eval (*
this, omega_K, K,
value);
709 template<
class Result>
714 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
715 bool do_local_component_assembly)
const
722 eval (*
this, omega_K, K, sid,
value, do_local_component_assembly);
724 template<
class Result>
745 template<
class Expr1,
class Expr2,
class Sfinae =
void>
748 template<
class Expr1,
class Expr2>
754 is_field_expr_v2_variational_arg<Expr1>::value
755 && is_field_expr_v2_variational_arg<Expr2>::value
759 is_field_expr_v2_variational_arg<Expr1>
760 ,is_field_expr_v2_variational_arg<Expr2>
762 typename Expr1::vf_tag_type
763 ,typename Expr2::vf_tag_type
770 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_plus_minus(FUNCTION,FUNCTOR) \
771 template<class Expr1, class Expr2> \
775 details::is_field_expr_v2_variational_binary_plus_minus <Expr1,Expr2>::value \
776 ,details::field_expr_v2_variational_binary< \
782 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
784 return details::field_expr_v2_variational_binary <FUNCTOR, Expr1, Expr2> (FUNCTOR(), expr1, expr2); \
789 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_plus_minus
798 template<
class This,
class Arg1>
803 switch (nl_arg_valued_tag) {
805 obj._nl_expr.evaluate (K, obj._scalar_nl_value_quad);
break;
807 obj._nl_expr.evaluate (K, obj._vector_nl_value_quad);
break;
810 obj._nl_expr.evaluate (K, obj._tensor_nl_value_quad);
break;
812 obj._nl_expr.evaluate (K, obj._tensor3_nl_value_quad);
break;
814 obj._nl_expr.evaluate (K, obj._tensor4_nl_value_quad);
break;
815 default:
error_macro (
"unexpected first argument valued tag="<<nl_arg_valued_tag);
820 switch (nl_arg_valued_tag) {
822 obj._nl_expr.evaluate_on_side (K, sid, obj._scalar_nl_value_quad);
break;
824 obj._nl_expr.evaluate_on_side (K, sid, obj._vector_nl_value_quad);
break;
827 obj._nl_expr.evaluate_on_side (K, sid, obj._tensor_nl_value_quad);
break;
829 obj._nl_expr.evaluate_on_side (K, sid, obj._tensor3_nl_value_quad);
break;
831 obj._nl_expr.evaluate_on_side (K, sid, obj._tensor4_nl_value_quad);
break;
832 default:
error_macro (
"unexpected first argument valued tag="<<nl_arg_valued_tag);
837 fatal_macro (
"unexpected argument type="<<typename_macro(Arg1));
845 obj._nl_expr.evaluate (K, obj._scalar_nl_value_quad); }
847 obj._nl_expr.evaluate_on_side (K, sid, obj._scalar_nl_value_quad); }
849 return obj._scalar_nl_value_quad[q]; }
855 obj._nl_expr.evaluate (K, obj._vector_nl_value_quad); }
857 obj._nl_expr.evaluate_on_side (K, sid, obj._vector_nl_value_quad); }
859 return obj._vector_nl_value_quad[q]; }
865 obj._nl_expr.evaluate (K, obj._tensor_nl_value_quad); }
867 obj._nl_expr.evaluate_on_side (K, sid, obj._tensor_nl_value_quad); }
869 return obj._tensor_nl_value_quad[q]; }
875 obj._nl_expr.evaluate (K, obj._tensor3_nl_value_quad); }
877 obj._nl_expr.evaluate_on_side (K, sid, obj._tensor3_nl_value_quad); }
879 return obj._tensor3_nl_value_quad[q]; }
885 obj._nl_expr.evaluate (K, obj._tensor4_nl_value_quad); }
887 obj._nl_expr.evaluate_on_side (K, sid, obj._tensor4_nl_value_quad); }
889 return obj._tensor4_nl_value_quad[q]; }
924 template<
class BinaryFunction,
class NLExpr,
class VFExpr>
933 typename NLExpr::value_type
936 typename NLExpr::value_type
937 ,
typename VFExpr::value_type
952 const NLExpr& nl_expr,
953 const VFExpr& vf_expr)
989 template<
class Result,
class Arg1,
class Arg2,
class Status>
995 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1004 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1005 bool do_local_component_assembly)
const
1010 template<
class Result,
class Arg1,
class Arg2>
1016 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1018 Eigen::Matrix<Arg1,Eigen::Dynamic,1> value1; obj.
_nl_expr.evaluate (omega_K, K, value1);
1019 Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> value2; obj.
_vf_expr.evaluate (omega_K, K, value2);
1020 check_macro (value1.size() == value2.rows(),
"invalid sizes value1(nnod="<<value1.size()
1021 <<
") and value2(nnod="<<value2.rows()<<
",ndof="<<value2.cols()<<
")");
1022 value.resize (value2.rows(), value2.cols());
1023 for (
size_type loc_inod = 0, loc_nnod = value2.rows(); loc_inod < loc_nnod; ++loc_inod) {
1024 for (
size_type loc_jdof = 0, loc_ndof = value2.cols(); loc_jdof < loc_ndof; ++loc_jdof) {
1025 value(loc_inod,loc_jdof) = obj.
_f (value1[loc_inod], value2(loc_inod,loc_jdof));
1033 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1034 bool do_local_component_assembly)
const
1036 Eigen::Matrix<Arg1,Eigen::Dynamic,1> value1; obj.
_nl_expr.evaluate_on_side (omega_K, K, sid, value1);
1037 Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> value2; obj.
_vf_expr.evaluate_on_side (omega_K, K, sid, value2, do_local_component_assembly);
1038 check_macro (value1.size() == value2.rows(),
"invalid sizes value1(nnod="<<value1.size()
1039 <<
") and value2(nnod="<<value2.rows()<<
",ndof="<<value2.cols()<<
")");
1040 value.resize (value2.rows(), value2.cols());
1041 for (
size_type loc_inod = 0, loc_nnod = value2.rows(); loc_inod < loc_nnod; ++loc_inod) {
1042 for (
size_type loc_jdof = 0, loc_ndof = value2.cols(); loc_jdof < loc_ndof; ++loc_jdof) {
1043 value(loc_inod,loc_jdof) = obj.
_f (value1[loc_inod], value2(loc_inod,loc_jdof));
1047 template<
class Result,
class Arg1,
class Arg2>
1051 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1057 eval (*
this, omega_K, K,
value);
1059 template<
class Result,
class Arg1,
class Arg2>
1064 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1065 bool do_local_component_assembly)
const
1071 eval (*
this, omega_K, K, sid,
value, do_local_component_assembly);
1073 template<
class This,
class Result,
class Arg1,
class Arg2,
class Undet1,
class Undet2>
1078 template<
class This,
class Result,
class Arg1,
class Arg2>
1084 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1086 obj.template evaluate_internal<Result, Arg1, Arg2> (omega_K, K,
value);
1093 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1094 bool do_local_component_assembly)
const
1096 obj.template evaluate_on_side_internal<Result, Arg1, Arg2> (omega_K, K, sid,
value, do_local_component_assembly);
1102 template<
class This,
class Result,
class Arg1,
class Arg2>
1108 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1112 switch (arg1_valued_tag) {
1113 #define _RHEOLEF_switch(A1_VALUED,A1_VALUE) \
1114 case space_constant::A1_VALUED: \
1115 obj.template evaluate_internal<Result, A1_VALUE, Arg2> (omega_K, K, value); break;
1122 #undef _RHEOLEF_switch
1123 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
1131 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1132 bool do_local_component_assembly)
const
1136 switch (arg1_valued_tag) {
1137 #define _RHEOLEF_switch(A1_VALUED,A1_VALUE) \
1138 case space_constant::A1_VALUED: \
1139 obj.template evaluate_on_side_internal<Result, A1_VALUE, Arg2> (omega_K, K, sid, value, do_local_component_assembly); break;
1146 #undef _RHEOLEF_switch
1147 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
1154 template<
class This,
class Result,
class Arg1,
class Arg2>
1160 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1164 switch (arg2_valued_tag) {
1165 #define _RHEOLEF_switch(A2_VALUED,A2_VALUE) \
1166 case space_constant::A2_VALUED: \
1167 obj.template evaluate_internal<Result, Arg1, A2_VALUE> (omega_K, K, value); break;
1174 #undef _RHEOLEF_switch
1175 default:
error_macro (
"unexpected second argument valued tag="<<arg2_valued_tag);
1183 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1184 bool do_local_component_assembly)
const
1188 switch (arg2_valued_tag) {
1189 #define _RHEOLEF_switch(A2_VALUED,A2_VALUE) \
1190 case space_constant::A2_VALUED: \
1191 obj.template evaluate_on_side_internal<Result, Arg1, A2_VALUE> (omega_K, K, sid, value, do_local_component_assembly); break;
1198 #undef _RHEOLEF_switch
1199 default:
error_macro (
"unexpected second argument valued tag="<<arg2_valued_tag);
1206 template<
class This,
class Result,
class Arg1,
class Arg2>
1212 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1218 switch (arg1_valued_tag) {
1219 #define _RHEOLEF_switch_A2(A1_VALUE,A2_VALUED,A2_VALUE) \
1220 case space_constant::A2_VALUED: \
1221 obj.template evaluate_internal<Result, A1_VALUE, A2_VALUE> (omega_K, K, value); break;
1223 #define _RHEOLEF_switch(A1_VALUED,A1_VALUE) \
1224 case space_constant::A1_VALUED: { \
1225 switch (arg2_valued_tag) { \
1226 _RHEOLEF_switch_A2(A1_VALUE,scalar,T2) \
1227 _RHEOLEF_switch_A2(A1_VALUE,vector,point_basic<T2>) \
1228 _RHEOLEF_switch_A2(A1_VALUE,tensor,tensor_basic<T2>) \
1229 _RHEOLEF_switch_A2(A1_VALUE,unsymmetric_tensor,tensor_basic<T2>) \
1230 _RHEOLEF_switch_A2(A1_VALUE,tensor3,tensor3_basic<T2>) \
1231 _RHEOLEF_switch_A2(A1_VALUE,tensor4,tensor4_basic<T2>) \
1232 default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag); \
1242 #undef _RHEOLEF_switch
1243 #undef _RHEOLEF_switch_A2
1244 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
1252 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1253 bool do_local_component_assembly)
const
1259 switch (arg1_valued_tag) {
1260 #define _RHEOLEF_switch_A2(A1_VALUE,A2_VALUED,A2_VALUE) \
1261 case space_constant::A2_VALUED: \
1262 obj.template evaluate_on_side_internal<Result, A1_VALUE, A2_VALUE> (omega_K, K, sid, value, do_local_component_assembly); break;
1264 #define _RHEOLEF_switch(A1_VALUED,A1_VALUE) \
1265 case space_constant::A1_VALUED: { \
1266 switch (arg2_valued_tag) { \
1267 _RHEOLEF_switch_A2(A1_VALUE,scalar,T2) \
1268 _RHEOLEF_switch_A2(A1_VALUE,vector,point_basic<T2>) \
1269 _RHEOLEF_switch_A2(A1_VALUE,tensor,tensor_basic<T2>) \
1270 _RHEOLEF_switch_A2(A1_VALUE,unsymmetric_tensor,tensor_basic<T2>) \
1271 _RHEOLEF_switch_A2(A1_VALUE,tensor3,tensor3_basic<T2>) \
1272 _RHEOLEF_switch_A2(A1_VALUE,tensor4,tensor4_basic<T2>) \
1273 default: error_macro ("unexpected second argument valued tag="<<arg2_valued_tag); \
1283 #undef _RHEOLEF_switch
1284 #undef _RHEOLEF_switch_A2
1285 default:
error_macro (
"unexpected first argument valued tag="<<arg1_valued_tag);
1292 template<
class Result>
1295 typename NLExpr::value_type
1297 typename NLExpr::value_type
1298 ,
typename VFExpr::value_type
1299 ,Result>::first_argument_type
1302 typename VFExpr::value_type
1304 typename NLExpr::value_type
1305 ,
typename VFExpr::value_type
1306 ,Result>::second_argument_type
1312 template<
class Result>
1316 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1325 eval (*
this, omega_K, K,
value);
1327 template<
class Result>
1332 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
1333 bool do_local_component_assembly)
const
1342 eval (*
this, omega_K, K, sid,
value, do_local_component_assembly);
1344 template<
class Value>
1350 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value0,
1351 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value1,
1352 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
1354 _vf_expr.local_dg_merge_on_side (omega_K, S, K0, K1, value0, value1,
value);
1356 template<
class Result>
1377 template<
class Expr1,
class Expr2,
class Sfinae =
void>
1380 template<
class Expr1,
class Expr2>
1386 is_field_expr_v2_nonlinear_arg <Expr1>::value
1387 && ! is_field_expr_v2_constant <Expr1>::value
1388 && is_field_expr_v2_variational_arg<Expr2>::value
1394 template<
class Expr1,
class Expr2>
1400 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_left(FUNCTION,FUNCTOR) \
1401 template<class Expr1, class Expr2> \
1405 details::is_field_expr_v2_variational_binary_multiplies_divides_left <Expr1,Expr2>::value \
1406 ,details::field_expr_v2_variational_binary_binded< \
1408 ,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type \
1412 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1414 typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type wrap1_t; \
1415 return details::field_expr_v2_variational_binary_binded \
1416 <FUNCTOR, wrap1_t, Expr2> \
1417 (FUNCTOR(), wrap1_t(expr1), expr2); \
1420 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_right(FUNCTION,FUNCTOR) \
1421 template<class Expr1, class Expr2> \
1425 details::is_field_expr_v2_variational_binary_multiplies_divides_right <Expr1,Expr2>::value \
1426 ,details::field_expr_v2_variational_binary_binded< \
1427 details::swapper<FUNCTOR> \
1428 , typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type \
1432 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1434 typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type wrap2_t; \
1435 return details::field_expr_v2_variational_binary_binded \
1436 <details::swapper<FUNCTOR>, wrap2_t, Expr1> \
1437 (details::swapper<FUNCTOR>(FUNCTOR()), wrap2_t(expr2), expr1); \
1439 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides(FUNCTION,FUNCTOR) \
1440 _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_left (FUNCTION,FUNCTOR) \
1441 _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_right (FUNCTION,FUNCTOR)
1447 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_left
1448 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_right
1449 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides
1456 template<
class Expr1,
class Expr2,
class Sfinae =
void>
1459 template<
class Expr1,
class Expr2>
1465 is_field_expr_v2_constant <Expr1>::value
1466 && is_field_expr_v2_variational_arg<Expr2>::value
1472 template<
class Expr1,
class Expr2>
1478 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_left(FUNCTION,FUNCTOR) \
1479 template<class Expr1, class Expr2> \
1483 details::is_field_expr_v2_variational_binary_multiplies_divides_constant_left <Expr1,Expr2>::value \
1484 ,details::field_expr_v2_variational_unary< \
1485 details::binder_first <FUNCTOR, Expr1> \
1489 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1491 return details::field_expr_v2_variational_unary \
1492 <details::binder_first <FUNCTOR,Expr1>, Expr2> \
1493 (details::binder_first <FUNCTOR,Expr1> (FUNCTOR(), expr1), expr2); \
1496 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right(FUNCTION,FUNCTOR) \
1497 template<class Expr1, class Expr2> \
1501 details::is_field_expr_v2_variational_binary_multiplies_divides_constant_right <Expr1,Expr2>::value \
1502 ,details::field_expr_v2_variational_unary< \
1503 details::binder_second <FUNCTOR, Expr2> \
1507 FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1509 return details::field_expr_v2_variational_unary \
1510 <details::binder_second <FUNCTOR,Expr2>, Expr1> \
1511 (details::binder_second <FUNCTOR,Expr2> (FUNCTOR(), expr2), expr1); \
1514 #define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant(FUNCTION,FUNCTOR) \
1515 _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_left (FUNCTION,FUNCTOR) \
1516 _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right (FUNCTION,FUNCTOR)
1524 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right
1525 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_left
1526 #undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant
1529 #endif // _RHEOLEF_FIELD_EXPR_VARIATIONAL_H