Modern Fortran function parser.
This function parser module is intended for applications where a set of mathematical fortran-style expressions is specified at runtime and is then evaluated for a large number of variable values. This is done by compiling the set of function strings into byte code, which is interpreted efficiently for the various variable values.
The default real kind (wp
) can be
changed using optional preprocessor flags.
This library was built with real kind:
real(kind=real64)
[8 bytes]
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | fparser_rk | = | real64 | real kind used by this module [8 bytes] |
The function parser class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(stack_func_container), | public, | dimension(:), allocatable | :: | bytecode_ops | array of function pointers |
||
integer, | public, | dimension(:), allocatable | :: | bytecode | array of integers |
||
integer, | public | :: | bytecodesize | = | 0 | ||
real(kind=wp), | public, | dimension(:), allocatable | :: | immed | |||
integer, | public | :: | immedsize | = | 0 | ||
real(kind=wp), | public, | dimension(:), allocatable | :: | stack | |||
integer, | public | :: | stacksize | = | 0 | ||
integer, | public | :: | stackptr | = | 0 | ||
type(list_of_errors), | public | :: | error_msg | list of error messages |
procedure, public :: parse => parse_function | |
procedure, public :: evaluate => evaluate_function | |
procedure, public :: destroy => destroy_parser | |
procedure, public :: error | |
procedure, public :: print_errors | |
procedure, public :: clear_errors | |
procedure, public :: compile_substr | |
procedure, public :: compile | |
procedure, public :: check_syntax | |
procedure, public :: add_error |
A wrapper to fparser to evaluate an array of functions.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(fparser), | public, | dimension(:), allocatable | :: | f | An array of parsers. Each one has the same variables. |
procedure, public :: parse => parse_function_array | |
procedure, public :: evaluate => evaluate_function_array | |
procedure, public :: destroy => destroy_parser_array | |
procedure, public :: error => error_array | |
procedure, public :: print_errors => print_errors_array | |
procedure, public :: clear_errors => clear_errors_array |