1#ifndef _RHEOLEF_COMPOSE_H
2#define _RHEOLEF_COMPOSE_H
80#include "rheolef/field_expr.h"
89template<
class NaryFunctor,
class... Exprs>
94 static const size_t N =
sizeof...(Exprs);
132 template<
size_t ...Is>
137 bool status_list[] = {(std::get<Is>(
_exprs).initialize (pops, iopt),
true)...};
139 template<
size_t ...Is>
145 bool status_list[] = {(std::get<Is>(
_exprs).initialize (Xh, pops, iopt),
true)...};
161 template<
class Result,
size_t ...Is>
165 Eigen::Matrix<Result,Eigen::Dynamic,1>& value,
173 typename traits::template arg<Is>::type
179 vec_args_type value_i;
180 bool status_list[] = {(std::get<Is>(
_exprs).evaluate (omega_K, K, std::get<Is>(value_i)),
true)...};
181 size_type loc_nnod = std::get<0>(value_i).size();
182 static const int narg =
sizeof...(Is);
183 size_type size_list[] = {std::get<Is>(value_i).size()...};
184 for (
size_type iarg = 1; iarg < narg; ++iarg) {
185 check_macro(size_list[iarg] == loc_nnod,
"invalid "<<iarg<<
"-th arg-value size="<<size_list[iarg]
186 <<
" and 0-th arg-value size="<<loc_nnod);
188 value.resize (loc_nnod);
189 for (
size_type loc_inod = 0; loc_inod < loc_nnod; ++loc_inod) {
190 value[loc_inod] =
_f (std::get<Is>(value_i)[loc_inod]...);
193 template<
class Result>
197 Eigen::Matrix<Result,Eigen::Dynamic,1>& value)
const
201 template<
class Result,
size_t ...Is>
205 "compose; incompatible function " << typename_macro(NaryFunctor)
207 <<
" and expected value " << typename_macro(Result));
210 typename nary_functor_traits::template arg<Is>::decay_type>()... };
212 for (
bool status_i : status_list) { status &= status_i; }
215 template<
class Result>
237template<
class Function,
class... Exprs>
239typename std::enable_if <
240 sizeof...(Exprs) >= 3,
247compose (
const Function&
f,
const Exprs&... exprs) {
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value) const
std::tuple< Exprs... > _exprs
functor_traits< typename std::decay< NaryFunctor >::type > nary_functor_traits
bool valued_check() const
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
range_builder< 0, N >::type IndexRange
void _initialize_internal(const space_basic< float_type, memory_type > &Xh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt, index_list< Is... >)
typename nary_functor_traits::result_type result_type
static const space_constant::valued_type valued_hint
field_expr_v2_nonlinear_node_nary(const NaryFunctor &f, const Exprs &... exprs)
void _evaluate_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Matrix< Result, Eigen::Dynamic, 1 > &value, index_list< Is... >) const
scalar_traits< value_type >::type scalar_type
void _initialize_internal(const piola_on_pointset< float_type > &pops, const integrate_option &iopt, index_list< Is... >)
rheo_default_memory_model memory_type
bool _valued_check_internal(Result, index_list< Is... >) const
void initialize(const space_basic< float_type, memory_type > &Xh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
float_traits< value_type >::type float_type
geo_element::size_type size_type
space_constant::valued_type valued_tag() 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
#define rheo_default_memory_model
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
This file is part of Rheolef.
details::field_expr_v2_nonlinear_node_nary< typename details::function_traits< Function >::functor_type, typename details::field_expr_v2_nonlinear_terminal_wrapper_traits< Exprs >::type... > ::type compose(const Function &f, const Exprs &... exprs)
see the compose page for the full documentation
static space_constant::valued_type valued_tag(space_constant::valued_type, space_constant::valued_type)