A compiled mathematical expression.
More...
|
| procedure, pass(this) | init (this, str) |
| | Compile an expression from a string.
|
| procedure, pass(this) | eval (this, res, n, x, y, z, t, dt) |
| | Evaluate the expression in a set of points.
|
| procedure, pass(this) | free (this) |
| | Destructor.
|
|
| integer, dimension(:), allocatable | op |
| | Opcode stream, in postfix order.
|
| real(kind=rp), dimension(:), allocatable | lit |
| | Literal operand, only meaningful for OP_LIT and OP_IPOW. Kept parallel to op to avoid a second index while evaluating.
|
| integer | n_op = 0 |
| | Number of opcodes.
|
| integer | depth = 0 |
| | Maximum depth of the evaluation stack.
|
| logical | time_dependent = .false. |
| | True if the expression references t or dt.
|
| character(len=:), allocatable | src |
| | The source string, kept for logging and error messages.
|
|
| real(kind=rp), dimension(:,:), allocatable, private | stk |
| | Evaluation stack, allocated once when the expression is compiled.
|
Definition at line 117 of file expression.f90.
◆ eval()
| procedure, pass(this) expression::expression_t::eval |
( |
class(expression_t), intent(inout) | this, |
|
|
real(kind=rp), dimension(n), intent(inout) | res, |
|
|
integer, intent(in) | n, |
|
|
real(kind=rp), dimension(n), intent(in) | x, |
|
|
real(kind=rp), dimension(n), intent(in) | y, |
|
|
real(kind=rp), dimension(n), intent(in) | z, |
|
|
real(kind=dp), intent(in), optional | t, |
|
|
real(kind=dp), intent(in), optional | dt ) |
Not thread safe. The evaluation stack is a component of the expression, so two concurrent calls on the same object corrupt each other's intermediate values. A caller inside an OpenMP parallel region must evaluate on one thread only.
- Parameters
-
| [in,out] | res | The result, one value per point. |
| [in] | n | The number of points. |
| [in] | x | The x-coordinates of the points. |
| [in] | y | The y-coordinates of the points. |
| [in] | z | The z-coordinates of the points. |
| [in] | t | The current time, required if the expression uses t. |
| [in] | dt | The current timestep, required if the expression uses dt. |
Definition at line 137 of file expression.f90.
◆ free()
| procedure, pass(this) expression::expression_t::free |
( |
class(expression_t), intent(inout) | this | ) |
|
◆ init()
| procedure, pass(this) expression::expression_t::init |
( |
class(expression_t), intent(inout) | this, |
|
|
character(len=*), intent(in) | str ) |
- Parameters
-
| [in] | str | The expression, e.g. "6*U_b*y*(H - y)/H^2". |
Definition at line 135 of file expression.f90.
◆ depth
| integer expression::expression_t::depth = 0 |
◆ lit
| real(kind=rp), dimension(:), allocatable expression::expression_t::lit |
◆ n_op
| integer expression::expression_t::n_op = 0 |
◆ op
| integer, dimension(:), allocatable expression::expression_t::op |
◆ src
| character(len=:), allocatable expression::expression_t::src |
◆ stk
| real(kind=rp), dimension(:,:), allocatable, private expression::expression_t::stk |
|
private |
◆ time_dependent
| logical expression::expression_t::time_dependent = .false. |
The documentation for this type was generated from the following file: