1 #ifndef _RHEO_INTEGRATE_H
2 #define _RHEO_INTEGRATE_H
182 #include "rheolef/field_expr.h"
183 #include "rheolef/field_expr_variational.h"
184 #include "rheolef/form_expr_variational.h"
186 #include "rheolef/field_expr_value_assembly.h"
187 #include "rheolef/field_vf_assembly.h"
188 #include "rheolef/form_vf_assembly.h"
189 #include "rheolef/form_expr_quadrature.h"
190 #include "rheolef/field_expr_quadrature.h"
191 #include "rheolef/form_lazy_expr.h"
193 #include "rheolef/functor.h"
202 template <
class T,
class M,
class Expr,
203 class Result =
typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
205 typename std::enable_if<
206 details::is_field_expr_v2_nonlinear_arg<Expr>::value
207 && ! is_undeterminated<Result>::value,
212 Result
dummy = Result())
215 if (omega.map_dimension() < omega.get_background_geo().map_dimension()) {
216 omega.get_background_geo().neighbour_guard();
225 template <
class T,
class M>
230 if (iopt.get_order() == std::numeric_limits<integrate_option::size_type>::max()) {
240 template<
class T,
class M,
class Expr>
242 typename std::enable_if<
243 details::is_field_expr_v2_nonlinear_arg<Expr>::value
244 && is_undeterminated<typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
::value,
245 typename scalar_traits<typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
::type
250 typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type undef_t;
252 switch (
expr.valued_tag()) {
262 <<
"' valued expression");
271 template <
class T,
class M,
class Expr>
275 details::is_field_expr_quadrature_arg<Expr>::value
282 const integrate_option& iopt = integrate_option())
288 template <
class T,
class M,
class Expr>
292 details::is_field_expr_v2_variational_arg<Expr>::value
299 const integrate_option& fopt = integrate_option())
307 template <
class Expr>
311 details::is_field_expr_quadrature_arg<Expr>::value
312 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
317 const integrate_option& iopt = integrate_option())
321 dom =
expr.get_vf_space().get_constitution().get_geo();
322 lh.do_integrate (dom,
expr, iopt);
325 template <
class Expr>
329 details::is_field_expr_v2_variational_arg<Expr>::value
330 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
335 const integrate_option& fopt = integrate_option())
343 template <
class Expr>
347 details::is_field_expr_quadrature_arg<Expr>::value
348 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
352 const std::string& domname,
354 const integrate_option& iopt = integrate_option())
358 dom =
expr.get_vf_space().get_constitution().get_geo() [domname];
359 lh.do_integrate (dom,
expr, iopt);
362 template <
class Expr>
366 details::is_field_expr_v2_variational_arg<Expr>::value
367 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
371 const std::string& domname,
373 const integrate_option& fopt = integrate_option())
376 return integrate (domname, expr_quad, fopt);
383 template <
class T,
class M,
class Expr>
387 details::is_form_expr_quadrature_arg<Expr>::value
388 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
394 const integrate_option& fopt = integrate_option())
400 template <
class T,
class M,
class Expr>
404 details::is_form_expr_v2_variational_arg<Expr>::value
405 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
411 const integrate_option& fopt = integrate_option())
419 template <
class Expr>
423 details::is_form_expr_quadrature_arg<Expr>::value
424 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
429 const integrate_option& fopt = integrate_option())
433 dom_trial =
expr.get_trial_space().get_constitution().get_geo(),
434 dom_test =
expr.get_test_space().get_constitution().get_geo(),
437 if (dom_trial.is_broken() && dom_test.is_broken() &&
438 expr.get_trial_space().get_constitution().is_hierarchical() &&
439 expr.get_test_space().get_constitution().is_hierarchical() ) {
440 dom = dom_test.get_background_geo();
441 }
else if (dom_trial.name() == dom_test.name() ||
442 dom_trial.name() == dom_test.get_background_geo().name() ||
443 dom_trial.is_broken()) {
445 }
else if (dom_test.name() == dom_trial.get_background_geo().name() ||
446 dom_test.is_broken()) {
449 error_macro(
"integrate: incompatible domains: trial \""<<dom_trial.name()
450 <<
"\" and \"" << dom_test.name() <<
"\"");
452 trace_macro (
"dom_trial="<<dom_trial.name()<<
" dom_test="<<dom_test.name()<<
" -> dom="<<dom.name());
453 a.do_integrate (dom,
expr, fopt);
456 template <
class Expr>
460 details::is_form_expr_v2_variational_arg<Expr>::value
461 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
466 const integrate_option& fopt = integrate_option())
474 template <
class Expr>
478 details::is_form_expr_quadrature_arg<Expr>::value
479 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
483 const std::string& domname,
485 const integrate_option& fopt = integrate_option())
489 dom =
expr.get_trial_space().get_constitution().get_background_geo()[domname];
490 a.do_integrate (dom,
expr, fopt);
493 template <
class Expr>
497 details::is_form_expr_v2_variational_arg<Expr>::value
498 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
502 const std::string& domname,
504 const integrate_option& fopt = integrate_option())
507 return integrate (domname, expr_quad, fopt);
512 template <
class T,
class M,
class Expr>
516 details::is_field_expr_quadrature_arg<Expr>::value
517 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
521 const band_basic<T,M>&
gh,
523 const integrate_option& iopt = integrate_option())
529 template <
class T,
class M,
class Expr>
533 details::is_field_expr_v2_variational_arg<Expr>::value
534 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
538 const band_basic<T,M>&
gh,
540 const integrate_option& iopt = integrate_option())
546 template <
class T,
class M,
class Expr>
550 details::is_form_expr_quadrature_arg<Expr>::value
551 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
555 const band_basic<T,M>&
gh,
557 const integrate_option& fopt = integrate_option())
560 a.do_integrate (
gh,
expr, fopt);
563 template <
class T,
class M,
class Expr>
567 details::is_form_expr_v2_variational_arg<Expr>::value
568 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
572 const band_basic<T,M>&
gh,
574 const integrate_option& fopt = integrate_option())
585 template <
class Expr>
589 details::is_field_expr_quadrature_arg<Expr>::value
590 ,details::field_lazy_terminal_integrate <Expr>
594 const typename Expr::geo_type&
domain,
596 const integrate_option& iopt = integrate_option())
598 return details::field_lazy_terminal_integrate<Expr> (
domain,
expr, iopt);
600 template <
class Expr>
604 details::is_field_expr_v2_variational_arg<Expr>::value
605 ,details::field_lazy_terminal_integrate <details::field_expr_quadrature_on_element<Expr>>
609 const geo_basic<typename Expr::scalar_type, typename Expr::memory_type>&
domain,
611 const integrate_option& iopt = integrate_option())
613 details::field_expr_quadrature_on_element<Expr> expr_quad(
expr);
619 template <
class Expr>
623 details::is_field_expr_quadrature_arg<Expr>::value
624 ,details::field_lazy_terminal_integrate <Expr>
629 const integrate_option& fopt = integrate_option())
631 return details::field_lazy_terminal_integrate<Expr> (
expr, iopt);
633 template <
class Expr>
637 details::is_field_expr_v2_variational_arg<Expr>::value
638 ,details::field_lazy_terminal_integrate <details::field_expr_quadrature_on_element<Expr>>
643 const integrate_option& fopt = integrate_option())
645 details::field_expr_quadrature_on_element<Expr> expr_quad(
expr);
651 template <
class Expr>
655 details::is_field_expr_quadrature_arg<Expr>::value
656 ,details::field_lazy_terminal_integrate <Expr>
660 const std::string& domname,
662 const integrate_option& fopt = integrate_option())
664 return details::field_lazy_terminal_integrate<Expr> (domname,
expr, iopt);
666 template <
class Expr>
670 details::is_field_expr_v2_variational_arg<Expr>::value
671 ,details::field_lazy_terminal_integrate <details::field_expr_quadrature_on_element<Expr>>
675 const std::string& domname,
677 const integrate_option& fopt = integrate_option())
679 details::field_expr_quadrature_on_element<Expr> expr_quad(
expr);
688 template <
class Expr>
692 details::is_form_expr_quadrature_arg<Expr>::value
693 ,details::form_lazy_terminal_integrate <Expr>
699 const integrate_option& iopt = integrate_option())
703 template <
class Expr>
707 details::is_form_expr_v2_variational_arg<Expr>::value
708 ,details::form_lazy_terminal_integrate <details::form_expr_quadrature_on_element<Expr>>
714 const integrate_option& iopt = integrate_option())
722 template <
class Expr>
726 details::is_form_expr_quadrature_arg<Expr>::value
727 ,details::form_lazy_terminal_integrate <Expr>
732 const integrate_option& fopt = integrate_option())
738 dom_trial =
expr.get_trial_space().get_constitution().get_geo(),
739 dom_test =
expr. get_test_space().get_constitution().get_geo(),
742 if (dom_trial.is_broken() && dom_test.is_broken() &&
743 expr.get_trial_space().get_constitution().is_hierarchical() &&
744 expr. get_test_space().get_constitution().is_hierarchical() ) {
745 dom = dom_test.get_background_geo();
746 }
else if (dom_trial.name() == dom_test.name() ||
747 dom_trial.name() == dom_test.get_background_geo().name() ||
748 dom_trial.is_broken()) {
749 dom = has_on_local_sides ? dom_trial : dom_test;
750 }
else if (dom_test.name() == dom_trial.get_background_geo().name() ||
751 dom_test.is_broken()) {
752 dom = has_on_local_sides ? dom_test : dom_trial;
754 error_macro(
"integrate: incompatible domains: trial \""<<dom_trial.name()
755 <<
"\" and \"" << dom_test.name() <<
"\"");
759 trace_macro (
"dom_trial="<<dom_trial.name()<<
" dom_test="<<dom_test.name()<<
" -> dom="<<dom.name());
762 template <
class Expr>
766 details::is_form_expr_v2_variational_arg<Expr>::value
767 ,details::form_lazy_terminal_integrate <details::form_expr_quadrature_on_element<Expr>>
772 const integrate_option& fopt = integrate_option())
780 template <
class Expr>
784 details::is_form_expr_quadrature_arg<Expr>::value
785 ,details::form_lazy_terminal_integrate <Expr>
789 const std::string& domname,
791 const integrate_option& fopt = integrate_option())
795 dom =
expr.get_trial_space().get_constitution().get_background_geo()[domname];
798 template <
class Expr>
802 details::is_form_expr_v2_variational_arg<Expr>::value
803 ,details::form_lazy_terminal_integrate <details::form_expr_quadrature_on_element<Expr>>
807 const std::string& domname,
809 const integrate_option& fopt = integrate_option())
field lh(Float epsilon, Float t, const test &v)
field gh(Float epsilon, Float t, const field &uh, const test &v)
typename scalar_traits< value_type >::type scalar_type
static iorheo::force_initialization dummy
#define trace_macro(message)
#define error_macro(message)
#define warning_macro(message)
void field_expr_v2_value_assembly(const geo_basic< T, M > &omega, const Expr &expr0, const integrate_option &iopt, Result &result)
const std::string & valued_name(valued_type valued_tag)
This file is part of Rheolef.
std::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr >::value &&! is_undeterminated< Result >::value, Result >::type integrate(const geo_basic< T, M > &omega, const Expr &expr, const integrate_option &iopt, Result dummy=Result())
see the integrate page for the full documentation
std::enable_if< details::is_field_expr_quadrature_arg< Expr >::value,details::field_lazy_terminal_integrate< Expr >>::type lazy_integrate(const typename Expr::geo_type &domain, const Expr &expr, const integrate_option &iopt=integrate_option())
see the integrate page for the full documentation