1#ifndef _RHEOLEF_FIELD_EXPR_VARIATIONAL_H
2#define _RHEOLEF_FIELD_EXPR_VARIATIONAL_H
45#include "rheolef/field_expr_variational_terminal.h"
57template <
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
264 evaluate_switch <self_type, Result, A1, status_t> eval;
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
278 evaluate_switch <self_type, Result, A1, status_t> eval;
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) \
301template<class Expr> \
305 details::is_field_expr_v2_variational_arg<Expr>::value \
306 ,details::field_expr_v2_variational_unary< \
311FUNCTION (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
331template<
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,
354 typedef field_expr_v2_variational_binary <BinaryFunction,Expr1,Expr2>
self_type;
355 typedef field_expr_v2_variational_binary <BinaryFunction,typename Expr1::dual_self_type,typename Expr2::dual_self_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
706 evaluate_switch <self_type, Result, A1, A2, undet_1, undet_2> eval;
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
721 evaluate_switch <self_type, Result, A1, A2, undet_1, undet_2> eval;
722 eval (*
this, omega_K, K, sid, value, do_local_component_assembly);
724 template<
class Result>
745template<
class Expr1,
class Expr2,
class Sfinae =
void>
748template<
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) \
771template<class Expr1, class Expr2> \
775 details::is_field_expr_v2_variational_binary_plus_minus <Expr1,Expr2>::value \
776 ,details::field_expr_v2_variational_binary< \
782FUNCTION (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]; }
924template<
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
1324 evaluate_switch <self_type, Result, A1, A2, undet_1, undet_2> eval;
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
1341 evaluate_switch <self_type, Result, A1, A2, undet_1, undet_2> eval;
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>
1377template<
class Expr1,
class Expr2,
class Sfinae =
void>
1380template<
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
1394template<
class Expr1,
class Expr2>
1400#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_left(FUNCTION,FUNCTOR) \
1401template<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 \
1412FUNCTION (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) \
1421template<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 \
1432FUNCTION (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)
1448#undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_left
1449#undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_right
1450#undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides
1457template<
class Expr1,
class Expr2,
class Sfinae =
void>
1458struct is_field_expr_v2_variational_binary_multiplies_divides_constant_left : std::false_type {};
1460template<
class Expr1,
class Expr2>
1461struct is_field_expr_v2_variational_binary_multiplies_divides_constant_left <
1466 is_field_expr_v2_constant <Expr1>::value
1467 && is_field_expr_v2_variational_arg<Expr2>::value
1473template<
class Expr1,
class Expr2>
1474struct is_field_expr_v2_variational_binary_multiplies_divides_constant_right
1475: is_field_expr_v2_variational_binary_multiplies_divides_constant_left <Expr2,Expr1> {};
1479#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_left(FUNCTION,FUNCTOR) \
1480template<class Expr1, class Expr2> \
1484 details::is_field_expr_v2_variational_binary_multiplies_divides_constant_left <Expr1,Expr2>::value \
1485 ,details::field_expr_v2_variational_unary< \
1486 details::binder_first <FUNCTOR, Expr1> \
1490FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1492 return details::field_expr_v2_variational_unary \
1493 <details::binder_first <FUNCTOR,Expr1>, Expr2> \
1494 (details::binder_first <FUNCTOR,Expr1> (FUNCTOR(), expr1), expr2); \
1497#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right(FUNCTION,FUNCTOR) \
1498template<class Expr1, class Expr2> \
1502 details::is_field_expr_v2_variational_binary_multiplies_divides_constant_right <Expr1,Expr2>::value \
1503 ,details::field_expr_v2_variational_unary< \
1504 details::binder_second <FUNCTOR, Expr2> \
1508FUNCTION (const Expr1& expr1, const Expr2& expr2) \
1510 return details::field_expr_v2_variational_unary \
1511 <details::binder_second <FUNCTOR,Expr2>, Expr1> \
1512 (details::binder_second <FUNCTOR,Expr2> (FUNCTOR(), expr2), expr1); \
1515#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant(FUNCTION,FUNCTOR) \
1516 _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_left (FUNCTION,FUNCTOR) \
1517 _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right (FUNCTION,FUNCTOR)
1526#undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right
1527#undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_left
1528#undef _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant
field gh(Float epsilon, Float t, const field &uh, const test &v)
void evaluate_on_side_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value, bool do_local_component_assembly) const
promote_memory< typenameNLExpr::memory_type, typenameVFExpr::memory_type >::type memory_type
field_expr_v2_variational_binary_binded(const field_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, VFExpr > &x)
space_basic< scalar_type, memory_type > space_type
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
field_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, VFExpr > self_type
void valued_check() const
field_expr_v2_variational_binary_binded(const BinaryFunction &f, const NLExpr &nl_expr, const VFExpr &vf_expr)
static const space_constant::valued_type valued_hint
size_type n_derivative() const
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
static bool have_test_space()
void local_dg_merge_on_side(const geo_basic< float_type, memory_type > &omega_K, const geo_element &S, const geo_element &K0, const geo_element &K1, const Eigen::Matrix< Value, Eigen::Dynamic, Eigen::Dynamic > &value0, const Eigen::Matrix< Value, Eigen::Dynamic, Eigen::Dynamic > &value1, Eigen::Matrix< Value, Eigen::Dynamic, Eigen::Dynamic > &value) const
details::generic_binary_traits< BinaryFunction >::template hint< typenameNLExpr::value_type, typenameVFExpr::value_type, result_hint >::result_type value_type
scalar_traits< value_type >::type scalar_type
details::generic_binary_traits< BinaryFunction >::template result_hint< typenameNLExpr::value_type, typenameVFExpr::value_type >::type result_hint
void evaluate_on_side(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value, bool do_local_component_assembly) const
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
field_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type > dual_self_type
VFExpr::vf_tag_type vf_tag_type
float_traits< value_type >::type float_type
geo_element::size_type size_type
void evaluate_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
space_constant::valued_type valued_tag() const
const space_type & get_vf_space() const
void evaluate_on_side_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value, bool do_local_component_assembly) const
space_basic< scalar_type, memory_type > space_type
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
details::generic_binary_traits< BinaryFunction >::template result_hint< typenameExpr1::value_type, typenameExpr2::value_type >::type result_hint
field_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type > dual_self_type
field_expr_v2_variational_binary< BinaryFunction, Expr1, Expr2 > self_type
field_expr_v2_variational_binary(const BinaryFunction &f, const Expr1 &expr1, const Expr2 &expr2)
void valued_check() const
details::bf_vf_tag< BinaryFunction, typenameExpr1::vf_tag_type, typenameExpr2::vf_tag_type >::type vf_tag_type
static const space_constant::valued_type valued_hint
size_type n_derivative() const
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
static bool have_test_space()
scalar_traits< value_type >::type scalar_type
details::generic_binary_traits< BinaryFunction >::template hint< typenameExpr1::value_type, typenameExpr2::value_type, result_hint >::result_type value_type
void evaluate_on_side(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value, bool do_local_component_assembly) const
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
promote_memory< typenameExpr1::memory_type, typenameExpr2::memory_type >::type memory_type
float_traits< value_type >::type float_type
geo_element::size_type size_type
void evaluate_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
space_constant::valued_type valued_tag() const
const space_type & get_vf_space() const
space_basic< scalar_type, memory_type > space_type
field_expr_v2_variational_unary< UnaryFunction, typename Expr::dual_self_type > dual_self_type
field_expr_v2_variational_unary< UnaryFunction, Expr > self_type
details::generic_unary_traits< UnaryFunction >::template result_hint< typenameExpr::value_type >::type value_type
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
field_expr_v2_variational_unary(const field_expr_v2_variational_unary< UnaryFunction, Expr > &x)
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
void evaluate_internal(const geo_basic< float_type, M > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value, bool do_local_component_assembly) const
void evaluate_internal(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
void valued_check() const
static const space_constant::valued_type valued_hint
size_type n_derivative() const
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
static bool have_test_space()
scalar_traits< value_type >::type scalar_type
float_traits< scalar_type >::type float_type
field_expr_v2_variational_unary(const UnaryFunction &f, const Expr &expr)
Expr::memory_type memory_type
void evaluate(const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
Expr::vf_tag_type vf_tag_type
geo_element::size_type size_type
space_constant::valued_type valued_tag() const
const space_type & get_vf_space() const
void evaluate_on_side(const geo_basic< float_type, M > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value, bool do_local_component_assembly) const
generic mesh with rerefence counting
see the geo_element page for the full documentation
reference_element::size_type size_type
see the integrate_option page for the full documentation
see the tensor3 page for the full documentation
see the tensor4 page for the full documentation
see the tensor page for the full documentation
#define error_macro(message)
#define fatal_macro(message)
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
#define _RHEOLEF_make_field_expr_v2_variational_unary_operator(FUNCTION, FUNCTOR)
#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_right(FUNCTION, FUNCTOR)
#define _RHEOLEF_switch(VALUED, VALUE)
#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant_right(FUNCTION, FUNCTOR)
#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides(FUNCTION, FUNCTOR)
#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_plus_minus(FUNCTION, FUNCTOR)
#define _RHEOLEF_make_field_expr_v2_variational_binary_operator_multiplies_divides_constant(FUNCTION, FUNCTOR)
#define _RHEOLEF_switch2(VALUED2, VALUE2)
#define _RHEOLEF_switch1(VALUED1, VALUE1)
This file is part of Rheolef.
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
U tr(const tensor_basic< U > &a, size_t d=3)
T dddot(const tensor3_basic< T > &a, const tensor3_basic< T > &b)
rheolef::std enable_if ::type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
csr< T, sequential > trans(const csr< T, sequential > &a)
trans(a): see the form page for the full documentation
t operator()(const t &a, const t &b)
void operator()(const self_type &obj, const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
details::generic_binary_traits< BinaryFunction >::template hint< typenameExpr1::value_type, typenameExpr2::value_type, Result >::second_argument_type A2
details::generic_binary_traits< BinaryFunction >::template hint< typenameExpr1::value_type, typenameExpr2::value_type, Result >::first_argument_type A1
void operator()(const self_type &obj, const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
promote< typenameNLExpr::value_type, typenamedetails::generic_binary_traits< BinaryFunction >::templatehint< typenameNLExpr::value_type, typenameVFExpr::value_type, Result >::first_argument_type >::type A1
promote< typenameVFExpr::value_type, typenamedetails::generic_binary_traits< BinaryFunction >::templatehint< typenameNLExpr::value_type, typenameVFExpr::value_type, Result >::second_argument_type >::type A2
void operator()(const self_type &obj, const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
void operator()(const This &obj, const geo_basic< float_type, M > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
static space_constant::valued_type valued_tag(space_constant::valued_type, space_constant::valued_type)
static space_constant::valued_type valued_tag(space_constant::valued_type)
void element_initialize_on_side(const This &obj, const geo_element &K, const side_information_type &sid) const
const point_basic< scalar_type > & get_nl_value(const This &obj, size_type q) const
This::size_type size_type
void element_initialize(const This &obj, const geo_element &K) const
This::scalar_type scalar_type
void element_initialize_on_side(const This &obj, const geo_element &K, const side_information_type &sid) const
This::size_type size_type
void element_initialize(const This &obj, const geo_element &K) const
This::scalar_type scalar_type
const tensor3_basic< scalar_type > & get_nl_value(const This &obj, size_type q) const
void element_initialize_on_side(const This &obj, const geo_element &K, const side_information_type &sid) const
const tensor4_basic< scalar_type > & get_nl_value(const This &obj, size_type q) const
This::size_type size_type
void element_initialize(const This &obj, const geo_element &K) const
This::scalar_type scalar_type
const tensor_basic< scalar_type > & get_nl_value(const This &obj, size_type q) const
void element_initialize_on_side(const This &obj, const geo_element &K, const side_information_type &sid) const
This::size_type size_type
void element_initialize(const This &obj, const geo_element &K) const
This::scalar_type scalar_type
void element_initialize_on_side(const This &obj, const geo_element &K, const side_information_type &sid) const
This::size_type size_type
const scalar_type & get_nl_value(const This &obj, size_type q) const
void element_initialize(const This &obj, const geo_element &K) const
This::scalar_type scalar_type
void element_initialize_on_side(const This &obj, const geo_element &K, const side_information_type &sid) const
Arg1 get_nl_value(const This &obj, size_type q) const
This::size_type size_type
void element_initialize(const This &obj, const geo_element &K) const
helper for generic field value_type: T, point_basic<T> or tensor_basic<T>