Neko 1.99.7
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
expression::expression_t Type Reference

A compiled mathematical expression. More...

Public Member Functions

procedure, pass(thisinit (this, str)
 Compile an expression from a string.
 
procedure, pass(thiseval (this, res, n, x, y, z, t, dt)
 Evaluate the expression in a set of points.
 
procedure, pass(thisfree (this)
 Destructor.
 

Public Attributes

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.
 

Private Attributes

real(kind=rp), dimension(:,:), allocatable, private stk
 Evaluation stack, allocated once when the expression is compiled.
 

Detailed Description

Definition at line 117 of file expression.f90.

Member Function/Subroutine Documentation

◆ 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=rp), intent(in), optional  t,
real(kind=rp), 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]resThe result, one value per point.
[in]nThe number of points.
[in]xThe x-coordinates of the points.
[in]yThe y-coordinates of the points.
[in]zThe z-coordinates of the points.
[in]tThe current time, required if the expression uses t.
[in]dtThe 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)

Definition at line 139 of file expression.f90.

◆ init()

procedure, pass(this) expression::expression_t::init ( class(expression_t), intent(inout this,
character(len=*), intent(in str 
)
Parameters
[in]strThe expression, e.g. "6*U_b*y*(H - y)/H^2".

Definition at line 135 of file expression.f90.

Member Data Documentation

◆ depth

integer expression::expression_t::depth = 0

Definition at line 126 of file expression.f90.

◆ lit

real(kind=rp), dimension(:), allocatable expression::expression_t::lit

Definition at line 122 of file expression.f90.

◆ n_op

integer expression::expression_t::n_op = 0

Definition at line 124 of file expression.f90.

◆ op

integer, dimension(:), allocatable expression::expression_t::op

Definition at line 119 of file expression.f90.

◆ src

character(len=:), allocatable expression::expression_t::src

Definition at line 130 of file expression.f90.

◆ stk

real(kind=rp), dimension(:,:), allocatable, private expression::expression_t::stk
private

Definition at line 132 of file expression.f90.

◆ time_dependent

logical expression::expression_t::time_dependent = .false.

Definition at line 128 of file expression.f90.


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