Feel++ 0.91.0
Classes | Namespaces | Defines | Functions | Variables
/home/prudhomm/sources/feel/feel/feelcore/typetraits.hpp File Reference
#include <boost/concept_check.hpp>
#include <boost/preprocessor/comparison/less.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/logical/and.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/list/at.hpp>
#include <boost/preprocessor/list/cat.hpp>
#include <boost/preprocessor/list/for_each_product.hpp>
#include <boost/preprocessor/logical/or.hpp>
#include <boost/preprocessor/tuple/to_list.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/punctuation/comma.hpp>
#include <boost/preprocessor/facilities/identity.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/list/filter.hpp>

Classes

struct  Feel::type_traits< T >

Namespaces

namespace  Feel
namespace  Feel::math

Defines

#define FEEL_FUNC_NAME(T)   BOOST_PP_TUPLE_ELEM(3, 0 , T)
#define FEEL_FUNC_CALL(T)   BOOST_PP_TUPLE_ELEM(3, 1 , T)
#define FEEL_FUNC_NONS(T)   BOOST_PP_TUPLE_ELEM(3, 2 , T)
#define FEEL_STD_FUNCS
#define FEEL_STDCOMPLEX_FUNCS
#define FEEL_STD_BINARY_FUNCS
#define FEEL_MP_FUNCS
#define FEEL_MP_BINARY_FUNCS
#define FEEL_GLOBAL_FUNCS
#define FEEL_GLOBAL_BINARY_FUNCS
#define FEEL_TRAITS_FUNC_REAL(T, t)
#define FEEL_TRAITS_FUNC_IMAG(T, t)
#define FEEL_TRAITS_FUNC_CONJ(T, t)
#define FEEL_TRAITS_TYPE(T)   BOOST_PP_TUPLE_ELEM(7, 0 , T)
#define FEEL_TRAITS_REAL_TYPE(T)   BOOST_PP_TUPLE_ELEM(7, 1 , T)
#define FEEL_TRAITS_IS_FLOATING(T)   BOOST_PP_TUPLE_ELEM(7, 2 , T)
#define FEEL_TRAITS_IS_COMPLEX(T)   BOOST_PP_TUPLE_ELEM(7, 3 , T)
#define FEEL_TRAITS_RANK(T)   BOOST_PP_TUPLE_ELEM(7, 4 , T)
#define FEEL_TRAITS_EPSILON(T)   BOOST_PP_TUPLE_ELEM(7, 5 , T)
#define FEEL_TRAITS_FUNC_TYPE(T)   BOOST_PP_TUPLE_ELEM(7, 6 , T)
#define QD_NTYPES   0
#define QD_DD_TYPE
#define QD_QD_TYPE
#define MPFR_NTYPES   0
#define MPFR_MP_TYPE
#define FEEL_NUMERICAL_NTYPES   BOOST_PP_ADD(4, BOOST_PP_ADD( QD_NTYPES, MPFR_NTYPES ) )
#define FEEL_TRAITS_TYPES
#define FEEL_TRAITS_OP(_, T)   FEEL_TRAITS_OP_CODE T \
#define FEEL_TRAITS_OP_CODE(T)
#define FEEL_PRED_FUNC(d, data, elem)   BOOST_PP_EQUAL(FEEL_TRAITS_FUNC_TYPE(elem), data)
#define FEEL_UNARY_FUNCS_OP(_, TF)   FEEL_UNARY_FUNCS_OP_CODE TF \
#define FEEL_UNARY_FUNCS_OP_CODE(T, F)
#define FEEL_BINARY_FUNCS_OP(_, TF)   FEEL_BINARY_FUNCS_OP_CODE TF \
#define FEEL_BINARY_FUNCS_OP_CODE(T, F)

Functions

 Feel::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_TRAITS_OP, 1,(FEEL_TRAITS_TYPES))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_UNARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 0, FEEL_TRAITS_TYPES), FEEL_STD_FUNCS))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_UNARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 1, FEEL_TRAITS_TYPES), FEEL_MP_FUNCS))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_UNARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 2, FEEL_TRAITS_TYPES), FEEL_GLOBAL_FUNCS))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_UNARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 3, FEEL_TRAITS_TYPES), FEEL_STDCOMPLEX_FUNCS))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_BINARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 0, FEEL_TRAITS_TYPES), FEEL_STD_BINARY_FUNCS))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_BINARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 1, FEEL_TRAITS_TYPES), FEEL_MP_BINARY_FUNCS))
 Feel::math::BOOST_PP_LIST_FOR_EACH_PRODUCT (FEEL_BINARY_FUNCS_OP, 2,(BOOST_PP_LIST_FILTER(FEEL_PRED_FUNC, 2, FEEL_TRAITS_TYPES), FEEL_GLOBAL_BINARY_FUNCS))

