Loading...
Searching...
No Matches
vf_tag.h
Go to the documentation of this file.
#ifndef _RHEOLEF_VF_TAG_H
#define _RHEOLEF_VF_TAG_H
//
// vf_tag is used to determine at compile time when a binary
// variationnal expression as : u*u, u*v, f*v, v*v*u, etc...
// is linear which respect to u or v, where: trial u; test v;
//
#include "rheolef/compiler.h"
#include "rheolef/expression.h"
//#include "rheolef/field_nonlinear_expr.h"
//#include "rheolef/field_nonlinear_expr_ops.h"
namespace rheolef { namespace details {
// ----------------------------------------------------------
// define tag: pair of compile-time booleans
// that expresses the linearity with respect to each variable
// ----------------------------------------------------------
struct vf_tag_nonlinear {};
typedef std::pair<std::false_type,std::false_type> vf_tag_00;
typedef std::pair<std::false_type,std::true_type > vf_tag_01;
typedef std::pair<std::true_type, std::true_type > vf_tag_11;
typedef std::pair<std::true_type, std::false_type> vf_tag_10;
// ------------------------------------------------
// dual vf tag: 01 <--> 10 i.e. swap test and trial
// ------------------------------------------------
template <class G>
struct dual_vf_tag { typedef vf_tag_nonlinear type; };
template<> struct dual_vf_tag<vf_tag_01> { typedef vf_tag_10 type; };
template<> struct dual_vf_tag<vf_tag_10> { typedef vf_tag_01 type; };
template<> struct dual_vf_tag<vf_tag_00> { typedef vf_tag_00 type; };
template<> struct dual_vf_tag<vf_tag_11> { typedef vf_tag_11 type; };
// --------------------------------------------------------------------
// unary operator: default is nonlinear with respect to each variable
// --------------------------------------------------------------------
template <class Op, class G>
struct uf_vf_tag { typedef vf_tag_nonlinear type; };
// TODO: unary +-
// --------------------------------------------------------------------
// binary operator: default is nonlinear with respect to each variable
// --------------------------------------------------------------------
template <class Op, class G1, class G2>
struct bf_vf_tag { typedef vf_tag_nonlinear type; };
// Note: operators plus, multiples, etc are defined in field_nonlinear_expr_ops.h
// they should be grouped in one separated file with vf_tag, or tag defined for each
// operator in field_nonlinear_expr_ops_make.cc ?
// -----------------------------
// plus/minus
// -----------------------------
template<class Tag> struct bf_vf_tag<plus, Tag,Tag> { typedef Tag type; };
template<class Tag> struct bf_vf_tag<minus,Tag,Tag> { typedef Tag type; };
// -----------------------------
// multiplies
// -----------------------------
template<> struct bf_vf_tag<multiplies,vf_tag_00,vf_tag_00> { typedef vf_tag_00 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_00,vf_tag_01> { typedef vf_tag_01 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_01,vf_tag_00> { typedef vf_tag_01 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_00,vf_tag_10> { typedef vf_tag_10 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_10,vf_tag_00> { typedef vf_tag_10 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_01,vf_tag_10> { typedef vf_tag_11 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_10,vf_tag_01> { typedef vf_tag_11 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_00,vf_tag_11> { typedef vf_tag_11 type; };
template<> struct bf_vf_tag<multiplies,vf_tag_11,vf_tag_00> { typedef vf_tag_11 type; };
}} // namespace rheolef::details
#endif // _RHEOLEF_VF_TAG_H
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::details::vf_tag_11
std::pair< std::true_type, std::true_type > vf_tag_11
Definition field_expr_variational_tag.h:52
rheolef::details::vf_tag_01
std::pair< std::false_type, std::true_type > vf_tag_01
Definition field_expr_variational_tag.h:51
rheolef::details::vf_tag_10
std::pair< std::true_type, std::false_type > vf_tag_10
Definition field_expr_variational_tag.h:53
rheolef
This file is part of Rheolef.
Definition compiler_eigen.h:39
rheolef::details::bf_vf_tag< minus, Tag, Tag >::type
Tag type
Definition field_expr_variational_tag.h:78
rheolef::details::bf_vf_tag< multiplies, vf_tag_00, vf_tag_00 >::type
vf_tag_00 type
Definition field_expr_variational_tag.h:81
rheolef::details::bf_vf_tag< multiplies, vf_tag_00, vf_tag_01 >::type
vf_tag_01 type
Definition field_expr_variational_tag.h:83
rheolef::details::bf_vf_tag< multiplies, vf_tag_00, vf_tag_10 >::type
vf_tag_10 type
Definition field_expr_variational_tag.h:86
rheolef::details::bf_vf_tag< multiplies, vf_tag_00, vf_tag_11 >::type
vf_tag_11 type
Definition field_expr_variational_tag.h:91
rheolef::details::bf_vf_tag< multiplies, vf_tag_01, vf_tag_00 >::type
vf_tag_01 type
Definition field_expr_variational_tag.h:84
rheolef::details::bf_vf_tag< multiplies, vf_tag_01, vf_tag_10 >::type
vf_tag_11 type
Definition field_expr_variational_tag.h:89
rheolef::details::bf_vf_tag< multiplies, vf_tag_10, vf_tag_00 >::type
vf_tag_10 type
Definition field_expr_variational_tag.h:87
rheolef::details::bf_vf_tag< multiplies, vf_tag_10, vf_tag_01 >::type
vf_tag_11 type
Definition field_expr_variational_tag.h:90
rheolef::details::bf_vf_tag< multiplies, vf_tag_11, vf_tag_00 >::type
vf_tag_11 type
Definition field_expr_variational_tag.h:92
rheolef::details::bf_vf_tag< plus, Tag, Tag >::type
Tag type
Definition field_expr_variational_tag.h:77
rheolef::details::bf_vf_tag
Definition field_expr_variational_tag.h:74
rheolef::details::type::type
vf_tag_nonlinear type
Definition field_expr_variational_tag.h:74
rheolef::details::dual_vf_tag< vf_tag_00 >::type
vf_tag_00 type
Definition field_expr_variational_tag.h:61
rheolef::details::dual_vf_tag< vf_tag_01 >::type
vf_tag_10 type
Definition field_expr_variational_tag.h:59
rheolef::details::dual_vf_tag< vf_tag_10 >::type
vf_tag_01 type
Definition field_expr_variational_tag.h:60
rheolef::details::dual_vf_tag< vf_tag_11 >::type
vf_tag_11 type
Definition field_expr_variational_tag.h:62
rheolef::details::dual_vf_tag
Definition field_expr_variational_tag.h:58
rheolef::details::type::type
vf_tag_nonlinear type
Definition field_expr_variational_tag.h:58
rheolef::details::minus
Definition expression.h:544
rheolef::details::multiplies
Definition expression.h:746
rheolef::details::plus
Definition expression.h:457
rheolef::details::uf_vf_tag
Definition field_expr_variational_tag.h:67
rheolef::details::uf_vf_tag::type
vf_tag_nonlinear type
Definition field_expr_variational_tag.h:67
rheolef::details::vf_tag_nonlinear
Definition field_expr_variational_tag.h:49