MONC
Data Types | Modules | Functions/Subroutines | Variables
arithmetic-operator.F90 File Reference

Go to the source code of this file.

Data Types

type  arithmetic_operator_mod::arithmetic_execution_node
 
type  arithmetic_operator_mod::arithmetic_cache_item
 

Modules

module  arithmetic_operator_mod
 The arithmetic operator which allows the user to define arithmetic formulas based on fields and constants which are then executed BDMAS style. This works by parsing the text forumula into an execution tree which is walked in order to perform the final result. Building the tree is the potentially expensive aspect of this, so built trees are cached as it is likely that the equation will be run many times. Currently this is expressed in terms of scalars, and it will operate on all elements of the data.
 

Functions/Subroutines

subroutine, public arithmetic_operator_mod::initialise_arithmetic_operator ()
 Initialises this operator. More...
 
subroutine, public arithmetic_operator_mod::finalise_arithmetic_operator ()
 Finalises this opertor. More...
 
subroutine, public arithmetic_operator_mod::perform_arithmetic_operator (io_configuration, field_values, action_attributes, source_monc_location, source_monc, operator_result_values)
 Executes this arithmetic operator by attempting to retrieved the cached equation (and creates one if not found.) If there is no execution tree it then parses the equation into an execution tree and stores it. The stored execution tree is then executed and the real result returned. More...
 
integer function arithmetic_operator_mod::get_size_of_data_being_operated_on (cached_equation, field_values)
 Retrieves the number of data elements that this will operate on. It will produce a log error if any variable lengths are inconsistent. More...
 
recursive real(kind=default_precision) function, dimension(n) arithmetic_operator_mod::execute_equation_tree (equation_tree, field_values, n)
 Executes an equation tree by doing a post order traversal of the tree. If a node is a terminal then either the variable is looked up for its value or the constant is returned. If a node is a non terminal then the operator is performed on the result value of its left and right subtrees and the value returned. More...
 
recursive type(arithmetic_execution_node) function, pointer arithmetic_operator_mod::build_equation_tree (io_configuration, equation)
 Builds the equation tree, this searches for the least significant operator and then splits the equation based upon that. Each sub equation is then passed to recursive calls of this function which return subtrees for these aspects. Some string manipulation is done to remove braces which would otherwise be included in the terminal characters. More...
 
subroutine arithmetic_operator_mod::remove_character (raw_string, c)
 Removes all occurances of a character from a string in situ by replacing it with whitespace. More...
 
integer function arithmetic_operator_mod::get_location_of_least_significant_operator (equation)
 Given an equation this will retrieve the location of the least significant operator in that equation or 0 if no operator is found (i.e. the string is a terminal.) This takes account of parenthesis. More...
 
integer function arithmetic_operator_mod::get_operator_representation (op_char)
 Given a character representation of an operator this returns the internal numeric type representation of it. More...
 
type(list_type) function, public arithmetic_operator_mod::arithmetic_operator_get_required_fields (action_attributes)
 Retrieves the list of fields needed by this operator for a specific configuration. More...
 
type(list_type) function arithmetic_operator_mod::process_equation_to_get_required_fields (equation)
 Performs text processing on an equation to extract out all the required variable (fields) needed in order to run this equation and get the result. Note this ignores all values which are constants (reals or integers) More...
 
type(arithmetic_cache_item) function, pointer arithmetic_operator_mod::find_or_add_equation (equation)
 Locates an existing equation in the cache based upon the textual equation representation or creates a new entry and returns this one. More...
 
type(arithmetic_cache_item) function, pointer arithmetic_operator_mod::find_equation (equation, dolock)
 Finds an equation in the cache based upon its textual equation representation or returns null if none is found. More...
 

Variables

integer, parameter arithmetic_operator_mod::terminal_op =0
 
integer, parameter arithmetic_operator_mod::add_op =1
 
integer, parameter arithmetic_operator_mod::minus_op =2
 
integer, parameter arithmetic_operator_mod::mul_op =3
 
integer, parameter arithmetic_operator_mod::div_op =4
 
integer, parameter arithmetic_operator_mod::mod_op =5
 A specific node in the execution tree. More...
 
type(hashmap_type), volatile arithmetic_operator_mod::equation_cache
 
integer, volatile arithmetic_operator_mod::equation_cache_rwlock