Variables

const double Feel::factor_from_eps = 50
const float Feel::factor_from_eps_fl = 50

Detailed Description

Author:
Christophe Prud'homme <christophe.prudhomme@ujf-grenoble.fr>
Date:
2005-07-28

Define Documentation

#define FEEL_BINARY_FUNCS_OP (   _,
  TF 
)    FEEL_BINARY_FUNCS_OP_CODE TF \

Generate the binary functions for each type

#define FEEL_BINARY_FUNCS_OP_CODE (   T,
 
)
Value:
template<typename Type2>                                                                       \
  inline                                                                                         \
  FEEL_TRAITS_TYPE( T ) FEEL_FUNC_NAME( F )( FEEL_TRAITS_TYPE( T ) const& x, Type2 const& y ) \
  {                                                                                              \
      return FEEL_FUNC_CALL( F )( x, y );                                                       \
  }                                                                                              \
#define FEEL_GLOBAL_BINARY_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                        \
    1,                                                         \
    (                                                          \
        (pow       , ::npwr, npwr  )                           \
     )                                                         \
    )                                                          \
#define FEEL_GLOBAL_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                        \
    18,                                                        \
    (                                                          \
        (abs       , ::abs  , abs  ),   /* absolute value*/           \
        (sqrt      , ::sqrt , sqrt ),  /* square root */              \
        (norm1     , ::abs  , abs  ),   /* norm1    */                \
        (norm2     , ::abs  , abs  ),   /* norm2    */                \
        (norm_inf  , ::abs  , abs  ),   /* norm_inf */                \
        (cos       , ::cos  , cos  ),                                 \
        (sin       , ::sin  , sin  ),                                 \
        (tan       , ::tan  , tan  ),                                 \
        (acos      , ::acos , acos ),                                 \
        (asin      , ::asin , asin ),                                 \
        (atan      , ::atan , atan ),                                 \
        (cosh      , ::cosh , cosh ),                                 \
        (sinh      , ::sinh , sinh ),                                 \
        (tanh      , ::tanh , tanh ),                                 \
        (exp       , ::exp  , exp  ),                                 \
        (log       , ::log  , log  ),                                 \
        (ceil      , ::ceil , ceil ),                                 \
        (floor     , ::floor, floor)                                  \
     )                                                         \
    )                                                          \
#define FEEL_MP_BINARY_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                        \
    1,                                                         \
    (                                                          \
        (pow       , mpfr::pow, pow  )                           \
     )                                                         \
    )                                                          \
#define FEEL_MP_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                        \
    18,                                                        \
    (                                                          \
        (abs       , mpfr::abs  , abs  ),   /* absolute value*/           \
        (sqrt      , mpfr::sqrt , sqrt ),  /* square root */              \
        (norm1     , mpfr::abs  , abs  ),   /* norm1    */                \
        (norm2     , mpfr::abs  , abs  ),   /* norm2    */                \
        (norm_inf  , mpfr::abs  , abs  ),   /* norm_inf */                \
        (cos       , mpfr::cos  , cos  ),                                 \
        (sin       , mpfr::sin  , sin  ),                                 \
        (tan       , mpfr::tan  , tan  ),                                 \
        (acos      , mpfr::acos , acos ),                                 \
        (asin      , mpfr::asin , asin ),                                 \
        (atan      , mpfr::atan , atan ),                                 \
        (cosh      , mpfr::cosh , cosh ),                                 \
        (sinh      , mpfr::sinh , sinh ),                                 \
        (tanh      , mpfr::tanh , tanh ),                                 \
        (exp       , mpfr::exp  , exp  ),                                 \
        (log       , mpfr::log  , log  ),                                 \
        (ceil      , mpfr::ceil , ceil ),                                 \
        (floor     , mpfr::floor, floor)                                  \
     )                                                         \
    )                                                          \
#define FEEL_STD_BINARY_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                        \
    1,                                                         \
    (                                                          \
        (pow       , std::pow, pow  )                          \
     )                                                         \
    )                                                          \
