MONC
reductionlocation-operator.F90
Go to the documentation of this file.
6  implicit none
7 
8 #ifndef TEST_MODE
9  private
10 #endif
11 
13 contains
14 
15  subroutine perform_reductionlocation_operator(io_configuration, field_values, action_attributes, source_monc_location, &
16  source_monc, operator_result_values)
17  type(io_configuration_type), intent(inout) :: io_configuration
18  type(hashmap_type), intent(inout) :: field_values
19  type(map_type), intent(inout) :: action_attributes
20  integer, intent(in) :: source_monc_location, source_monc
21  real(kind=default_precision), dimension(:), allocatable, intent(inout) :: operator_result_values
22 
23  character(len=STRING_LENGTH) :: location_local, val, val_local
24  type(data_values_type), pointer :: val_local_values, val_values, location_local_values
25  integer :: i
26 
27  call extract_tripplet_variables(get_action_attribute_string(action_attributes, "input"), location_local, val, val_local)
28 
29  val_local_values=>get_data_value_by_field_name(field_values, val_local)
30  val_values=>get_data_value_by_field_name(field_values, val)
31  location_local_values=>get_data_value_by_field_name(field_values, location_local)
32 
33  allocate(operator_result_values(size(location_local_values%values)))
34  do i=1, size(val_local_values%values)
35  if (val_local_values%values(i) .eq. val_values%values(i)) then
36  operator_result_values(i)=location_local_values%values(i)
37  else
38  operator_result_values(i)=-1.0_default_precision
39  end if
40  end do
42 
44  type(map_type), intent(inout) :: action_attributes
45 
46  character(len=STRING_LENGTH) :: location_local, val, val_local
47 
48  call extract_tripplet_variables(get_action_attribute_string(action_attributes, "input"), location_local, val, val_local)
49 
54 
55  subroutine extract_tripplet_variables(field_str, location_local, val, val_local)
56  character(len=*), intent(in) :: field_str
57  character(len=*), intent(out) :: location_local, val, val_local
58 
59  character :: c
60  character(len=STRING_LENGTH) :: artefacts(3)
61  integer :: i, field_length, start_point, index_loc
62 
63  field_length=len(trim(field_str))
64 
65  start_point=1
66  index_loc=1
67  do i=1, field_length
68  c=field_str(i:i)
69  if (c .eq. ",") then
70  artefacts(index_loc)=trim(adjustl(field_str(start_point: i-1)))
71  start_point=i+1
72  index_loc=index_loc+1
73  end if
74  end do
75  if (start_point .lt. i) artefacts(index_loc)=trim(adjustl(field_str(start_point: i-1)))
76  location_local=artefacts(1)
77  val=artefacts(2)
78  val_local=artefacts(3)
79  end subroutine extract_tripplet_variables
collections_mod::map_type
Map data structure that holds string (length 20 maximum) key value pairs.
Definition: collections.F90:86
data_utils_mod
Contains functionality for managing and extracting data from the raw data dumps that the IO server re...
Definition: datautils.F90:3
collections_mod
Collection data structures.
Definition: collections.F90:7
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
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
configuration_parser_mod::io_configuration_type
Overall IO configuration.
Definition: configurationparser.F90:104
configuration_parser_mod::get_data_value_by_field_name
Definition: configurationparser.F90:30
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
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
configuration_parser_mod::data_values_type
Definition: configurationparser.F90:34
datadefn_mod::string_length
integer, parameter, public string_length
Default length of strings.
Definition: datadefn.F90:10
collections_mod::list_type
List data structure which implements a doubly linked list. This list will preserve its order.
Definition: collections.F90:60
reductionlocation_operator_mod::extract_tripplet_variables
subroutine extract_tripplet_variables(field_str, location_local, val, val_local)
Definition: reductionlocation-operator.F90:56
collections_mod::c_add_string
Adds a string to the end of the list.
Definition: collections.F90:222
configuration_parser_mod
Parses the XML configuration file to produce the io configuration description which contains the data...
Definition: configurationparser.F90:3
data_utils_mod::get_action_attribute_string
character(len=string_length) function, public get_action_attribute_string(action_attributes, field_name)
Retrieves the name of a field from the attributes specified in the configuration.
Definition: datautils.F90:101
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