1#ifndef _RHEOLEF_FORM_EXPR_QUADRATURE_H
2#define _RHEOLEF_FORM_EXPR_QUADRATURE_H
90#include "rheolef/form_expr_variational.h"
91#include "rheolef/init_expr_quadrature.h"
124 typedef geo_basic <float_type,memory_type>
geo_type;
137 template<class Sfinae = typename std::enable_if<is_form_expr_v2_variational_arg<Expr>::value, Expr>::type>
151 template<
class Value>
155 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& ak)
const;
157 template<
class Value>
177template<
class Sfinae>
193 _pops.initialize (omega_K.get_piola_basis(), quad, new_iopt);
194 _expr.initialize (_pops, new_iopt);
204 _pops.initialize (
gh.band().get_piola_basis(), quad, new_iopt);
205 _expr.initialize (
gh, _pops, new_iopt);
213 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& ak)
const
215 const Eigen::Matrix<float_type,Eigen::Dynamic,1>& w = _pops.get_weight (omega_K, K);
216 _expr.evaluate (omega_K, K, _value_i);
219 size_t ni = _value_i.dimension(0);
220 size_t nj = _value_i.dimension(1);
221 size_t nk = _value_i.dimension(2);
223 for (
size_t j = 0; j < nj; ++j) {
224 for (
size_t k = 0; k < nk; ++k) {
226 for (
size_t i = 0; i < ni; ++i) {
227 sum += w[i] * _value_i(i,j,k);
252 typedef geo_basic <float_type,memory_type>
geo_type;
265 template<class Sfinae = typename std::enable_if<is_form_expr_v2_variational_arg<Expr>::value, Expr>::type>
279 template<
class Value>
283 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& ak)
const;
285 template<
class Value>
308template<
class Sfinae>
313 _ignore_sys_coord(false),
327 _pops.initialize (omega_K.get_piola_basis(), quad, new_iopt);
328 _expr.initialize (_pops, new_iopt);
338 _pops.initialize (
gh.band().get_piola_basis(), quad, new_iopt);
339 _expr.initialize (
gh, _pops, new_iopt);
340 fatal_macro(
"on_local_sides: banded-level set not yet supported, sorry");
348 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value)
const
351 size_type nyi = get_test_space().get_constitution().assembly_loc_ndof (omega_K, K);
352 size_type nxj = get_trial_space().get_constitution().assembly_loc_ndof (omega_K, K);
355 const geo_element& S = omega_K.dis_get_geo_element (sid_dim, dis_isid);
358 _expr.evaluate_on_side (omega_K, K, sid, _value_i);
359 const Eigen::Matrix<float_type,Eigen::Dynamic,1>& w = _pops.get_weight (omega_K, S);
361 size_t ni = _value_i.dimension(0);
362 size_t nj = _value_i.dimension(1);
363 size_t nk = _value_i.dimension(2);
365 value = Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>::Zero(nj, nk);
367 for (
size_t j = 0; j < nj; ++j) {
368 for (
size_t k = 0; k < nk; ++k) {
370 for (
size_t i = 0; i < ni; ++i) {
371 sum += w[i] * _value_i(i,j,k);
400template<
class UnaryFunction,
class Expr>
410 typename Expr::value_type
415 typedef geo_basic <float_type,memory_type>
geo_type;
428 template<class Sfinae = typename std::enable_if<is_form_expr_quadrature_arg<Expr>::value, Expr>::type>
441 return _expr.initialize (omega_K, iopt); }
443 return _expr.initialize (
gh, iopt); }
445 template<
class Value>
449 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value)
const
452 _expr.evaluate (omega_K, K, value);
453 for (
size_type i = 0, ni = value.rows(); i < ni; ++i) {
454 for (
size_type j = 0, nj = value.cols(); j < nj; ++j) {
455 value(i,j) =
_f (value(i,j));
458 template<
class Value>
476#define _RHEOLEF_make_form_expr_quadrature_unary(FUNCTION,FUNCTOR) \
477template<class Expr> \
481 details::is_form_expr_quadrature_arg<Expr>::value \
482 ,details::form_expr_quadrature_unary< \
487FUNCTION (const Expr& expr) \
489 return details::form_expr_quadrature_unary <FUNCTOR,Expr> (FUNCTOR(), expr); \
494#undef _RHEOLEF_make_form_expr_quadrature_unary
506template<
class BinaryFunction,
class Expr1,
class Expr2>
515 typename Expr1::value_type
518 typename Expr1::value_type
519 ,
typename Expr2::value_type
524 typedef geo_basic <float_type,memory_type>
geo_type;
526 typename Expr1::vf_tag_type,
532 typename Expr2::dual_self_type>
534 typedef typename and_type<
typename Expr1::maybe_symmetric::type,
535 typename Expr2::maybe_symmetric::type>::type
542 template<
class Sfinae
543 =
typename std::enable_if<
563 _expr1.initialize (omega_K, new_iopt);
564 _expr2.initialize (omega_K, new_iopt);
571 template<
class Value>
575 Eigen::Matrix<Value,Eigen::Dynamic,Eigen::Dynamic>& value)
const
582 Eigen::Matrix<A2,Eigen::Dynamic,Eigen::Dynamic> value2 (value.cols(), value.cols());
583 _expr1.evaluate (omega_K, K, value);
584 _expr2.evaluate (omega_K, K, value2);
585 for (
size_type i = 0, ni = value.rows(); i < ni; ++i) {
586 for (
size_type j = 0, nj = value.cols(); j < nj; ++j) {
587 value(i,j) =
_f (value(i,j), value2(i,j));
590 template<
class Value>
616#define _RHEOLEF_form_expr_quadrature_binary(FUNCTION,FUNCTOR) \
617template <class Expr1, class Expr2> \
621 details::is_form_expr_quadrature_arg <Expr1>::value \
622 && details::is_form_expr_quadrature_arg <Expr2>::value \
623 ,details::form_expr_quadrature_binary< \
629FUNCTION (const Expr1& expr1, const Expr2& expr2) \
631 return details::form_expr_quadrature_binary \
632 <FUNCTOR, Expr1, Expr2> \
633 (FUNCTOR(), expr1, expr2); \
635template <class Expr1, class ExprVar2> \
639 details::is_form_expr_quadrature_arg <Expr1>::value \
640 && details::is_form_expr_v2_variational_arg <ExprVar2>::value \
641 ,details::form_expr_quadrature_binary< \
644 ,details::form_expr_quadrature_on_element<ExprVar2> \
647FUNCTION (const Expr1& expr1, const ExprVar2& expr_var2) \
649 using Expr2 = details::form_expr_quadrature_on_element<ExprVar2>; \
650 return details::form_expr_quadrature_binary \
651 <FUNCTOR, Expr1, Expr2> \
652 (FUNCTOR(), expr1, Expr2(expr_var2)); \
654template <class ExprVar1, class Expr2> \
658 details::is_form_expr_v2_variational_arg <ExprVar1>::value \
659 && details::is_form_expr_quadrature_arg <Expr2>::value \
660 ,details::form_expr_quadrature_binary< \
662 ,details::form_expr_quadrature_on_element<ExprVar1> \
666FUNCTION (const ExprVar1& expr_var1, const Expr2& expr2) \
668 using Expr1 = details::form_expr_quadrature_on_element<ExprVar1>; \
669 return details::form_expr_quadrature_binary \
670 <FUNCTOR, Expr1, Expr2> \
671 (FUNCTOR(), Expr1(expr_var1), expr2); \
677#undef _RHEOLEF_form_expr_quadrature_binary
688template<
class Expr1,
class Expr2,
class Sfinae =
void>
691template<
class Expr1,
class Expr2>
697 is_rheolef_arithmetic <Expr1>::value
698 && is_form_expr_quadrature_arg<Expr2>::value
704template<
class Expr1,
class Expr2>
710#define _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant_left(FUNCTION,FUNCTOR) \
711template<class Expr1, class Expr2> \
715 details::is_form_expr_quadrature_binary_multiplies_divides_constant_left <Expr1,Expr2>::value \
716 ,details::form_expr_quadrature_unary< \
717 details::binder_first <FUNCTOR, Expr1> \
721FUNCTION (const Expr1& expr1, const Expr2& expr2) \
723 return details::form_expr_quadrature_unary \
724 <details::binder_first <FUNCTOR,Expr1>, Expr2> \
725 (details::binder_first <FUNCTOR,Expr1> (FUNCTOR(), expr1), expr2); \
728#define _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant_right(FUNCTION,FUNCTOR) \
729template<class Expr1, class Expr2> \
733 details::is_form_expr_quadrature_binary_multiplies_divides_constant_right <Expr1,Expr2>::value \
734 ,details::form_expr_quadrature_unary< \
735 details::binder_second <FUNCTOR, Expr2> \
739FUNCTION (const Expr1& expr1, const Expr2& expr2) \
741 return details::form_expr_quadrature_unary \
742 <details::binder_second <FUNCTOR,Expr2>, Expr1> \
743 (details::binder_second <FUNCTOR,Expr2> (FUNCTOR(), expr2), expr1); \
746#define _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant(FUNCTION,FUNCTOR) \
747 _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant_left (FUNCTION,FUNCTOR) \
748 _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant_right (FUNCTION,FUNCTOR)
754#undef _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant_right
755#undef _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant_left
756#undef _RHEOLEF_make_form_expr_quadrature_binary_operator_multiplies_divides_constant
field gh(Float epsilon, Float t, const field &uh, const test &v)
generic mesh with rerefence counting
see the geo_element page for the full documentation
size_type edge(size_type i) const
size_type face(size_type i) const
reference_element::size_type size_type
size_type dimension() const
orientation_type get_side_informations(const geo_element &S, size_type &loc_isid, size_type &shift) const
size_type n_subgeo(size_type subgeo_dim) const
see the integrate_option page for the full documentation
bool _is_inside_on_local_sides
#define fatal_macro(message)
integrate_option expr_quadrature_init_iopt(const geo_basic< T, M > &omega_K, const space_basic< T, M > &X, size_t n_derivative, const integrate_option &iopt)
This file is part of Rheolef.
std::enable_if< details::is_field_expr_v2_variational_arg< Expr >::value, details::field_expr_quadrature_on_sides< Expr > >::type on_local_sides(const Expr &expr)
on_local_sides(expr): see the expression page for the full documentation