OpenLB 1.7
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
olb::Expr Class Reference

Basic value-substitute enabling extraction of expression trees for code generation. More...

#include <expr.h>

+ Inheritance diagram for olb::Expr:
+ Collaboration diagram for olb::Expr:

Public Types

enum struct  Op {
  Add , Mul , Sub , Div ,
  Sqrt , Abs , Pow , Exp
}
 

Public Member Functions

 Expr (const Expr &rhs)
 
 Expr (double v)
 
 Expr ()
 
 Expr (std::string name)
 
 Expr (Expr lhs, Op op, Expr rhs)
 
 Expr (Op op, Expr rhs)
 
std::string describe () const
 
Exproperator+= (Expr rhs)
 
Exproperator-= (Expr rhs)
 
Exproperator*= (Expr rhs)
 
Exproperator/= (Expr rhs)
 

Detailed Description

Basic value-substitute enabling extraction of expression trees for code generation.

Definition at line 38 of file expr.h.

Member Enumeration Documentation

◆ Op

enum struct olb::Expr::Op
strong
Enumerator
Add 
Mul 
Sub 
Div 
Sqrt 
Abs 
Pow 
Exp 

Definition at line 40 of file expr.h.

Constructor & Destructor Documentation

◆ Expr() [1/6]

olb::Expr::Expr ( const Expr & rhs)
inline

Definition at line 106 of file expr.h.

106 :
107 _payload(rhs._payload) { }

◆ Expr() [2/6]

olb::Expr::Expr ( double v)
inline

Definition at line 109 of file expr.h.

109 :
110 _payload(Constant{v}) { }

◆ Expr() [3/6]

olb::Expr::Expr ( )
inline

Definition at line 112 of file expr.h.

112 :
113 Expr(double{}) { }
Expr()
Definition expr.h:112

◆ Expr() [4/6]

olb::Expr::Expr ( std::string name)
inline

Definition at line 115 of file expr.h.

115 :
116 _payload(Symbol{name}) { }
std::string name()
Returns distinct name on GCC, Clang and ICC but may return arbitrary garbage as per the standard.
Definition meta.h:100

◆ Expr() [5/6]

olb::Expr::Expr ( Expr lhs,
Op op,
Expr rhs )
inline

Definition at line 118 of file expr.h.

118 :
119 _payload(Binary(lhs, op, rhs)) { }

◆ Expr() [6/6]

olb::Expr::Expr ( Op op,
Expr rhs )
inline

Definition at line 121 of file expr.h.

121 :
122 _payload(Unary(op, rhs)) { }

Member Function Documentation

◆ describe()

std::string olb::Expr::describe ( ) const
inline

Definition at line 124 of file expr.h.

124 {
125 std::string out;
126 std::visit([&out](auto& x) {
127 out = x.describe();
128 }, _payload);
129 return out;
130 };

◆ operator*=()

Expr & olb::Expr::operator*= ( Expr rhs)

Definition at line 148 of file expr.h.

148 {
149 _payload = Binary(*this, Op::Mul, rhs);
150 return *this;
151}

References Mul.

◆ operator+=()

Expr & olb::Expr::operator+= ( Expr rhs)

Definition at line 138 of file expr.h.

138 {
139 _payload = Binary(*this, Op::Add, rhs);
140 return *this;
141}

References Add.

◆ operator-=()

Expr & olb::Expr::operator-= ( Expr rhs)

Definition at line 143 of file expr.h.

143 {
144 _payload = Binary(*this, Op::Sub, rhs);
145 return *this;
146}

References Sub.

◆ operator/=()

Expr & olb::Expr::operator/= ( Expr rhs)

Definition at line 153 of file expr.h.

153 {
154 _payload = Binary(*this, Op::Div, rhs);
155 return *this;
156}

References Div.


The documentation for this class was generated from the following file: