1 #ifndef _RHEO_INTEGRATE_H
2 #define _RHEO_INTEGRATE_H
174 #include "rheolef/field_expr.h"
175 #include "rheolef/field_expr_variational.h"
176 #include "rheolef/form_expr_variational.h"
178 #include "rheolef/field_expr_value_assembly.h"
179 #include "rheolef/field_vf_assembly.h"
180 #include "rheolef/form_vf_assembly.h"
181 #include "rheolef/form_expr_quadrature.h"
182 #include "rheolef/field_expr_quadrature.h"
184 #include "rheolef/functor.h"
193 template <
class T,
class M,
class Expr,
194 class Result =
typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
196 typename std::enable_if<
197 details::is_field_expr_v2_nonlinear_arg<Expr>::value
198 && ! is_undeterminated<Result>::value,
203 Result
dummy = Result())
206 if (omega.map_dimension() < omega.get_background_geo().map_dimension()) {
207 omega.get_background_geo().neighbour_guard();
216 template <
class T,
class M>
221 if (iopt.get_order() == std::numeric_limits<integrate_option::size_type>::max()) {
231 template<
class T,
class M,
class Expr>
233 typename std::enable_if<
234 details::is_field_expr_v2_nonlinear_arg<Expr>::value
235 && is_undeterminated<typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
::value,
236 typename scalar_traits<typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type>
::type
241 typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr>::type::value_type undef_t;
243 switch (
expr.valued_tag()) {
253 <<
"' valued expression");
262 template <
class T,
class M,
class Expr>
266 details::is_field_expr_quadrature_arg<Expr>::value
273 const integrate_option& iopt = integrate_option())
279 template <
class T,
class M,
class Expr>
283 details::is_field_expr_v2_variational_arg<Expr>::value
290 const integrate_option& fopt = integrate_option())
298 template <
class Expr>
302 details::is_field_expr_quadrature_arg<Expr>::value
303 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
308 const integrate_option& iopt = integrate_option())
312 dom =
expr.get_vf_space().get_constitution().get_geo();
313 lh.assembly (dom,
expr, iopt);
316 template <
class Expr>
320 details::is_field_expr_v2_variational_arg<Expr>::value
321 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
326 const integrate_option& fopt = integrate_option())
334 template <
class Expr>
338 details::is_field_expr_quadrature_arg<Expr>::value
339 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
343 const std::string& domname,
345 const integrate_option& iopt = integrate_option())
349 dom =
expr.get_vf_space().get_constitution().get_geo() [domname];
350 lh.assembly (dom,
expr, iopt);
353 template <
class Expr>
357 details::is_field_expr_v2_variational_arg<Expr>::value
358 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
362 const std::string& domname,
364 const integrate_option& fopt = integrate_option())
367 return integrate (domname, expr_quad, fopt);
374 template <
class T,
class M,
class Expr>
378 details::is_form_expr_quadrature_arg<Expr>::value
379 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
385 const integrate_option& fopt = integrate_option())
391 template <
class T,
class M,
class Expr>
395 details::is_form_expr_v2_variational_arg<Expr>::value
396 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
402 const integrate_option& fopt = integrate_option())
410 template <
class Expr>
414 details::is_form_expr_quadrature_arg<Expr>::value
415 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
420 const integrate_option& fopt = integrate_option())
424 dom_trial =
expr.get_trial_space().get_constitution().get_geo(),
425 dom_test =
expr.get_test_space().get_constitution().get_geo(),
428 if (dom_trial.is_broken() && dom_test.is_broken() &&
429 expr.get_trial_space().get_constitution().is_hierarchical() &&
430 expr.get_test_space().get_constitution().is_hierarchical() ) {
431 dom = dom_test.get_background_geo();
432 }
else if (dom_trial.name() == dom_test.name() ||
433 dom_trial.name() == dom_test.get_background_geo().name() ||
434 dom_trial.is_broken()) {
436 }
else if (dom_test.name() == dom_trial.get_background_geo().name() ||
437 dom_test.is_broken()) {
440 error_macro(
"integrate: incompatible domains: trial \""<<dom_trial.name()
441 <<
"\" and \"" << dom_test.name() <<
"\"");
443 trace_macro (
"dom_trial="<<dom_trial.name()<<
" dom_test="<<dom_test.name()<<
" -> dom="<<dom.name());
444 a.assembly (dom,
expr, fopt);
447 template <
class Expr>
451 details::is_form_expr_v2_variational_arg<Expr>::value
452 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
457 const integrate_option& fopt = integrate_option())
465 template <
class Expr>
469 details::is_form_expr_quadrature_arg<Expr>::value
470 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
474 const std::string& domname,
476 const integrate_option& fopt = integrate_option())
480 dom =
expr.get_trial_space().get_constitution().get_background_geo()[domname];
481 a.assembly (dom,
expr, fopt);
484 template <
class Expr>
488 details::is_form_expr_v2_variational_arg<Expr>::value
489 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
493 const std::string& domname,
495 const integrate_option& fopt = integrate_option())
498 return integrate (domname, expr_quad, fopt);
503 template <
class T,
class M,
class Expr>
507 details::is_field_expr_quadrature_arg<Expr>::value
508 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
512 const band_basic<T,M>&
gh,
514 const integrate_option& iopt = integrate_option())
520 template <
class T,
class M,
class Expr>
524 details::is_field_expr_v2_variational_arg<Expr>::value
525 ,field_basic <typename Expr::scalar_type, typename Expr::memory_type>
529 const band_basic<T,M>&
gh,
531 const integrate_option& iopt = integrate_option())
537 template <
class T,
class M,
class Expr>
541 details::is_form_expr_quadrature_arg<Expr>::value
542 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
546 const band_basic<T,M>&
gh,
548 const integrate_option& fopt = integrate_option())
554 template <
class T,
class M,
class Expr>
558 details::is_form_expr_v2_variational_arg<Expr>::value
559 ,form_basic <typename Expr::scalar_type, typename Expr::memory_type>
563 const band_basic<T,M>&
gh,
565 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 &expr, 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