#define FEEL_STD_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                        \
    19,                                                        \
    (                                                          \
        (abs       , std::abs  , abs  ),   /* absolute value*/        \
        (sqrt      , std::sqrt , sqrt ),  /* square root */           \
        (norm1     , std::abs  , abs  ),   /* norm1    */             \
        (norm2     , std::abs  , abs  ),   /* norm2    */             \
        (norm_inf  , std::abs  , abs  ),   /* norm_inf */             \
        (cos       , std::cos  , cos  ),                              \
        (sin       , std::sin  , sin  ),                              \
        (tan       , std::tan  , tan  ),                              \
        (acos      , std::acos , acos ),                              \
        (asin      , std::asin , asin ),                              \
        (atan      , std::atan , atan ),                              \
        (cosh      , std::cosh , cosh ),                              \
        (sinh      , std::sinh , sinh ),                              \
        (tanh      , std::tanh , tanh ),                              \
        (exp       , std::exp  , exp  ),                              \
        (log       , std::log  , log  ),                              \
        (log10     , std::log10, log10),                              \
        (ceil      , std::ceil , ceil ),                              \
        (floor     , std::floor, floor)                               \
     )                                                         \
    )                                                          \
#define FEEL_STDCOMPLEX_FUNCS
Value:
BOOST_PP_TUPLE_TO_LIST(                                    \
                           11,                                        \
                           (                                            \
                            (abs       , std::abs  , abs  ),   /* absolute value*/ \
                            (sqrt      , std::sqrt , sqrt ),  /* square root */ \
                            (norm1     , std::abs  , abs  ),   /* norm1    */ \
                            (norm2     , std::abs  , abs  ),   /* norm2    */ \
                            (norm_inf  , std::abs  , abs  ),   /* norm_inf */ \
                            (cos       , std::cos  , cos  ),            \
                            (sin       , std::sin  , sin  ),            \
                            (tan       , std::tan  , tan  ),            \
                            (exp       , std::exp  , exp  ),            \
                            (log       , std::log  , log  ),            \
                            (log10     , std::log10, log10 )            \
                                                                        ) \
                                                               )        \
#define FEEL_TRAITS_FUNC_CONJ (   T,
 
)
Value:
BOOST_PP_IF( FEEL_TRAITS_IS_COMPLEX(T),             \
               BOOST_PP_IDENTITY( std::conj( t ) ),    \
               BOOST_PP_IDENTITY( t ) )()              \
#define FEEL_TRAITS_FUNC_IMAG (   T,
 
)
Value:
BOOST_PP_IF( FEEL_TRAITS_IS_COMPLEX(T),                                 \
               BOOST_PP_IDENTITY( t.imag() ),                              \
               BOOST_PP_IDENTITY( FEEL_TRAITS_REAL_TYPE(T)( 0.0 ) ) )()   \
#define FEEL_TRAITS_FUNC_REAL (   T,
 
)
Value:
BOOST_PP_IF( FEEL_TRAITS_IS_COMPLEX(T),     \
               t.real(),  \
               t )      \
#define FEEL_TRAITS_TYPES
Value:
BOOST_PP_TUPLE_TO_LIST( \
      FEEL_NUMERICAL_NTYPES, \
      ( \
       QD_DD_TYPE                               \
       QD_QD_TYPE                               \
       MPFR_MP_TYPE                                                     \
       ( float      , float      , 1, 0, 7 , std::numeric_limits<float>::epsilon()*factor_from_eps_fl , 0 ), \
       ( double     , double     , 1, 0, 8 , std::numeric_limits<double>::epsilon()*factor_from_eps, 0 ), \
       ( std::complex<float>, float, 1, 1, 10, std::numeric_limits<float>::epsilon()*factor_from_eps_fl , 3 ), \
       ( std::complex<double>, double, 1, 1, 11, std::numeric_limits<double>::epsilon()*factor_from_eps , 3 ) \
      ) \
   ) \
#define FEEL_UNARY_FUNCS_OP (   _,
  TF 
)    FEEL_UNARY_FUNCS_OP_CODE TF \

Generate the unary functions for each type

#define FEEL_UNARY_FUNCS_OP_CODE (   T,
 
)
Value:
inline                                                                            \
  FEEL_TRAITS_TYPE( T ) FEEL_FUNC_NAME( F )( FEEL_TRAITS_TYPE( T ) const& t )    \
  {                                                                                 \
      return FEEL_FUNC_CALL( F )( t );                                             \
  }                                                                                 \