Loading...
Searching...
No Matches
form_expr_variational.h
Go to the documentation of this file.
#ifndef _RHEOLEF_FORM_EXPR_VARIATIONAL_H
#define _RHEOLEF_FORM_EXPR_VARIATIONAL_H
//
// variational expressions are used for form assembly
//
// author: Pierre.Saramito@imag.fr
//
// date: 23 september 2015
//
// Notes: use template expressions and SFINAE techniques
//
// SUMMARY:
// 1. concept
// 2. unary function
// 2.1. unary node
// 2.2. unary calls
// 3. binary operators +- between two variational forms
// 3.1. binary node
// 3.2. binary calls
// 4. binary operators * between two variational fields that returns a form
// 4.1. unary node
// 4.2. unary calls
// 5. binary operators */ between a variational form and a nonlinear expr
// 5.1. binary node
// 5.2. binary calls
// 6. binary operators */ between a variational form and a constant
//
#include "rheolef/field_expr_variational.h"
namespace rheolef {
// -------------------------------------------------------------------
// 1. concept
// -------------------------------------------------------------------
namespace details {
// Define a trait type for detecting form expression valid arguments
template<class T> struct is_form_expr_v2_variational_arg : std::false_type {};
} // namespace details
// ---------------------------------------------------------------------------
// 2. unary function
// example: -(u*v), 2*(u*v), (u*v)/2
// ---------------------------------------------------------------------------
// 2.1. unary node
// ---------------------------------------------------------------------------
namespace details {
template<class UnaryFunction, class Expr>
class form_expr_v2_variational_unary {
public:
// typedefs:
typedef geo_element::size_type size_type;
typedef typename Expr::memory_type memory_type;
typedef typename details::generic_unary_traits<UnaryFunction>::template result_hint<
typename Expr::value_type>::type result_hint;
typedef typename details::generic_unary_traits<UnaryFunction>::template hint<
typename Expr::value_type
,result_hint>::result_type value_type;
typedef typename scalar_traits<value_type>::type scalar_type;
typedef typename float_traits<value_type>::type float_type;
typedef space_basic<scalar_type,memory_type> space_type;
typedef typename Expr::vf_tag_type vf_tag_type;
typedef typename details::dual_vf_tag<vf_tag_type>::type
vf_dual_tag_type;
typedef form_expr_v2_variational_unary<UnaryFunction,Expr> self_type;
typedef form_expr_v2_variational_unary<UnaryFunction, typename Expr::dual_self_type>
dual_self_type;
typedef typename Expr::maybe_symmetric::type maybe_symmetric;
static const space_constant::valued_type valued_hint = space_constant::valued_tag_traits<value_type>::value;
// alocators:
form_expr_v2_variational_unary (const UnaryFunction& f, const Expr& expr)
: _f(f), _expr(expr) {}
form_expr_v2_variational_unary (const form_expr_v2_variational_unary<UnaryFunction,Expr>& x)
: _f(x._f), _expr(x._expr) {}
form_expr_v2_variational_unary<UnaryFunction,Expr>&
operator= (const form_expr_v2_variational_unary<UnaryFunction,Expr>& x) {
_f = x._f; _expr = x._expr; return *this; }
// accessors:
const space_type& get_trial_space() const { return _expr.get_trial_space(); }
const space_type& get_test_space() const { return _expr.get_test_space(); }
size_type n_derivative() const { return _expr.n_derivative(); }
// mutable modifiers:
void initialize (const piola_on_pointset<float_type>& pops, const integrate_option& iopt) {
_expr.initialize (pops, iopt);
}
void initialize (const band_basic<float_type,memory_type>& gh, const piola_on_pointset<float_type>& pops, const integrate_option& iopt) {
_expr.initialize (gh, pops, iopt);
}
template<class Result>
void evaluate (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
Eigen::Tensor<Result,3>& value) const
{
// Arg=Result=float_type for f in general: elementary matrix,
// so use Result-valued "value" for arg of f:
_expr.evaluate (omega_K, K, value);
for (size_type i = 0, ni = value.dimension(0); i < ni; ++i) {
for (size_type j = 0, nj = value.dimension(1); j < nj; ++j) {
for (size_type k = 0, nk = value.dimension(2); k < nk; ++k) {
value(i,j,k) = _f (value(i,j,k));
}}}
}
template<class Result>
bool valued_check() const {
typedef Result A1;
if (! is_undeterminated<A1>::value) return _expr.template valued_check<A1>();
return true;
}
protected:
// data:
UnaryFunction _f;
Expr _expr;
};
template<class F, class Expr> struct is_form_expr_v2_variational_arg <form_expr_v2_variational_unary<F,Expr> > : std::true_type {};
} // namespace details
// ---------------------------------------------------------------------------
// 2.2. unary calls
// ---------------------------------------------------------------------------
#define _RHEOLEF_make_form_expr_v2_variational_unary(FUNCTION,FUNCTOR) \
template<class Expr> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_arg<Expr>::value \
,details::form_expr_v2_variational_unary< \
FUNCTOR \
,Expr \
> \
>::type \
FUNCTION (const Expr& expr) \
{ \
return details::form_expr_v2_variational_unary <FUNCTOR,Expr> (FUNCTOR(), expr); \
}
_RHEOLEF_make_form_expr_v2_variational_unary (operator+, details::unary_plus)
_RHEOLEF_make_form_expr_v2_variational_unary (operator-, details::negate)
#undef _RHEOLEF_make_form_expr_v2_variational_unary
// ---------------------------------------------------------------------------
// 3. binary operators +- between two variational forms
// ---------------------------------------------------------------------------
// 3.1. binary node
// ---------------------------------------------------------------------------
// example: operator+ between two forms as in
// (u*v) + dot(grad(u),grad(v))
namespace details {
template<class BinaryFunction, class Expr1, class Expr2>
class form_expr_v2_variational_binary {
public:
// typedefs:
typedef geo_element::size_type size_type;
typedef typename promote_memory<typename Expr1::memory_type,typename Expr2::memory_type>::type
memory_type;
typedef typename details::generic_binary_traits<BinaryFunction>::template result_hint<
typename Expr1::value_type
,typename Expr2::value_type>::type result_hint;
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,result_hint>::result_type value_type;
typedef typename scalar_traits<value_type>::type scalar_type;
typedef typename float_traits<value_type>::type float_type;
typedef space_basic<scalar_type,memory_type> space_type; // TODO: deduce from Exprs
typedef typename details::bf_vf_tag<BinaryFunction,
typename Expr1::vf_tag_type,
typename Expr2::vf_tag_type>::type vf_tag_type;
typedef typename details::dual_vf_tag<vf_tag_type>::type
vf_dual_tag_type;
typedef form_expr_v2_variational_binary<BinaryFunction,Expr1,Expr2> self_type;
typedef form_expr_v2_variational_binary<BinaryFunction,typename Expr1::dual_self_type,
typename Expr2::dual_self_type>
dual_self_type;
typedef typename and_type<typename Expr1::maybe_symmetric::type,
typename Expr2::maybe_symmetric::type>::type
maybe_symmetric;
static const space_constant::valued_type valued_hint = space_constant::valued_tag_traits<value_type>::value;
// alocators:
form_expr_v2_variational_binary (const BinaryFunction& f,
const Expr1& expr1,
const Expr2& expr2)
: _f(f), _expr1(expr1), _expr2(expr2) {}
form_expr_v2_variational_binary (const form_expr_v2_variational_binary<BinaryFunction,Expr1,Expr2>& x)
: _f(x._f), _expr1(x._expr1), _expr2(x._expr2) {}
form_expr_v2_variational_binary<BinaryFunction,Expr1,Expr2>&
operator= (const form_expr_v2_variational_binary<BinaryFunction,Expr1,Expr2>& x)
{ _f = x._f; _expr1 = x._expr1; _expr2 = x._expr2; return *this; }
// accessors:
const space_type& get_trial_space() const { return _expr1.get_trial_space(); }
const space_type& get_test_space() const { return _expr1.get_test_space(); }
size_type n_derivative() const { return std::min(_expr1.n_derivative(), _expr2.n_derivative()); }
// mutable modifiers:
// TODO: at init, check that exp1 & expr2 has the same test & trial spaces
void initialize (const piola_on_pointset<float_type>& pops, const integrate_option& iopt) {
_expr1.initialize (pops, iopt);
_expr2.initialize (pops, iopt);
}
void initialize (const band_basic<float_type,memory_type>& gh, const piola_on_pointset<float_type>& pops, const integrate_option& iopt) {
_expr1.initialize (gh, pops, iopt);
_expr2.initialize (gh, pops, iopt);
}
// Result is float_type in general: elementary matrix
template<class Result>
void evaluate (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
Eigen::Tensor<Result,3>& value) const
{
// for f=operator+ => sum of two elementary matrix of the same type
// TODO: otherwise Result and 2 could be obtained from the hint<> helper
typedef Result A1;
typedef Result A2;
Eigen::Tensor<float_type,3> value1; _expr1.evaluate (omega_K, K, value1);
Eigen::Tensor<float_type,3> value2; _expr2.evaluate (omega_K, K, value2);
value.resize (value1.dimension(0), value1.dimension(1), value1.dimension(2));
check_macro (value1.dimension(0) == value2.dimension(0) &&
value1.dimension(1) == value2.dimension(1) &&
value1.dimension(2) == value2.dimension(2),
"invalid sizes value1("
<< value1.dimension(0) <<","<< value1.dimension(1) <<","<< value1.dimension(2) << ") and value2("
<< value2.dimension(0) <<","<< value2.dimension(1) <<","<< value2.dimension(2) <<")");
for (size_type i = 0, ni = value.dimension(0); i < ni; ++i) {
for (size_type j = 0, nj = value.dimension(1); j < nj; ++j) {
for (size_type k = 0, nk = value.dimension(2); k < nk; ++k) {
value(i,j,k) = _f (value1(i,j,k), value2(i,j,k));
}}}
}
template<class Result>
void evaluate_on_side (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
const side_information_type& sid,
Eigen::Tensor<Result,3>& value) const
{
// for f=operator+ => sum of two elementary matrix of the same type
// TODO: otherwise Result and 2 could be obtained from the hint<> helper
typedef Result A1;
typedef Result A2;
Eigen::Tensor<float_type,3> value1; _expr1.evaluate_on_side (omega_K, K, sid, value1);
Eigen::Tensor<float_type,3> value2; _expr2.evaluate_on_side (omega_K, K, sid, value2);
value.resize (value1.dimension(0), value1.dimension(1), value1.dimension(2));
check_macro (value1.dimension(0) == value2.dimension(0) &&
value1.dimension(1) == value2.dimension(1) &&
value1.dimension(2) == value2.dimension(2),
"invalid sizes value1("
<< value1.dimension(0) <<","<< value1.dimension(1) <<","<< value1.dimension(2) << ") and value2("
<< value2.dimension(0) <<","<< value2.dimension(1) <<","<< value2.dimension(2) <<")");
for (size_type i = 0, ni = value.dimension(0); i < ni; ++i) {
for (size_type j = 0, nj = value.dimension(1); j < nj; ++j) {
for (size_type k = 0, nk = value.dimension(2); k < nk; ++k) {
value(i,j,k) = _f (value1(i,j,k), value2(i,j,k));
}}}
}
template<class Result>
bool valued_check() const {
typedef Result A1;
typedef Result A2;
bool status = true;
if (! is_undeterminated<A1>::value) status &= _expr1.template valued_check<A1>();
if (! is_undeterminated<A2>::value) status &= _expr2.template valued_check<A2>();
return status;
}
protected:
// data:
BinaryFunction _f;
Expr1 _expr1;
Expr2 _expr2;
};
template<class F, class Expr1, class Expr2> struct is_form_expr_v2_variational_arg <form_expr_v2_variational_binary<F,Expr1,Expr2> > : std::true_type {};
} // namespace details
// ---------------------------------------------------------------------------
// 3.2. binary calls
// ---------------------------------------------------------------------------
#define _RHEOLEF_form_expr_v2_variational_binary(FUNCTION,FUNCTOR) \
template <class Expr1, class Expr2> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_arg <Expr1>::value \
&& details::is_form_expr_v2_variational_arg <Expr2>::value \
,details::form_expr_v2_variational_binary< \
FUNCTOR \
,Expr1 \
,Expr2 \
> \
>::type \
FUNCTION (const Expr1& expr1, const Expr2& expr2) \
{ \
return details::form_expr_v2_variational_binary \
<FUNCTOR, Expr1, Expr2> \
(FUNCTOR(), expr1, expr2); \
}
_RHEOLEF_form_expr_v2_variational_binary (operator+, details::plus)
_RHEOLEF_form_expr_v2_variational_binary (operator-, details::minus)
#undef _RHEOLEF_form_expr_v2_variational_binary
// ---------------------------------------------------------------------------
// 4. binary operators * between two variational fields that returns a form
// example: integrate(u*v)
// ---------------------------------------------------------------------------
// 4.1. binary node
// ---------------------------------------------------------------------------
namespace details {
template<class BinaryFunction, class Expr1, class Expr2>
class form_expr_v2_variational_binary_field {
public:
// typedefs:
typedef geo_element::size_type size_type;
typedef typename promote_memory<typename Expr1::memory_type,typename Expr2::memory_type>::type
memory_type;
typedef typename details::generic_binary_traits<BinaryFunction>::template result_hint<
typename Expr1::value_type
,typename Expr2::value_type>::type result_hint;
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,result_hint>::result_type value_type;
typedef typename scalar_traits<value_type>::type scalar_type;
typedef typename float_traits<value_type>::type float_type;
typedef space_basic<scalar_type,memory_type> space_type; // TODO: deduce from Exprs
typedef typename details::bf_vf_tag<BinaryFunction,
typename Expr1::vf_tag_type,
typename Expr2::vf_tag_type>::type vf_tag_type;
typedef typename details::dual_vf_tag<vf_tag_type>::type
vf_dual_tag_type;
typedef form_expr_v2_variational_binary_field<BinaryFunction,Expr1,Expr2> self_type;
typedef form_expr_v2_variational_binary_field<BinaryFunction,typename Expr1::dual_self_type,typename Expr2::dual_self_type>
dual_self_type;
typedef typename and_type<typename details::generic_binary_traits<BinaryFunction>::is_symmetric::type,
typename details::is_equal<
Expr1,
typename Expr2::dual_self_type>::type>::type
maybe_symmetric;
static const space_constant::valued_type valued_hint = space_constant::valued_tag_traits<value_type>::value;
// alocators:
form_expr_v2_variational_binary_field (const BinaryFunction& f,
const Expr1& expr1,
const Expr2& expr2)
: _f(f), _expr1(expr1), _expr2(expr2) {}
form_expr_v2_variational_binary_field<BinaryFunction,Expr1,Expr2>&
operator= (const form_expr_v2_variational_binary_field<BinaryFunction,Expr1,Expr2>& x) {
_f = x._f; _expr1 = x._expr1; _expr2 = x._expr2; return *this; }
// accessors:
const space_type& get_test_space() const {
return (details::is_equal<typename Expr1::vf_tag_type, details::vf_tag_01>::value) ?
_expr1.get_vf_space() : _expr2.get_vf_space();
}
const space_type& get_trial_space() const {
return (details::is_equal<typename Expr1::vf_tag_type, details::vf_tag_10>::value) ?
_expr1.get_vf_space() : _expr2.get_vf_space();
}
size_type n_derivative() const { return _expr1.n_derivative() + _expr2.n_derivative(); }
// mutable modifiers:
void initialize (
const piola_on_pointset<float_type>& pops,
const integrate_option& iopt)
{
_expr1.initialize (pops, iopt);
_expr2.initialize (pops, iopt);
}
void initialize (
const band_basic<float_type,memory_type>& gh,
const piola_on_pointset<float_type>& pops,
const integrate_option& iopt)
{
_expr1.initialize (gh, pops, iopt);
_expr2.initialize (gh, pops, iopt);
}
// TODO: DVT_EXPR_SPARSE_MATRIX return array[q] of SparseMatrix(i,j)
template<class ValueType, class Arg1, class Arg2>
void evaluate_internal (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
Eigen::Tensor<ValueType,3>& value) const
{
typedef long int eig_idx_t;
if (details::is_equal<typename Expr2::vf_tag_type, details::vf_tag_01>::value) {
// expr1 is trial and expr2 is test
Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> v_test; _expr2.evaluate (omega_K, K, v_test);
Eigen::Matrix<Arg1,Eigen::Dynamic,Eigen::Dynamic> u_trial; _expr1.evaluate (omega_K, K, u_trial);
check_macro(u_trial.rows() == v_test.rows(), "mult: invalid sizes u_trial("
<<u_trial.rows()<<","<<u_trial.cols() <<") and v_test("
<<v_test.rows() <<","<<v_test.cols()<<")");
eig_idx_t nq = u_trial.rows();
eig_idx_t ni = v_test.cols();
eig_idx_t nj = u_trial.cols();
value.resize(nq,ni,nj);
for (eig_idx_t q = 0; q < nq; ++q) {
for (eig_idx_t i = 0; i < ni; ++i) {
for (eig_idx_t j = 0; j < nj; ++j) {
value(q,i,j) = _f (u_trial(q,j), v_test(q,i));
}}}
} else {
// expr2 is trial and expr1 is test
Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> v_test; _expr1.evaluate (omega_K, K, v_test);
Eigen::Matrix<Arg1,Eigen::Dynamic,Eigen::Dynamic> u_trial; _expr2.evaluate (omega_K, K, u_trial);
check_macro(u_trial.rows() == v_test.rows(), "binary: invalid sizes");
eig_idx_t nq = u_trial.rows();
eig_idx_t ni = v_test.cols();
eig_idx_t nj = u_trial.cols();
value.resize(nq,ni,nj);
for (eig_idx_t q = 0; q < nq; ++q) {
for (eig_idx_t i = 0; i < ni; ++i) {
for (eig_idx_t j = 0; j < nj; ++j) {
value(q,i,j) = _f (u_trial(q,j), v_test(q,i));
}}}
}
}
template<class ValueType, class Arg1, class Arg2>
void evaluate_on_side_internal (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
const side_information_type& sid,
Eigen::Tensor<ValueType,3>& value) const
{
typedef long int eig_idx_t;
bool do_local_component_assembly = true;
if (details::is_equal<typename Expr2::vf_tag_type, details::vf_tag_01>::value) {
// expr1 is trial and expr2 is test
Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> v_test; _expr2.evaluate_on_side (omega_K, K, sid, v_test, do_local_component_assembly);
Eigen::Matrix<Arg1,Eigen::Dynamic,Eigen::Dynamic> u_trial; _expr1.evaluate_on_side (omega_K, K, sid, u_trial, do_local_component_assembly);
check_macro(u_trial.rows() == v_test.rows(), "invalid sizes u_trial("
<<u_trial.rows()<<","<<u_trial.cols() <<") and v_test("
<<v_test.rows() <<","<<v_test.cols()<<")");
eig_idx_t nq = u_trial.rows();
eig_idx_t ni = v_test.cols();
eig_idx_t nj = u_trial.cols();
value.resize(nq,ni,nj);
for (eig_idx_t q = 0; q < nq; ++q) {
for (eig_idx_t i = 0; i < ni; ++i) {
for (eig_idx_t j = 0; j < nj; ++j) {
value(q,i,j) = _f (u_trial(q,j), v_test(q,i));
}}}
} else {
// expr2 is trial and expr1 is test
Eigen::Matrix<Arg2,Eigen::Dynamic,Eigen::Dynamic> v_test; _expr1.evaluate_on_side (omega_K, K, sid, v_test, do_local_component_assembly);
Eigen::Matrix<Arg1,Eigen::Dynamic,Eigen::Dynamic> u_trial; _expr2.evaluate_on_side (omega_K, K, sid, u_trial, do_local_component_assembly);
check_macro(u_trial.rows() == v_test.rows(), "binary: invalid sizes");
eig_idx_t nq = u_trial.rows();
eig_idx_t ni = v_test.cols();
eig_idx_t nj = u_trial.cols();
value.resize(nq,ni,nj);
for (eig_idx_t q = 0; q < nq; ++q) {
for (eig_idx_t i = 0; i < ni; ++i) {
for (eig_idx_t j = 0; j < nj; ++j) {
value(q,i,j) = _f (u_trial(q,j), v_test(q,i));
}}}
}
}
// when both args are defined at compile time:
template<class This, class ValueType,
class Arg1, space_constant::valued_type Arg1Tag,
class Arg2, space_constant::valued_type Arg2Tag>
struct evaluate_switch {
typedef typename This::float_type float_type;
typedef typename This::memory_type memory_type;
void operator() (
const This& obj,
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
Eigen::Tensor<ValueType,3>& value) const
{
obj.template evaluate_internal<ValueType, Arg1, Arg2> (omega_K, K, value);
}
void operator() (
const This& obj,
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
const side_information_type& sid,
Eigen::Tensor<ValueType,3>& value) const
{
obj.template evaluate_on_side_internal<ValueType, Arg1, Arg2> (omega_K, K, sid, value);
}
};
template<class ValueType>
void evaluate (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
Eigen::Tensor<ValueType,3>& value) const
{
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,ValueType>::first_argument_type first_argument_type;
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,ValueType>::second_argument_type second_argument_type;
static const space_constant::valued_type first_argument_tag = space_constant::valued_tag_traits<first_argument_type>::value;
static const space_constant::valued_type second_argument_tag = space_constant::valued_tag_traits<second_argument_type>::value;
evaluate_switch <self_type, ValueType,
first_argument_type, first_argument_tag,
second_argument_type, second_argument_tag> eval;
eval (*this, omega_K, K, value);
}
template<class ValueType>
void evaluate_on_side (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
const side_information_type& sid,
Eigen::Tensor<ValueType,3>& value) const
{
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,ValueType>::first_argument_type first_argument_type;
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,ValueType>::second_argument_type second_argument_type;
static const space_constant::valued_type first_argument_tag = space_constant::valued_tag_traits<first_argument_type>::value;
static const space_constant::valued_type second_argument_tag = space_constant::valued_tag_traits<second_argument_type>::value;
evaluate_switch <self_type, ValueType,
first_argument_type, first_argument_tag,
second_argument_type, second_argument_tag> eval;
eval (*this, omega_K, K, sid, value);
}
template<class ValueType>
bool valued_check() const {
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,ValueType>::first_argument_type A1;
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename Expr1::value_type
,typename Expr2::value_type
,ValueType>::second_argument_type A2;
if (! is_undeterminated<A1>::value) _expr1.template valued_check<A1>();
if (! is_undeterminated<A2>::value) _expr2.template valued_check<A2>();
return true;
}
protected:
// data:
BinaryFunction _f;
Expr1 _expr1;
Expr2 _expr2;
};
template<class F, class Expr1, class Expr2> struct is_form_expr_v2_variational_arg <form_expr_v2_variational_binary_field<F,Expr1,Expr2> > : std::true_type {};
} // namespace details
// ---------------------------------------------------------------------------
// 4.2. binary calls
// ---------------------------------------------------------------------------
namespace details {
template<class Expr1, class Expr2, class Sfinae = void>
struct is_form_expr_v2_variational_binary_field : std::false_type {};
template <class Expr1, class Expr2>
struct is_form_expr_v2_variational_binary_field <
Expr1
,Expr2
,typename
std::enable_if<
is_field_expr_v2_variational_arg<Expr1>::value
&& is_field_expr_v2_variational_arg<Expr2>::value
>::type
>
: and_type<
is_field_expr_v2_variational_arg<Expr1>
,is_field_expr_v2_variational_arg<Expr2>
,std::is_same <
typename Expr1::vf_tag_type
,typename dual_vf_tag<typename Expr2::vf_tag_type>::type
>
>
{};
} // namespace details
#define _RHEOLEF_form_expr_v2_variational_binary_field(FUNCTION,FUNCTOR) \
template <class Expr1, class Expr2> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_binary_field <Expr1,Expr2>::value \
,details::form_expr_v2_variational_binary_field< \
FUNCTOR \
,Expr1 \
,Expr2 \
> \
>::type \
FUNCTION (const Expr1& expr1, const Expr2& expr2) \
{ \
return details::form_expr_v2_variational_binary_field \
<FUNCTOR, Expr1, Expr2> \
(FUNCTOR(), expr1, expr2); \
}
_RHEOLEF_form_expr_v2_variational_binary_field (operator*, details::multiplies)
_RHEOLEF_form_expr_v2_variational_binary_field (dot, details::dot_)
_RHEOLEF_form_expr_v2_variational_binary_field (ddot, details::ddot_)
_RHEOLEF_form_expr_v2_variational_binary_field (dddot, details::dddot_)
#undef _RHEOLEF_form_expr_v2_variational_binary_field
// ---------------------------------------------------------------------------
// 5. binary operators */ between a variational form and a nonlinear expr
// ---------------------------------------------------------------------------
// 5.1. binary node
// ---------------------------------------------------------------------------
// example: integrate(eta_h*(u*v))
namespace details {
template<class BinaryFunction, class NLExpr, class VFExpr>
class form_expr_v2_variational_binary_binded {
public:
// typedefs:
typedef geo_element::size_type size_type;
typedef typename promote_memory<typename NLExpr::memory_type,typename VFExpr::memory_type>::type
memory_type;
typedef typename details::generic_binary_traits<BinaryFunction>::template result_hint<
typename NLExpr::value_type
,typename VFExpr::value_type>::type result_hint;
typedef typename details::generic_binary_traits<BinaryFunction>::template hint<
typename NLExpr::value_type
,typename VFExpr::value_type
,result_hint>::result_type value_type;
typedef typename scalar_traits<value_type>::type scalar_type;
typedef typename float_traits<value_type>::type float_type;
typedef space_basic<scalar_type,memory_type> space_type; // TODO: deduce from Exprs
typedef typename details::bf_vf_tag<BinaryFunction,
details::vf_tag_00,
typename VFExpr::vf_tag_type>::type vf_tag_type;
typedef typename details::dual_vf_tag<vf_tag_type>::type
vf_dual_tag_type;
typedef form_expr_v2_variational_binary_binded <BinaryFunction,NLExpr,VFExpr> self_type;
typedef form_expr_v2_variational_binary_binded <BinaryFunction,NLExpr,typename VFExpr::dual_self_type>
dual_self_type;
typedef typename VFExpr::maybe_symmetric::type maybe_symmetric;
// TODO: symmetry: works only when eta_h is scalar
// TODO: problem when ddot(eta_h,otimes(u,v)) when eta_h is unsymmetric tensor
// and "unsymmetric tensor" is not known at compile time
static const space_constant::valued_type valued_hint = space_constant::valued_tag_traits<value_type>::value;
// alocators:
form_expr_v2_variational_binary_binded (const BinaryFunction& f,
const NLExpr& nl_expr,
const VFExpr& vf_expr)
: _f(f),
_nl_expr(nl_expr),
_vf_expr(vf_expr)
{}
// accessors:
const space_type& get_trial_space() const { return _vf_expr.get_trial_space(); }
const space_type& get_test_space() const { return _vf_expr.get_test_space(); }
size_type n_derivative() const { return _vf_expr.n_derivative(); }
// mutable modifiers:
void initialize (const piola_on_pointset<float_type>& pops, const integrate_option& iopt) {
_nl_expr.initialize (pops, iopt);
_vf_expr.initialize (pops, iopt);
}
void initialize (const band_basic<float_type,memory_type>& gh, const piola_on_pointset<float_type>& pops, const integrate_option& iopt) {
_nl_expr.initialize ( pops, iopt);
_vf_expr.initialize (gh, pops, iopt);
}
// ---------------------------------------------
// element initialize: evaluate nl_expr
// ---------------------------------------------
template<class Result>
void evaluate (
const geo_basic<float_type,memory_type>& omega_K,
const geo_element& K,
Eigen::Tensor<Result,3>& value) const
{
typedef Result Arg1; // TODO: switch
typedef Result Arg2; // TODO: switch ; is float_type in general, as elementary matrix
Eigen::Matrix<Arg1,Eigen::Dynamic,1> value1; _nl_expr.evaluate (omega_K, K, value1);
Eigen::Tensor<float_type,3> value2; _vf_expr.evaluate (omega_K, K, value2);
check_macro (value1.size() == value2.dimension(0), "invalid sizes");
size_type loc_nnod = value2.dimension(0);
size_type loc_ndof1 = value2.dimension(1);
size_type loc_ndof2 = value2.dimension(2);
value.resize(loc_nnod,loc_ndof1,loc_ndof2);
for (size_type loc_inod = 0; loc_inod < loc_nnod; ++loc_inod) {
for (size_type loc_jdof = 0; loc_jdof < loc_ndof1; ++loc_jdof) {
for (size_type loc_kdof = 0; loc_kdof < loc_ndof2; ++loc_kdof) {
value(loc_inod,loc_jdof,loc_kdof)
= _f (value1(loc_inod,loc_jdof), value2(loc_inod,loc_jdof,loc_kdof));
}}}
}
template<class Result>
bool valued_check() const {
typedef Result A1;
typedef Result A2;
bool status = true;
if (! is_undeterminated<A1>::value) status &= _nl_expr.template valued_check<A1>();
if (! is_undeterminated<A2>::value) status &= _vf_expr.template valued_check<A2>();
return status;
}
//protected:
// data:
BinaryFunction _f;
NLExpr _nl_expr;
VFExpr _vf_expr;
};
template<class F, class Expr1, class Expr2> struct is_form_expr_v2_variational_arg <form_expr_v2_variational_binary_binded<F,Expr1,Expr2> > : std::true_type {};
} // namespace details
// ---------------------------------------------------------------------------
// 5.2. binary calls
// ---------------------------------------------------------------------------
namespace details {
template<class Expr1, class Expr2, class Sfinae = void>
struct is_form_expr_v2_variational_binary_multiplies_divides_left : std::false_type {};
template<class Expr1, class Expr2>
struct is_form_expr_v2_variational_binary_multiplies_divides_left <
Expr1
,Expr2
,typename
std::enable_if<
is_field_expr_v2_nonlinear_arg <Expr1>::value
&& ! is_rheolef_arithmetic <Expr1>::value
&& is_form_expr_v2_variational_arg<Expr2>::value
>::type
>
: std::true_type
{};
template<class Expr1, class Expr2>
struct is_form_expr_v2_variational_binary_multiplies_divides_right
: is_form_expr_v2_variational_binary_multiplies_divides_left <Expr2,Expr1> {};
} // namespace details
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_left(FUNCTION,FUNCTOR) \
template<class Expr1, class Expr2> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_binary_multiplies_divides_left <Expr1,Expr2>::value \
,details::form_expr_v2_variational_binary_binded< \
FUNCTOR \
,typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type \
,Expr2 /* vf */ \
> \
>::type \
FUNCTION (const Expr1& expr1, const Expr2& expr2) \
{ \
typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr1>::type wrap1_t; \
return details::form_expr_v2_variational_binary_binded \
<FUNCTOR, wrap1_t, Expr2> \
(FUNCTOR(), wrap1_t(expr1), expr2); \
}
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right(FUNCTION,FUNCTOR) \
template<class Expr1, class Expr2> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_binary_multiplies_divides_right <Expr1,Expr2>::value \
,details::form_expr_v2_variational_binary_binded< \
details::swapper<FUNCTOR> \
, typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type \
,Expr1 /* vf */ \
> \
>::type \
FUNCTION (const Expr1& expr1, const Expr2& expr2) \
{ \
typedef typename details::field_expr_v2_nonlinear_terminal_wrapper_traits<Expr2>::type wrap2_t; \
return details::form_expr_v2_variational_binary_binded \
<details::swapper<FUNCTOR>, wrap2_t, Expr1> \
(details::swapper<FUNCTOR>(FUNCTOR()), wrap2_t(expr2), expr1); \
}
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides(FUNCTION,FUNCTOR) \
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_left (FUNCTION,FUNCTOR) \
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right (FUNCTION,FUNCTOR)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides (operator*, details::multiplies)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right (operator/, details::divides)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides (dot, details::dot_)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides (ddot, details::ddot_)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides (dddot, details::dddot_)
#undef _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_left
#undef _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right
#undef _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides
// ---------------------------------------------------------------------------
// 6. binary operators */ between a variational form and a constant
// ---------------------------------------------------------------------------
namespace details {
template<class Expr1, class Expr2, class Sfinae = void>
struct is_form_expr_v2_variational_binary_multiplies_divides_constant_left : std::false_type {};
template<class Expr1, class Expr2>
struct is_form_expr_v2_variational_binary_multiplies_divides_constant_left <
Expr1
,Expr2
,typename
std::enable_if<
is_rheolef_arithmetic <Expr1>::value
&& is_form_expr_v2_variational_arg<Expr2>::value
>::type
>
: std::true_type
{};
template<class Expr1, class Expr2>
struct is_form_expr_v2_variational_binary_multiplies_divides_constant_right
: is_form_expr_v2_variational_binary_multiplies_divides_constant_left <Expr2,Expr1> {};
} // namespace details
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_left(FUNCTION,FUNCTOR) \
template<class Expr1, class Expr2> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_binary_multiplies_divides_constant_left <Expr1,Expr2>::value \
,details::form_expr_v2_variational_unary< \
details::binder_first <FUNCTOR, Expr1> \
,Expr2 /* vf */ \
> \
>::type \
FUNCTION (const Expr1& expr1, const Expr2& expr2) \
{ \
return details::form_expr_v2_variational_unary \
<details::binder_first <FUNCTOR,Expr1>, Expr2> \
(details::binder_first <FUNCTOR,Expr1> (FUNCTOR(), expr1), expr2); \
}
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right(FUNCTION,FUNCTOR) \
template<class Expr1, class Expr2> \
inline \
typename \
std::enable_if< \
details::is_form_expr_v2_variational_binary_multiplies_divides_constant_right <Expr1,Expr2>::value \
,details::form_expr_v2_variational_unary< \
details::binder_second <FUNCTOR, Expr2> \
,Expr1 /* vf */ \
> \
>::type \
FUNCTION (const Expr1& expr1, const Expr2& expr2) \
{ \
return details::form_expr_v2_variational_unary \
<details::binder_second <FUNCTOR,Expr2>, Expr1> \
(details::binder_second <FUNCTOR,Expr2> (FUNCTOR(), expr2), expr1); \
}
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant(FUNCTION,FUNCTOR) \
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_left (FUNCTION,FUNCTOR) \
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right (FUNCTION,FUNCTOR)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant (operator*, details::multiplies)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right (operator/, details::divides)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant (dot, details::dot_)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant (ddot, details::ddot_)
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant (dddot, details::dddot_)
#undef _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right
#undef _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_left
#undef _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant
} // namespace rheolef
#endif // _RHEOLEF_FORM_EXPR_VARIATIONAL_H
gh
field gh(Float epsilon, Float t, const field &uh, const test &v)
Definition burgers_diffusion_operators.icc:37
rheolef::band_basic
Definition band.h:95
rheolef::details::form_expr_v2_variational_binary_binded
Definition form_expr_variational.h:667
rheolef::details::form_expr_v2_variational_binary_binded::memory_type
promote_memory< typenameNLExpr::memory_type, typenameVFExpr::memory_type >::type memory_type
Definition form_expr_variational.h:673
rheolef::details::form_expr_v2_variational_binary_binded::space_type
space_basic< scalar_type, memory_type > space_type
Definition form_expr_variational.h:683
rheolef::details::form_expr_v2_variational_binary_binded::dual_self_type
form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type > dual_self_type
Definition form_expr_variational.h:691
rheolef::details::form_expr_v2_variational_binary_binded::valued_check
bool valued_check() const
Definition form_expr_variational.h:751
rheolef::details::form_expr_v2_variational_binary_binded::initialize
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:717
rheolef::details::form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type >::_vf_expr
VFExpr _vf_expr
Definition form_expr_variational.h:763
rheolef::details::form_expr_v2_variational_binary_binded::get_test_space
const space_type & get_test_space() const
Definition form_expr_variational.h:712
rheolef::details::form_expr_v2_variational_binary_binded::self_type
form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, VFExpr > self_type
Definition form_expr_variational.h:689
rheolef::details::form_expr_v2_variational_binary_binded::initialize
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:721
rheolef::details::form_expr_v2_variational_binary_binded::form_expr_v2_variational_binary_binded
form_expr_v2_variational_binary_binded(const BinaryFunction &f, const NLExpr &nl_expr, const VFExpr &vf_expr)
Definition form_expr_variational.h:701
rheolef::details::form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type >::valued_hint
static const space_constant::valued_type valued_hint
Definition form_expr_variational.h:697
rheolef::details::form_expr_v2_variational_binary_binded::n_derivative
size_type n_derivative() const
Definition form_expr_variational.h:713
rheolef::details::form_expr_v2_variational_binary_binded::vf_dual_tag_type
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
Definition form_expr_variational.h:688
rheolef::details::form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type >::maybe_symmetric
VFExpr::maybe_symmetric::type maybe_symmetric
Definition form_expr_variational.h:692
rheolef::details::form_expr_v2_variational_binary_binded::vf_tag_type
details::bf_vf_tag< BinaryFunction, details::vf_tag_00, typenameVFExpr::vf_tag_type >::type vf_tag_type
Definition form_expr_variational.h:686
rheolef::details::form_expr_v2_variational_binary_binded::value_type
details::generic_binary_traits< BinaryFunction >::template hint< typenameNLExpr::value_type, typenameVFExpr::value_type, result_hint >::result_type value_type
Definition form_expr_variational.h:680
rheolef::details::form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type >::_f
BinaryFunction _f
Definition form_expr_variational.h:761
rheolef::details::form_expr_v2_variational_binary_binded::scalar_type
scalar_traits< value_type >::type scalar_type
Definition form_expr_variational.h:681
rheolef::details::form_expr_v2_variational_binary_binded< BinaryFunction, NLExpr, typename VFExpr::dual_self_type >::_nl_expr
NLExpr _nl_expr
Definition form_expr_variational.h:762
rheolef::details::form_expr_v2_variational_binary_binded::result_hint
details::generic_binary_traits< BinaryFunction >::template result_hint< typenameNLExpr::value_type, typenameVFExpr::value_type >::type result_hint
Definition form_expr_variational.h:676
rheolef::details::form_expr_v2_variational_binary_binded::get_trial_space
const space_type & get_trial_space() const
Definition form_expr_variational.h:711
rheolef::details::form_expr_v2_variational_binary_binded::evaluate
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Tensor< Result, 3 > &value) const
Definition form_expr_variational.h:729
rheolef::details::form_expr_v2_variational_binary_binded::float_type
float_traits< value_type >::type float_type
Definition form_expr_variational.h:682
rheolef::details::form_expr_v2_variational_binary_binded::size_type
geo_element::size_type size_type
Definition form_expr_variational.h:671
rheolef::details::form_expr_v2_variational_binary_field
Definition form_expr_variational.h:356
rheolef::details::form_expr_v2_variational_binary_field::space_type
space_basic< scalar_type, memory_type > space_type
Definition form_expr_variational.h:372
rheolef::details::form_expr_v2_variational_binary_field::form_expr_v2_variational_binary_field
form_expr_v2_variational_binary_field(const BinaryFunction &f, const Expr1 &expr1, const Expr2 &expr2)
Definition form_expr_variational.h:391
rheolef::details::form_expr_v2_variational_binary_field< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::_expr1
Expr1 _expr1
Definition form_expr_variational.h:595
rheolef::details::form_expr_v2_variational_binary_field::valued_check
bool valued_check() const
Definition form_expr_variational.h:579
rheolef::details::form_expr_v2_variational_binary_field::initialize
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:414
rheolef::details::form_expr_v2_variational_binary_field< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::_expr2
Expr2 _expr2
Definition form_expr_variational.h:596
rheolef::details::form_expr_v2_variational_binary_field::get_test_space
const space_type & get_test_space() const
Definition form_expr_variational.h:401
rheolef::details::form_expr_v2_variational_binary_field::evaluate
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Tensor< ValueType, 3 > &value) const
Definition form_expr_variational.h:536
rheolef::details::form_expr_v2_variational_binary_field::initialize
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:421
rheolef::details::form_expr_v2_variational_binary_field::evaluate_on_side_internal
void evaluate_on_side_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Tensor< ValueType, 3 > &value) const
Definition form_expr_variational.h:470
rheolef::details::form_expr_v2_variational_binary_field::evaluate_internal
void evaluate_internal(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Tensor< ValueType, 3 > &value) const
Definition form_expr_variational.h:431
rheolef::details::form_expr_v2_variational_binary_field::result_hint
details::generic_binary_traits< BinaryFunction >::template result_hint< typenameExpr1::value_type, typenameExpr2::value_type >::type result_hint
Definition form_expr_variational.h:365
rheolef::details::form_expr_v2_variational_binary_field< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::maybe_symmetric
and_type< typenamedetails::generic_binary_traits< BinaryFunction >::is_symmetric::type, typenamedetails::is_equal< Expr1, typenameExpr2::dual_self_type >::type >::type maybe_symmetric
Definition form_expr_variational.h:385
rheolef::details::form_expr_v2_variational_binary_field::operator=
form_expr_v2_variational_binary_field< BinaryFunction, Expr1, Expr2 > & operator=(const form_expr_v2_variational_binary_field< BinaryFunction, Expr1, Expr2 > &x)
Definition form_expr_variational.h:396
rheolef::details::form_expr_v2_variational_binary_field::vf_tag_type
details::bf_vf_tag< BinaryFunction, typenameExpr1::vf_tag_type, typenameExpr2::vf_tag_type >::type vf_tag_type
Definition form_expr_variational.h:375
rheolef::details::form_expr_v2_variational_binary_field< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::valued_hint
static const space_constant::valued_type valued_hint
Definition form_expr_variational.h:387
rheolef::details::form_expr_v2_variational_binary_field::n_derivative
size_type n_derivative() const
Definition form_expr_variational.h:410
rheolef::details::form_expr_v2_variational_binary_field::vf_dual_tag_type
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
Definition form_expr_variational.h:377
rheolef::details::form_expr_v2_variational_binary_field::self_type
form_expr_v2_variational_binary_field< BinaryFunction, Expr1, Expr2 > self_type
Definition form_expr_variational.h:378
rheolef::details::form_expr_v2_variational_binary_field< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::_f
BinaryFunction _f
Definition form_expr_variational.h:594
rheolef::details::form_expr_v2_variational_binary_field::scalar_type
scalar_traits< value_type >::type scalar_type
Definition form_expr_variational.h:370
rheolef::details::form_expr_v2_variational_binary_field::dual_self_type
form_expr_v2_variational_binary_field< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type > dual_self_type
Definition form_expr_variational.h:380
rheolef::details::form_expr_v2_variational_binary_field::evaluate_on_side
void evaluate_on_side(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Tensor< ValueType, 3 > &value) const
Definition form_expr_variational.h:557
rheolef::details::form_expr_v2_variational_binary_field::value_type
details::generic_binary_traits< BinaryFunction >::template hint< typenameExpr1::value_type, typenameExpr2::value_type, result_hint >::result_type value_type
Definition form_expr_variational.h:369
rheolef::details::form_expr_v2_variational_binary_field::memory_type
promote_memory< typenameExpr1::memory_type, typenameExpr2::memory_type >::type memory_type
Definition form_expr_variational.h:362
rheolef::details::form_expr_v2_variational_binary_field::get_trial_space
const space_type & get_trial_space() const
Definition form_expr_variational.h:405
rheolef::details::form_expr_v2_variational_binary_field::float_type
float_traits< value_type >::type float_type
Definition form_expr_variational.h:371
rheolef::details::form_expr_v2_variational_binary_field::size_type
geo_element::size_type size_type
Definition form_expr_variational.h:360
rheolef::details::form_expr_v2_variational_binary
Definition form_expr_variational.h:184
rheolef::details::form_expr_v2_variational_binary::space_type
space_basic< scalar_type, memory_type > space_type
Definition form_expr_variational.h:200
rheolef::details::form_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::_expr1
Expr1 _expr1
Definition form_expr_variational.h:311
rheolef::details::form_expr_v2_variational_binary::valued_check
bool valued_check() const
Definition form_expr_variational.h:300
rheolef::details::form_expr_v2_variational_binary::initialize
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:239
rheolef::details::form_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::_expr2
Expr2 _expr2
Definition form_expr_variational.h:312
rheolef::details::form_expr_v2_variational_binary::get_test_space
const space_type & get_test_space() const
Definition form_expr_variational.h:233
rheolef::details::form_expr_v2_variational_binary::operator=
form_expr_v2_variational_binary< BinaryFunction, Expr1, Expr2 > & operator=(const form_expr_v2_variational_binary< BinaryFunction, Expr1, Expr2 > &x)
Definition form_expr_variational.h:227
rheolef::details::form_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::maybe_symmetric
and_type< typenameExpr1::maybe_symmetric::type, typenameExpr2::maybe_symmetric::type >::type maybe_symmetric
Definition form_expr_variational.h:212
rheolef::details::form_expr_v2_variational_binary::self_type
form_expr_v2_variational_binary< BinaryFunction, Expr1, Expr2 > self_type
Definition form_expr_variational.h:206
rheolef::details::form_expr_v2_variational_binary::initialize
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:243
rheolef::details::form_expr_v2_variational_binary::result_hint
details::generic_binary_traits< BinaryFunction >::template result_hint< typenameExpr1::value_type, typenameExpr2::value_type >::type result_hint
Definition form_expr_variational.h:193
rheolef::details::form_expr_v2_variational_binary::form_expr_v2_variational_binary
form_expr_v2_variational_binary(const form_expr_v2_variational_binary< BinaryFunction, Expr1, Expr2 > &x)
Definition form_expr_variational.h:223
rheolef::details::form_expr_v2_variational_binary::vf_tag_type
details::bf_vf_tag< BinaryFunction, typenameExpr1::vf_tag_type, typenameExpr2::vf_tag_type >::type vf_tag_type
Definition form_expr_variational.h:203
rheolef::details::form_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::valued_hint
static const space_constant::valued_type valued_hint
Definition form_expr_variational.h:214
rheolef::details::form_expr_v2_variational_binary::n_derivative
size_type n_derivative() const
Definition form_expr_variational.h:234
rheolef::details::form_expr_v2_variational_binary::vf_dual_tag_type
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
Definition form_expr_variational.h:205
rheolef::details::form_expr_v2_variational_binary::form_expr_v2_variational_binary
form_expr_v2_variational_binary(const BinaryFunction &f, const Expr1 &expr1, const Expr2 &expr2)
Definition form_expr_variational.h:218
rheolef::details::form_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type >::_f
BinaryFunction _f
Definition form_expr_variational.h:310
rheolef::details::form_expr_v2_variational_binary::evaluate_on_side
void evaluate_on_side(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, const side_information_type &sid, Eigen::Tensor< Result, 3 > &value) const
Definition form_expr_variational.h:274
rheolef::details::form_expr_v2_variational_binary::scalar_type
scalar_traits< value_type >::type scalar_type
Definition form_expr_variational.h:198
rheolef::details::form_expr_v2_variational_binary::dual_self_type
form_expr_v2_variational_binary< BinaryFunction, typename Expr1::dual_self_type, typename Expr2::dual_self_type > dual_self_type
Definition form_expr_variational.h:209
rheolef::details::form_expr_v2_variational_binary::value_type
details::generic_binary_traits< BinaryFunction >::template hint< typenameExpr1::value_type, typenameExpr2::value_type, result_hint >::result_type value_type
Definition form_expr_variational.h:197
rheolef::details::form_expr_v2_variational_binary::memory_type
promote_memory< typenameExpr1::memory_type, typenameExpr2::memory_type >::type memory_type
Definition form_expr_variational.h:190
rheolef::details::form_expr_v2_variational_binary::get_trial_space
const space_type & get_trial_space() const
Definition form_expr_variational.h:232
rheolef::details::form_expr_v2_variational_binary::evaluate
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Tensor< Result, 3 > &value) const
Definition form_expr_variational.h:249
rheolef::details::form_expr_v2_variational_binary::float_type
float_traits< value_type >::type float_type
Definition form_expr_variational.h:199
rheolef::details::form_expr_v2_variational_binary::size_type
geo_element::size_type size_type
Definition form_expr_variational.h:188
rheolef::details::form_expr_v2_variational_unary
Definition form_expr_variational.h:70
rheolef::details::form_expr_v2_variational_unary::form_expr_v2_variational_unary
form_expr_v2_variational_unary(const UnaryFunction &f, const Expr &expr)
Definition form_expr_variational.h:96
rheolef::details::form_expr_v2_variational_unary::space_type
space_basic< scalar_type, memory_type > space_type
Definition form_expr_variational.h:83
rheolef::details::form_expr_v2_variational_unary::form_expr_v2_variational_unary
form_expr_v2_variational_unary(const form_expr_v2_variational_unary< UnaryFunction, Expr > &x)
Definition form_expr_variational.h:99
rheolef::details::form_expr_v2_variational_unary::valued_check
bool valued_check() const
Definition form_expr_variational.h:136
rheolef::details::form_expr_v2_variational_unary::initialize
void initialize(const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:114
rheolef::details::form_expr_v2_variational_unary::get_test_space
const space_type & get_test_space() const
Definition form_expr_variational.h:109
rheolef::details::form_expr_v2_variational_unary< UnaryFunction, typename Expr::dual_self_type >::_f
UnaryFunction _f
Definition form_expr_variational.h:143
rheolef::details::form_expr_v2_variational_unary::initialize
void initialize(const band_basic< float_type, memory_type > &gh, const piola_on_pointset< float_type > &pops, const integrate_option &iopt)
Definition form_expr_variational.h:117
rheolef::details::form_expr_v2_variational_unary::value_type
details::generic_unary_traits< UnaryFunction >::template hint< typenameExpr::value_type, result_hint >::result_type value_type
Definition form_expr_variational.h:80
rheolef::details::form_expr_v2_variational_unary::dual_self_type
form_expr_v2_variational_unary< UnaryFunction, typename Expr::dual_self_type > dual_self_type
Definition form_expr_variational.h:89
rheolef::details::form_expr_v2_variational_unary::operator=
form_expr_v2_variational_unary< UnaryFunction, Expr > & operator=(const form_expr_v2_variational_unary< UnaryFunction, Expr > &x)
Definition form_expr_variational.h:103
rheolef::details::form_expr_v2_variational_unary< UnaryFunction, typename Expr::dual_self_type >::maybe_symmetric
Expr::maybe_symmetric::type maybe_symmetric
Definition form_expr_variational.h:90
rheolef::details::form_expr_v2_variational_unary::result_hint
details::generic_unary_traits< UnaryFunction >::template result_hint< typenameExpr::value_type >::type result_hint
Definition form_expr_variational.h:77
rheolef::details::form_expr_v2_variational_unary< UnaryFunction, typename Expr::dual_self_type >::valued_hint
static const space_constant::valued_type valued_hint
Definition form_expr_variational.h:92
rheolef::details::form_expr_v2_variational_unary::n_derivative
size_type n_derivative() const
Definition form_expr_variational.h:110
rheolef::details::form_expr_v2_variational_unary::vf_dual_tag_type
details::dual_vf_tag< vf_tag_type >::type vf_dual_tag_type
Definition form_expr_variational.h:86
rheolef::details::form_expr_v2_variational_unary< UnaryFunction, typename Expr::dual_self_type >::_expr
Expr _expr
Definition form_expr_variational.h:144
rheolef::details::form_expr_v2_variational_unary::scalar_type
scalar_traits< value_type >::type scalar_type
Definition form_expr_variational.h:81
rheolef::details::form_expr_v2_variational_unary::memory_type
Expr::memory_type memory_type
Definition form_expr_variational.h:75
rheolef::details::form_expr_v2_variational_unary::get_trial_space
const space_type & get_trial_space() const
Definition form_expr_variational.h:108
rheolef::details::form_expr_v2_variational_unary::evaluate
void evaluate(const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Tensor< Result, 3 > &value) const
Definition form_expr_variational.h:121
rheolef::details::form_expr_v2_variational_unary::vf_tag_type
Expr::vf_tag_type vf_tag_type
Definition form_expr_variational.h:84
rheolef::details::form_expr_v2_variational_unary::float_type
float_traits< value_type >::type float_type
Definition form_expr_variational.h:82
rheolef::details::form_expr_v2_variational_unary::self_type
form_expr_v2_variational_unary< UnaryFunction, Expr > self_type
Definition form_expr_variational.h:87
rheolef::details::form_expr_v2_variational_unary::size_type
geo_element::size_type size_type
Definition form_expr_variational.h:74
rheolef::geo_basic
generic mesh with rerefence counting
Definition geo.h:1089
rheolef::geo_element
see the geo_element page for the full documentation
Definition geo_element.h:102
rheolef::geo_element::size_type
reference_element::size_type size_type
Definition geo_element.h:125
rheolef::integrate_option
see the integrate_option page for the full documentation
Definition integrate_option.h:125
rheolef::piola_on_pointset
Definition piola_on_pointset.h:142
rheolef::space_basic
the finite element space
Definition space.h:382
rheolef::type
rheolef::std::enable_if< details::is_field_expr_v2_nonlinear_arg< Expr1 >::value &&! details::is_field_expr_v2_constant< Expr1 >::value &&details::is_field_expr_v2_nonlinear_arg< Expr2 >::value &&! details::is_field_expr_v2_constant< Expr2 >::value, details::field_expr_v2_nonlinear_node_binary< details::function_traits< Function >::functor_type, details::field_expr_v2_nonlinear_terminal_wrapper_traits< Expr1 >::type, details::field_expr_v2_nonlinear_terminal_wrapper_traits< Expr2 >::type > > type
check_macro
check_macro(expr1.have_homogeneous_space(Xh1), "dual(expr1,expr2); expr1 should have homogeneous space. HINT: use dual(interpolate(Xh, expr1),expr2)")
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:836
_RHEOLEF_form_expr_v2_variational_binary_field
#define _RHEOLEF_form_expr_v2_variational_binary_field(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:631
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:912
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:817
_RHEOLEF_form_expr_v2_variational_binary
#define _RHEOLEF_form_expr_v2_variational_binary(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:322
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right
#define _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:894
_RHEOLEF_make_form_expr_v2_variational_unary
#define _RHEOLEF_make_form_expr_v2_variational_unary(FUNCTION, FUNCTOR)
Definition form_expr_variational.h:153
rheolef::details
Definition compiler_eigen.h:39
rheolef::details::vf_tag_00
std::pair< std::false_type, std::false_type > vf_tag_00
Definition field_expr_variational_tag.h:50
rheolef::space_constant::valued_type
valued_type
Definition space_constant.h:133
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::ddot
T ddot(const tensor_basic< T > &a, const tensor_basic< T > &b)
ddot(x,y): see the expression page for the full documentation
Definition tensor.cc:278
rheolef::dddot
T dddot(const tensor3_basic< T > &a, const tensor3_basic< T > &b)
Definition tensor3.cc:94
rheolef::_RHEOLEF_form_expr_v2_variational_binary_field
_RHEOLEF_form_expr_v2_variational_binary_field(operator*, details::multiplies) _RHEOLEF_form_expr_v2_variational_binary_field(dot
rheolef::_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides(operator*, details::multiplies) _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_right(operator/
rheolef::dot
rheolef::std::enable_if< details::is_vec_expr_v2_arg< Expr1 >::value &&details::is_vec_expr_v2_arg< Expr2 >::value, promote< Expr1::float_type, Expr2::float_type >::type > type dot const Expr1 expr1, const Expr2 expr2 dot(const Expr1 &expr1, const Expr2 &expr2)
Definition vec_expr_v2.h:415
rheolef::_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant
_RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant(operator*, details::multiplies) _RHEOLEF_make_form_expr_v2_variational_binary_operator_multiplies_divides_constant_right(operator/
std
STL namespace.
f
Definition cavity_dg.h:29
rheolef::details::and_type
Definition field_expr_utilities.h:77
rheolef::details::bf_vf_tag
Definition field_expr_variational_tag.h:74
rheolef::details::divides
Definition expression.h:1272
rheolef::details::dual_vf_tag::type
vf_tag_nonlinear type
Definition field_expr_variational_tag.h:58
rheolef::details::form_expr_v2_variational_binary_field::evaluate_switch
Definition form_expr_variational.h:514
rheolef::details::form_expr_v2_variational_binary_field::evaluate_switch::operator()
void operator()(const This &obj, const geo_basic< float_type, memory_type > &omega_K, const geo_element &K, Eigen::Tensor< ValueType, 3 > &value) const
Definition form_expr_variational.h:517
rheolef::details::form_expr_v2_variational_binary_field::evaluate_switch::memory_type
This::memory_type memory_type
Definition form_expr_variational.h:516
rheolef::details::form_expr_v2_variational_binary_field::evaluate_switch::float_type
This::float_type float_type
Definition form_expr_variational.h:515
rheolef::details::generic_binary_traits
Definition expression.h:407
rheolef::details::generic_unary_traits
Definition expression.h:188
rheolef::details::type
rheolef::details::is_equal
Definition space_constant.h:36
rheolef::details::is_form_expr_v2_variational_arg
Definition form_expr_variational.h:58
rheolef::details::is_form_expr_v2_variational_binary_field
Definition form_expr_variational.h:607
rheolef::details::is_form_expr_v2_variational_binary_multiplies_divides_left
Definition form_expr_variational.h:775
rheolef::details::is_form_expr_v2_variational_binary_multiplies_divides_right
Definition form_expr_variational.h:793
rheolef::details::minus
Definition expression.h:544
rheolef::details::multiplies
Definition expression.h:746
rheolef::details::negate
Definition expression.h:231
rheolef::details::plus
Definition expression.h:457
rheolef::details::result_type
Definition space_constant.h:337
rheolef::details::unary_plus
Definition expression.h:209
rheolef::float_traits::type
T type
Definition Float.h:94
rheolef::is_undeterminated
Definition undeterminated.h:39
rheolef::promote_memory::type
undefined_memory_model type
Definition communicator.h:86
rheolef::scalar_traits::type
T type
Definition point.h:323
rheolef::side_information_type
Definition reference_element_face_transformation.h:37
rheolef::space_constant::valued_tag_traits::value
static const valued_type value
Definition space_constant.h:159