MONC
operator.F90
Go to the documentation of this file.
1 
14  use logging_mod, only : log_error, log_log
15  implicit none
16 
17 #ifndef TEST_MODE
18  private
19 #endif
20 
21  abstract interface
22  type(list_type) function get_operator_required_fields_interface(action_attributes)
23  import :: list_type, map_type
24  type(map_type), intent(inout) :: action_attributes
26  subroutine perform_activity(io_configuration, field_values, action_attributes, source_monc_location, &
27  source_monc, operator_result_values)
29  type(io_configuration_type), intent(inout) :: io_configuration
30  type(hashmap_type), intent(inout) :: field_values
31  type(map_type), intent(inout) :: action_attributes
32  integer, intent(in) :: source_monc_location, source_monc
33  real(kind=default_precision), dimension(:), allocatable, intent(inout) :: operator_result_values
34  end subroutine perform_activity
35  end interface
36 
39 contains
40 
42  subroutine initialise_operators()
43  call initialise_arithmetic_operator()
44  end subroutine initialise_operators
45 
47  subroutine finalise_operators()
48  call finalise_arithmetic_operator()
49  end subroutine finalise_operators
50 
54  function get_operator_perform_procedure(operator_name)
55  character(len=*), intent(in) :: operator_name
57 
58  if (trim(operator_name) .eq. "arithmetic") then
59  get_operator_perform_procedure=>perform_arithmetic_operator
60  else if (trim(operator_name) .eq. "localreduce") then
61  get_operator_perform_procedure=>perform_localreduce_operator
62  else if (trim(operator_name) .eq. "reductionlocation") then
63  get_operator_perform_procedure=>perform_reductionlocation_operator
64  else if (trim(operator_name) .eq. "field_slicer") then
65  get_operator_perform_procedure=>perform_fieldslicer_operator
66  else if (trim(operator_name) .eq. "field_coarsener") then
67  get_operator_perform_procedure=>perform_fieldcoarsener_operator
68  else
69  call log_log(log_error, "Operator '"//trim(operator_name)//"' not found so ignoring")
70  end if
71  end function get_operator_perform_procedure
72 
76  type(list_type) function get_operator_required_fields(operator_name, action_attributes)
77  character(len=*), intent(in) :: operator_name
78  type(map_type), intent(inout) :: action_attributes
79 
80  if (trim(operator_name) .eq. "arithmetic") then
81  get_operator_required_fields=arithmetic_operator_get_required_fields(action_attributes)
82  else if (trim(operator_name) .eq. "localreduce") then
83  get_operator_required_fields=localreduce_operator_get_required_fields(action_attributes)
84  else if (trim(operator_name) .eq. "reductionlocation") then
85  get_operator_required_fields=reductionlocation_operator_get_required_fields(action_attributes)
86  else if (trim(operator_name) .eq. "field_slicer") then
87  get_operator_required_fields=fieldslicer_operator_get_required_fields(action_attributes)
88  else if (trim(operator_name) .eq. "field_coarsener") then
89  get_operator_required_fields=fieldcoarsener_operator_get_required_fields(action_attributes)
90  else
91  call log_log(log_error, "Operator '"//trim(operator_name)//"' not found so ignoring")
92  end if
93  end function get_operator_required_fields
94 
95  integer function get_operator_auto_size(io_configuration, operator_name, auto_dimension, action_attributes)
96  type(io_configuration_type), intent(inout) :: io_configuration
97  character(len=*), intent(in) :: operator_name, auto_dimension
98  type(map_type), intent(inout) :: action_attributes
99 
100  if (trim(operator_name) .eq. "field_coarsener") then
101  get_operator_auto_size=fieldcoarsener_operator_get_auto_size(io_configuration, auto_dimension, action_attributes)
102  else
104  end if
105  end function get_operator_auto_size
106 end module operator_mod
logging_mod::log_error
integer, parameter, public log_error
Only log ERROR messages.
Definition: logging.F90:11
collections_mod::map_type
Map data structure that holds string (length 20 maximum) key value pairs.
Definition: collections.F90:86
operator_mod::initialise_operators
subroutine, public initialise_operators()
Initialises any operators that require initialisation.
Definition: operator.F90:43
arithmetic_operator_mod::perform_arithmetic_operator
subroutine, public 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 ...
Definition: arithmetic-operator.F90:66
collections_mod
Collection data structures.
Definition: collections.F90:7
fieldslicer_operator_mod::perform_fieldslicer_operator
subroutine, public perform_fieldslicer_operator(io_configuration, field_values, action_attributes, source_monc_location, source_monc, operator_result_values)
Performs the actual field slicing.
Definition: fieldslicer-operator.F90:27
collections_mod::hashmap_type
A hashmap structure, the same as a map but uses hashing for greatly improved performance when storing...
Definition: collections.F90:94
fieldslicer_operator_mod::fieldslicer_operator_get_required_fields
type(list_type) function, public fieldslicer_operator_get_required_fields(action_attributes)
Retrieves a list of the required fields for running this operator.
Definition: fieldslicer-operator.F90:130
operator_mod::get_operator_required_fields
type(list_type) function, public get_operator_required_fields(operator_name, action_attributes)
Retrieves the list of fields required by an operator before it can run.
Definition: operator.F90:77
logging_mod::log_log
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
Definition: logging.F90:75
arithmetic_operator_mod::initialise_arithmetic_operator
subroutine, public initialise_arithmetic_operator()
Initialises this operator.
Definition: arithmetic-operator.F90:49
operator_mod::get_operator_required_fields_interface
Definition: operator.F90:22
fieldcoarsener_operator_mod::fieldcoarsener_operator_get_required_fields
type(list_type) function, public fieldcoarsener_operator_get_required_fields(action_attributes)
Retrieves a list of the required fields for running this operator.
Definition: fieldcoarsener-operator.F90:243
fieldcoarsener_operator_mod::perform_fieldcoarsener_operator
subroutine, public perform_fieldcoarsener_operator(io_configuration, field_values, action_attributes, source_monc_location, source_monc, operator_result_values)
Performs the field coarsener operator on a specific field.
Definition: fieldcoarsener-operator.F90:55
localreduce_operator_mod
Performs a local reduction, reducing a local array into a single scalar value.
Definition: localreduce-operator.F90:2
fieldslicer_operator_mod
Slices a field based upon the selected dimension and index.
Definition: fieldslicer-operator.F90:2
reductionlocation_operator_mod::perform_reductionlocation_operator
subroutine, public perform_reductionlocation_operator(io_configuration, field_values, action_attributes, source_monc_location, source_monc, operator_result_values)
Definition: reductionlocation-operator.F90:17
arithmetic_operator_mod::finalise_arithmetic_operator
subroutine, public finalise_arithmetic_operator()
Finalises this opertor.
Definition: arithmetic-operator.F90:54
operator_mod::finalise_operators
subroutine, public finalise_operators()
Finalises any operators that require finalisation.
Definition: operator.F90:48
configuration_parser_mod::io_configuration_type
Overall IO configuration.
Definition: configurationparser.F90:104
operator_mod::get_operator_perform_procedure
procedure(perform_activity) function, pointer, public get_operator_perform_procedure(operator_name)
Retrieves the operator execution procedure of an operator with a specific name.
Definition: operator.F90:55
reductionlocation_operator_mod
Definition: reductionlocation-operator.F90:1
reductionlocation_operator_mod::reductionlocation_operator_get_required_fields
type(list_type) function, public reductionlocation_operator_get_required_fields(action_attributes)
Definition: reductionlocation-operator.F90:44
operator_mod
Operator federator which manages the different operators which are available. Operators take in any n...
Definition: operator.F90:3
logging_mod
Logging utility.
Definition: logging.F90:2
arithmetic_operator_mod::arithmetic_operator_get_required_fields
type(list_type) function, public arithmetic_operator_get_required_fields(action_attributes)
Retrieves the list of fields needed by this operator for a specific configuration.
Definition: arithmetic-operator.F90:281
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
localreduce_operator_mod::perform_localreduce_operator
subroutine, public perform_localreduce_operator(io_configuration, field_values, action_attributes, source_monc_location, source_monc, operator_result_values)
Executes this local reduction operator.
Definition: localreduce-operator.F90:25
collections_mod::list_type
List data structure which implements a doubly linked list. This list will preserve its order.
Definition: collections.F90:60
operator_mod::perform_activity
Definition: operator.F90:26
fieldcoarsener_operator_mod
Coarsens a field by selecting data with a specific period in any number of dimensions.
Definition: fieldcoarsener-operator.F90:2
fieldcoarsener_operator_mod::fieldcoarsener_operator_get_auto_size
integer function, public fieldcoarsener_operator_get_auto_size(io_configuration, auto_dimension, action_attributes)
Retrieves the size of an auto dimension based upon the work that will be completed here.
Definition: fieldcoarsener-operator.F90:26
operator_mod::get_operator_auto_size
integer function, public get_operator_auto_size(io_configuration, operator_name, auto_dimension, action_attributes)
Definition: operator.F90:96
arithmetic_operator_mod
The arithmetic operator which allows the user to define arithmetic formulas based on fields and const...
Definition: arithmetic-operator.F90:6
localreduce_operator_mod::localreduce_operator_get_required_fields
type(list_type) function, public localreduce_operator_get_required_fields(action_attributes)
Retrieves the list of fields needed by this operator for a specific configuration.
Definition: localreduce-operator.F90:65
configuration_parser_mod
Parses the XML configuration file to produce the io configuration description which contains the data...
Definition: configurationparser.F90:3
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17