Runtime representation of a binary expression F(x,y), where F is a function of two argument (e.g. +) and x,y are expressions. More...
#include <binary_expr.hpp>
Public Types | |
typedef InterfaceType::numeric_type | numeric_type |
Public Member Functions | |
rt_binary_expr () | |
rt_binary_expr (InterfaceType *lhs, op_interface_type *op, InterfaceType *rhs) | |
template<typename LHS , typename OP , typename RHS > | |
rt_binary_expr (ct_binary_expr< LHS, OP, RHS > const &other) | |
template<typename LHS , typename OP , long value> | |
rt_binary_expr (ct_binary_expr< LHS, OP, ct_constant< value > > const &other) | |
template<long value, typename OP , typename RHS > | |
rt_binary_expr (ct_binary_expr< ct_constant< value >, OP, RHS > const &other) | |
template<long value1, typename OP , long value2> | |
rt_binary_expr (ct_binary_expr< ct_constant< value1 >, OP, ct_constant< value2 > > const &other) | |
template<typename LHS , typename OP , id_type id> | |
rt_binary_expr (ct_binary_expr< LHS, OP, ct_variable< id > > const &other) | |
template<id_type id, typename OP , typename RHS > | |
rt_binary_expr (ct_binary_expr< ct_variable< id >, OP, RHS > const &other) | |
template<id_type id1, typename OP , id_type id2> | |
rt_binary_expr (ct_binary_expr< ct_variable< id1 >, OP, ct_variable< id2 > > const &other) | |
template<id_type id, typename OP , long value> | |
rt_binary_expr (ct_binary_expr< ct_variable< id >, OP, ct_constant< value > > const &other) | |
template<id_type id, typename OP , long value> | |
rt_binary_expr (ct_binary_expr< ct_constant< value >, OP, ct_variable< id > > const &other) | |
rt_binary_expr (binary_expr const &other) | |
template<typename LHS , typename OP , typename RHS > | |
rt_binary_expr & | operator= (ct_binary_expr< LHS, OP, RHS > const &other) |
template<typename LHS , typename OP , long value> | |
rt_binary_expr & | operator= (ct_binary_expr< LHS, OP, ct_constant< value > > const &other) |
template<long value, typename OP , typename RHS > | |
rt_binary_expr & | operator= (ct_binary_expr< ct_constant< value >, OP, RHS > const &other) |
template<long value1, typename OP , long value2> | |
rt_binary_expr & | operator= (ct_binary_expr< ct_constant< value1 >, OP, ct_constant< value2 > > const &other) |
rt_binary_expr & | operator= (rt_binary_expr const &other) |
template<typename ScalarType > | |
rt_binary_expr & | operator= (rt_constant< ScalarType > const &other) |
template<long value> | |
rt_binary_expr & | operator= (ct_constant< value > const &other) |
rt_binary_expr & | operator= (numeric_type value) |
const InterfaceType * | lhs () const |
const op_interface_type * | op () const |
const InterfaceType * | rhs () const |
numeric_type | operator() (numeric_type val) const |
template<typename ScalarType > | |
numeric_type | operator() (rt_constant< ScalarType > val) const |
template<long value> | |
numeric_type | operator() (ct_constant< value > val) const |
template<typename VectorType > | |
numeric_type | operator() (VectorType const &v) const |
numeric_type | operator() (std::vector< numeric_type > const &stl_v) const |
template<typename T0 > | |
numeric_type | operator() (viennamath::ct_vector_1< T0 > const &v) const |
template<typename T0 , typename T1 > | |
numeric_type | operator() (viennamath::ct_vector_2< T0, T1 > const &v) const |
template<typename T0 , typename T1 , typename T2 > | |
numeric_type | operator() (viennamath::ct_vector_3< T0, T1, T2 > const &v) const |
numeric_type | eval (std::vector< double > const &v) const |
numeric_type | eval (numeric_type val) const |
InterfaceType * | simplify () const |
Returns a simplified expression with trivial operations removed. The caller is responsible for deleting the object the returned pointer refers to. | |
bool | can_simplify () const |
Returns true if the expression can be simplified. | |
InterfaceType * | clone () const |
Returns a copy of the binary expression. The caller is responsible for deleting the returned object. | |
std::string | deep_str () const |
Returns a detailed string describing the binary expression. Acts recursively. | |
std::string | shallow_str () const |
Returns a short string describing the unary expression. Does not act recursively. | |
bool | is_unary () const |
Returns whether the expression is a unary expression, which is not the case (-> false). | |
numeric_type | unwrap () const |
Reduces the expression to a constant. If this is not possible, an expression_not_unwrappable_exception is thrown. | |
bool | is_constant () const |
Returns true if the expression merely represents a constant value. | |
InterfaceType * | substitute (const InterfaceType *e, const InterfaceType *repl) const |
If 'e' equals to this binary expression, the replacement 'repl' is returned. Otherwise, the unary expression is cloned. Note that the caller must ensure proper deletion of the returned object. | |
InterfaceType * | substitute (std::vector< const InterfaceType * > const &e, std::vector< const InterfaceType * > const &repl) const |
If one of the expressions in 'e' equals to this binary expression, the respective replacement 'repl' is returned. Otherwise, a copy of *this is returned. Note that the caller must ensure proper deletion of the returned object. | |
bool | deep_equal (const InterfaceType *other) const |
Performs a detailed comparison of the binary expression with the passed expression. Returns true if they represent the same expression (equal operands, equal operations, etc.). | |
bool | shallow_equal (const InterfaceType *other) const |
Returns true if the passed expression is any binary expression. | |
InterfaceType * | diff (const InterfaceType *diff_var) const |
Returns the derivative of this binary expression with respect to the variable 'diff_var'. The returned object must be deleted by the caller. | |
InterfaceType * | recursive_manipulation (rt_manipulation_wrapper< InterfaceType > const &fw) const |
Recursively manipulates the expression. If this expression is manipulated, the result is returned directly. Otherwise, the manipulator continues with the expression the unary operation is acting on. The returned object must be deleted by the caller. | |
void | recursive_traversal (rt_traversal_wrapper< InterfaceType > const &fw) const |
Recursively traverses the expression by calling the wrapper for each object without manipulating it. |
Runtime representation of a binary expression F(x,y), where F is a function of two argument (e.g. +) and x,y are expressions.
InterfaceType | The expression runtime interface to inherit from. Usually rt_expression_interface, but extensions are possible. |
typedef InterfaceType::numeric_type numeric_type |
rt_binary_expr | ( | ) | [inline] |
rt_binary_expr | ( | InterfaceType * | lhs, | |
op_interface_type * | op, | |||
InterfaceType * | rhs | |||
) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< LHS, OP, RHS > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< LHS, OP, ct_constant< value > > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< ct_constant< value >, OP, RHS > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< ct_constant< value1 >, OP, ct_constant< value2 > > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< LHS, OP, ct_variable< id > > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< ct_variable< id >, OP, RHS > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< ct_variable< id1 >, OP, ct_variable< id2 > > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< ct_variable< id >, OP, ct_constant< value > > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | ct_binary_expr< ct_constant< value >, OP, ct_variable< id > > const & | other | ) | [inline, explicit] |
rt_binary_expr | ( | binary_expr const & | other | ) | [inline] |
bool can_simplify | ( | ) | const [inline] |
Returns true if the expression can be simplified.
InterfaceType* clone | ( | ) | const [inline] |
Returns a copy of the binary expression. The caller is responsible for deleting the returned object.
bool deep_equal | ( | const InterfaceType * | other | ) | const [inline] |
Performs a detailed comparison of the binary expression with the passed expression. Returns true if they represent the same expression (equal operands, equal operations, etc.).
std::string deep_str | ( | ) | const [inline] |
Returns a detailed string describing the binary expression. Acts recursively.
InterfaceType* diff | ( | const InterfaceType * | diff_var | ) | const [inline] |
Returns the derivative of this binary expression with respect to the variable 'diff_var'. The returned object must be deleted by the caller.
numeric_type eval | ( | std::vector< double > const & | v | ) | const [inline] |
numeric_type eval | ( | numeric_type | val | ) | const [inline] |
bool is_constant | ( | ) | const [inline] |
Returns true if the expression merely represents a constant value.
bool is_unary | ( | ) | const [inline] |
Returns whether the expression is a unary expression, which is not the case (-> false).
const InterfaceType* lhs | ( | ) | const [inline] |
const op_interface_type* op | ( | ) | const [inline] |
numeric_type operator() | ( | viennamath::ct_vector_1< T0 > const & | v | ) | const [inline] |
numeric_type operator() | ( | std::vector< numeric_type > const & | stl_v | ) | const [inline] |
numeric_type operator() | ( | viennamath::ct_vector_2< T0, T1 > const & | v | ) | const [inline] |
numeric_type operator() | ( | viennamath::ct_vector_3< T0, T1, T2 > const & | v | ) | const [inline] |
numeric_type operator() | ( | numeric_type | val | ) | const [inline] |
numeric_type operator() | ( | rt_constant< ScalarType > | val | ) | const [inline] |
numeric_type operator() | ( | ct_constant< value > | val | ) | const [inline] |
numeric_type operator() | ( | VectorType const & | v | ) | const [inline] |
rt_binary_expr& operator= | ( | rt_constant< ScalarType > const & | other | ) | [inline] |
rt_binary_expr& operator= | ( | numeric_type | value | ) | [inline] |
rt_binary_expr& operator= | ( | ct_binary_expr< ct_constant< value1 >, OP, ct_constant< value2 > > const & | other | ) | [inline] |
rt_binary_expr& operator= | ( | rt_binary_expr< InterfaceType > const & | other | ) | [inline] |
rt_binary_expr& operator= | ( | ct_binary_expr< LHS, OP, RHS > const & | other | ) | [inline] |
rt_binary_expr& operator= | ( | ct_constant< value > const & | other | ) | [inline] |
rt_binary_expr& operator= | ( | ct_binary_expr< ct_constant< value >, OP, RHS > const & | other | ) | [inline] |
rt_binary_expr& operator= | ( | ct_binary_expr< LHS, OP, ct_constant< value > > const & | other | ) | [inline] |
InterfaceType* recursive_manipulation | ( | rt_manipulation_wrapper< InterfaceType > const & | fw | ) | const [inline] |
Recursively manipulates the expression. If this expression is manipulated, the result is returned directly. Otherwise, the manipulator continues with the expression the unary operation is acting on. The returned object must be deleted by the caller.
void recursive_traversal | ( | rt_traversal_wrapper< InterfaceType > const & | fw | ) | const [inline] |
Recursively traverses the expression by calling the wrapper for each object without manipulating it.
const InterfaceType* rhs | ( | ) | const [inline] |
bool shallow_equal | ( | const InterfaceType * | other | ) | const [inline] |
Returns true if the passed expression is any binary expression.
std::string shallow_str | ( | ) | const [inline] |
Returns a short string describing the unary expression. Does not act recursively.
InterfaceType* simplify | ( | ) | const [inline] |
Returns a simplified expression with trivial operations removed. The caller is responsible for deleting the object the returned pointer refers to.
InterfaceType* substitute | ( | const InterfaceType * | e, | |
const InterfaceType * | repl | |||
) | const [inline] |
If 'e' equals to this binary expression, the replacement 'repl' is returned. Otherwise, the unary expression is cloned. Note that the caller must ensure proper deletion of the returned object.
InterfaceType* substitute | ( | std::vector< const InterfaceType * > const & | e, | |
std::vector< const InterfaceType * > const & | repl | |||
) | const [inline] |
If one of the expressions in 'e' equals to this binary expression, the respective replacement 'repl' is returned. Otherwise, a copy of *this is returned. Note that the caller must ensure proper deletion of the returned object.
numeric_type unwrap | ( | ) | const [inline] |
Reduces the expression to a constant. If this is not possible, an expression_not_unwrappable_exception is thrown.