1 #ifndef _RHEOLEF_FIELD_EXPR_VARIATIONAL_TERMINAL_H
2 #define _RHEOLEF_FIELD_EXPR_VARIATIONAL_TERMINAL_H
40 #include "rheolef/field_expr.h"
41 #include "rheolef/test.h"
42 #include "rheolef/test_component.h"
90 <<
" discontinuous approximation (HINT: consider grad_h(.))");
120 _expr.initialize (pops, iopt);
127 _expr.initialize (
gh, pops, iopt);
129 template<
class Result>
134 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
136 _expr.template evaluate<Result,details::differentiate_option::gradient> (omega_K, K,
_gopt,
value);
138 template<
class Result>
144 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
145 bool do_local_component_assembly)
const
147 _expr.template evaluate_on_side<Result,details::differentiate_option::gradient> (omega_K, K, sid,
_gopt,
value, do_local_component_assembly);
149 template<
class Value>
155 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value0,
156 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value1,
157 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
159 _expr.local_dg_merge_on_side (omega_K, S, K0, K1, value0, value1,
value);
161 template<
class Result>
163 _expr.template grad_valued_check<Result>();
191 details::is_field_expr_v2_variational_arg<Expr>::value
192 ,details::field_expr_v2_variational_grad<Expr>
196 details::differentiate_option opt;
205 details::is_field_expr_v2_variational_arg<Expr>::value
206 ,details::field_expr_v2_variational_grad<Expr>
210 details::differentiate_option opt;
219 details::is_field_expr_v2_variational_arg<Expr>::value
220 ,details::field_expr_v2_variational_grad<Expr>
224 details::differentiate_option opt;
225 opt.symmetrized =
true;
233 details::is_field_expr_v2_variational_arg<Expr>::value
234 ,details::field_expr_v2_variational_grad<Expr>
238 details::differentiate_option opt;
239 opt.symmetrized =
true;
248 details::is_field_expr_v2_variational_arg<Expr>::value
249 ,details::field_expr_v2_variational_grad<Expr>
253 details::differentiate_option opt;
254 opt.symmetrized =
true;
291 <<
" discontinuous approximation (HINT: consider div_h(.))");
314 _expr.initialize (pops, iopt);
317 _expr.initialize (
gh, pops, iopt);
319 template<
class Result>
323 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
325 _expr.template evaluate<Result,details::differentiate_option::divergence> (omega_K, K,
_gopt,
value);
327 template<
class Result>
332 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value,
333 bool do_local_component_assembly)
const
335 _expr.template evaluate_on_side<Result,details::differentiate_option::divergence> (omega_K, K, sid,
_gopt,
value, do_local_component_assembly);
337 template<
class Result>
339 _expr.template div_valued_check<Result>();
341 template<
class Value>
347 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value0,
348 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value1,
349 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
351 _expr.local_dg_merge_on_side (omega_K, S, K0, K1, value0, value1,
value);
379 details::is_field_expr_v2_variational_arg<Expr>::value
380 ,details::field_expr_v2_variational_div<Expr>
384 details::differentiate_option opt;
393 details::is_field_expr_v2_variational_arg<Expr>::value
394 ,details::field_expr_v2_variational_div<Expr>
398 details::differentiate_option opt;
437 <<
" discontinuous approximation (HINT: consider curl_h(.))");
462 _expr.initialize (pops, iopt);
465 _expr.initialize (
gh, pops, iopt);
467 template<
class Result>
471 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
473 _expr.template evaluate<Result,details::differentiate_option::curl> (omega_K, K,
_gopt,
value);
475 template<
class Value>
481 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value0,
482 const Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value1,
483 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
485 _expr.local_dg_merge_on_side (omega_K, S, K0, K1, value0, value1,
value);
488 _expr.template valued_check<point_basic<scalar_type> >();
490 check_macro (
d==2,
"unexpected "<<
d<<
"D physical dimension for the scalar-valued curl() operator");
494 check_macro (
d==2 ||
d==3,
"unexpected "<<
d<<
"D physical dimension for the vector-valued curl() operator");
496 _expr.template valued_check<scalar_type>();
498 _expr.template valued_check<point_basic<scalar_type> >();
502 fatal_macro (
"unexpected tensor-valued result for the curl() operator");
504 template<
class Result>
534 details::is_field_expr_v2_variational_arg<Expr>::value
535 ,details::field_expr_v2_variational_curl<Expr>
539 details::differentiate_option opt;
540 opt.batchelor_curl =
true;
816 _expr0.initialize (pops, iopt);
817 _expr1.initialize (pops, iopt);
823 fatal_macro (
"unsupported discontinuous Galerkin on a band");
825 template<
class Result>
829 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const;
831 template<
class Result>
835 <<
" for jump or average operator (HINT: omit jump or average)");
836 _expr0.template valued_check<Result>();
854 template<
class Result>
859 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic>&
value)
const
861 trace_macro (
"evaluate_dg: "<<K.
name()<<K.
dis_ie()<<
"...")
862 check_macro (_bgd_omega == omega_K.get_background_geo().get_background_geo(),
863 "discontinuous Galerkin: incompatible integration domain "<<omega_K.name() <<
" and test function in "
864 << get_vf_space().
name());
868 check_macro (L_dis_ie0 != std::numeric_limits<size_type>::max(),
870 const geo_element& L0 = _bgd_omega.dis_get_geo_element (L_map_d, L_dis_ie0);
873 if (L_dis_ie1 == std::numeric_limits<size_type>::max()) {
875 bool do_local_component_assembly =
true;
876 _expr0.evaluate_on_side (omega_K, L0, sid0,
value, do_local_component_assembly);
879 if (_c0 == 0) {
value.fill (Result()); }
882 const geo_element& L1 = _bgd_omega.dis_get_geo_element (L_map_d, L_dis_ie1);
885 Eigen::Matrix<Result,Eigen::Dynamic,Eigen::Dynamic> value0, value1;
886 bool do_local_component_assembly =
false;
887 _expr0.evaluate_on_side (omega_K, L0, sid0, value0, do_local_component_assembly);
888 _expr1.evaluate_on_side (omega_K, L1, sid1, value1, do_local_component_assembly);
889 for (
size_type loc_inod = 0, loc_nnod = value0.rows(); loc_inod < loc_nnod; ++loc_inod) {
890 for (
size_type loc_idof = 0, loc_ndof = value0.cols(); loc_idof < loc_ndof; ++loc_idof) {
891 value0 (loc_inod,loc_idof) = _c0*value0 (loc_inod,loc_idof);
893 for (
size_type loc_inod = 0, loc_nnod = value1.rows(); loc_inod < loc_nnod; ++loc_inod) {
894 for (
size_type loc_idof = 0, loc_ndof = value1.cols(); loc_idof < loc_ndof; ++loc_idof) {
895 value1 (loc_inod,loc_idof) = _c1*value1 (loc_inod,loc_idof);
899 _expr0.local_dg_merge_on_side (omega_K, K, L0, L1, value0, value1,
value);
901 trace_macro (
"evaluate_dg: "<<K.
name()<<K.
dis_ie()<<
" done")
908 #define _RHEOLEF_make_field_expr_v2_variational_dg(op,c0,c1) \
909 template<class Expr> \
913 details::is_field_expr_v2_variational_arg<Expr>::value \
914 ,details::field_expr_v2_variational_dg<Expr> \
916 op (const Expr& expr) \
918 return details::field_expr_v2_variational_dg <Expr> (expr, c0, c1); \
925 #undef _RHEOLEF_make_field_expr_v2_variational_dg
field::size_type size_type
field gh(Float epsilon, Float t, const field &uh, const test &v)
field_expr_v2_variational_curl(const Expr &expr, const differentiate_option &gopt=differentiate_option())
space_basic< scalar_type, memory_type > space_type
void _valued_check_internal(const tensor_basic< scalar_type > &) const
undeterminated_basic< scalar_type > value_type
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
differentiate_option _gopt
void valued_check() const
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
field_expr_v2_variational_curl< typename Expr::dual_self_type > dual_self_type
void _valued_check_internal(const point_basic< scalar_type > &) 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
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
void _valued_check_internal(const scalar_type &) const
float_traits< scalar_type >::type float_type
Expr::memory_type memory_type
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_curl< Expr > self_type
scalar_traits< typename Expr::value_type >::type scalar_type
const space_type & get_vf_space() const
Expr::vf_tag_type vf_tag_type
geo_element::size_type size_type
space_constant::valued_type valued_tag() const
geo_basic< float_type, memory_type > _bgd_omega
reference_element _tilde1_L1
reference_element _tilde0_L0
Expr::scalar_type scalar_type
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
field_expr_v2_variational_dg< typename Expr::dual_self_type > dual_self_type
field_expr_v2_variational_dg(const Expr &expr, const float_type &c0, const float_type &c1)
void valued_check() const
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
Expr::space_type space_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
Expr::size_type size_type
Expr::value_type value_type
Expr::memory_type memory_type
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, Eigen::Dynamic > &value) const
const space_type & get_vf_space() const
field_expr_v2_variational_dg< Expr > self_type
Expr::vf_tag_type vf_tag_type
Expr::float_type float_type
space_constant::valued_type valued_tag() const
space_basic< scalar_type, memory_type > space_type
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
field_expr_v2_variational_div< Expr > self_type
differentiate_option _gopt
field_expr_v2_variational_div(const Expr &expr, const differentiate_option &gopt=differentiate_option())
void valued_check() const
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt) 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
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
float_traits< scalar_type >::type float_type
Expr::memory_type memory_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
field_expr_v2_variational_div< typename Expr::dual_self_type > dual_self_type
scalar_traits< typename Expr::value_type >::type scalar_type
space_constant::rank_down< typename Expr::value_type >::type value_type
const space_type & get_vf_space() const
Expr::vf_tag_type vf_tag_type
geo_element::size_type size_type
space_constant::valued_type valued_tag() const
field_expr_v2_variational_grad(const field_expr_v2_variational_grad< Expr > &x)
space_basic< scalar_type, memory_type > space_type
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt) const
field_expr_v2_variational_grad(const Expr &expr, const differentiate_option &gopt=differentiate_option())
field_expr_v2_variational_grad< typename Expr::dual_self_type > dual_self_type
field_expr_v2_variational_grad< Expr > self_type
differentiate_option _gopt
void valued_check() const
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt) 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
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
float_traits< scalar_type >::type float_type
space_constant::rank_up< typename Expr::value_type >::type value_type
Expr::memory_type memory_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
scalar_traits< typename Expr::value_type >::type scalar_type
const space_type & get_vf_space() const
Expr::vf_tag_type vf_tag_type
geo_element::size_type size_type
space_constant::valued_type valued_tag() const
see the geo_element page for the full documentation
reference_element::size_type size_type
size_type dimension() const
size_type master(bool i) const
orientation_type get_side_informations(const geo_element &S, size_type &loc_isid, size_type &shift) const
see the integrate_option page for the full documentation
see the reference_element page for the full documentation
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
const std::string & valued_name(valued_type valued_tag)
This file is part of Rheolef.
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type Ds(const Expr &expr)
Ds(uh): see the expression page for the full documentation.
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type grad_s(const Expr &expr)
grad_s(uh): see the expression page for the full documentation
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::curl >>::type curl(const Expr &expr)
curl(uh): see the expression page for the full documentation
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::divergence >>::type div_h(const Expr &expr)
div_h(uh): see the expression page for the full documentation
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type Dh(const Expr &expr)
Dh(uh): see the expression page for the full documentation.
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type grad(const Expr &expr)
grad(uh): see the expression page for the full documentation
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type grad_h(const Expr &expr)
grad_h(uh): see the expression page for the full documentation
_RHEOLEF_make_field_expr_v2_variational_dg(jump, 1, -1) _RHEOLEF_make_field_expr_v2_variational_dg(average
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::gradient >>::type D(const Expr &expr)
D(uh): see the expression page for the full documentation.
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::divergence >>::type div(const Expr &expr)
div(uh): see the expression page for the full documentation
std::enable_if< details::is_field_convertible< Expr >::value,details::field_expr_v2_nonlinear_terminal_field< typename Expr::scalar_type,typename Expr::memory_type,details::differentiate_option::divergence >>::type div_s(const Expr &expr)
div_s(uh): see the expression page for the full documentation
std::enable_if< details::is_field_expr_v2_variational_arg< Expr >::value,details::field_expr_v2_variational_curl< Expr >>::type bcurl(const Expr &expr)
helper for generic field value_type: T, point_basic<T> or tensor_basic<T>