File expr.hxx

Defines

DEFINE_BINARY_OP(name, op)

Binary operator classes.

DEFINE_OVERLOAD_FUNC(name, func)

Define functions add, mul which use operator structs.

Functions

template<typename ExprT1, typename ExprT2>
BinaryResult<ExprT1, ExprT2, Add>::type add(const ExprT1 &e1, const ExprT2 &e2)

Addition of two Expressions.

template<typename ExprT1, typename ExprT2>
BinaryResult<ExprT1, ExprT2, Multiply>::type mul(const ExprT1 &e1, const ExprT2 &e2)

Multiplication of two Expressions.

template<typename Expr>
const Field3D eval3D(Expr e)

A function to evaluate expressions.

class Literal
#include <expr.hxx>

Literal class to capture BoutReal values in expressions.

Public Types

using type = Literal

Type of this expression.

Public Functions

inline Literal(BoutReal v)
inline ~Literal()
inline BoutReal operator()(int x, int y, int z) const

Private Members

const BoutReal val
class Field3DExpr

Public Types

using type = Field3D

Public Functions

inline Field3DExpr(const Field3D &f)
inline const BoutReal &operator()(int x, int y, int z) const

Private Members

const BoutReal *data
class Field2DExpr

Public Types

using type = Field2D

Public Functions

inline Field2DExpr(const Field2D &f)
inline const BoutReal &operator()(int x, int y, int z) const

Private Members

const BoutReal *data
template<class ExprT>
struct exprTraits
#include <expr.hxx>

Expression traits, to convert doubles etc. to Literal.

Public Types

using expr_type = ExprT
template<>
struct exprTraits<double>

Public Types

using expr_type = Literal
template<>
struct exprTraits<float>

Public Types

using expr_type = Literal
template<>
struct exprTraits<int>

Public Types

using expr_type = Literal
template<typename T>
struct asExpr

Public Types

using type = T

Public Static Functions

static inline const T &getExpr(const T &x)
template<>
struct asExpr<int>

Public Types

using type = Literal

Public Static Functions

static inline const Literal getExpr(const int &x)
template<>
struct asExpr<double>

Public Types

using type = Literal

Public Static Functions

static inline const Literal getExpr(const double &x)
template<>
struct asExpr<float>

Public Types

using type = Literal

Public Static Functions

static inline const Literal getExpr(const float &x)
template<>
struct asExpr<Field3D>

Public Types

using type = Field3DExpr

Public Static Functions

static inline const Field3DExpr getExpr(const Field3D &x)
template<typename Lhs, typename Rhs>
struct PromoteType

Public Types

using type = Field3D
template<class ExprT1, class ExprT2, class BinOp>
class BinaryExpr

Public Types

using ltype = typename exprTraits<ExprT1>::expr_type
using rtype = typename exprTraits<ExprT2>::expr_type
using type = typename PromoteType<ltype, rtype>::type

Type of the resulting expression.

Public Functions

inline BinaryExpr(const ExprT1 &e1, const ExprT2 &e2)
inline BoutReal operator()(int x, int y, int z) const

Private Members

ltype const _expr1
rtype const _expr2
template<typename ExprT1, typename ExprT2, class name>
struct BinaryResult

Public Types

using arg1 = typename asExpr<ExprT1>::type
using arg2 = typename asExpr<ExprT2>::type
using type = BinaryExpr<arg1, arg2, name>
struct Add

Public Static Functions

template<typename T>
static inline T apply(T a, T b)
struct Subtract

Public Static Functions

template<typename T>
static inline T apply(T a, T b)
struct Multiply

Public Static Functions

template<typename T>
static inline T apply(T a, T b)
struct Divide

Public Static Functions

template<typename T>
static inline T apply(T a, T b)
struct Power

Public Static Functions

template<typename T>
static inline T apply(T a, T b)