27 character(len=*),
intent(in) :: auto_dimension
28 type(
map_type),
intent(inout) :: action_attributes
30 integer :: auto_dim_id, index_of_match, entire_dim_size
31 integer,
dimension(:),
allocatable :: dimensions_to_slice, indexes_to_slice
37 if (index_of_match .ne. 0)
then 43 deallocate(dimensions_to_slice, indexes_to_slice)
54 source_monc, operator_result_values)
57 type(
map_type),
intent(inout) :: action_attributes
58 integer,
intent(in) :: source_monc_location, source_monc
59 real(kind=DEFAULT_PRECISION),
dimension(:),
allocatable,
intent(inout) :: operator_result_values
61 character(len=STRING_LENGTH) :: field_to_slice
62 integer,
dimension(:),
allocatable :: dimensions_to_slice, indexes_to_slice, dim_weights, dim_periods, dim_starts, indexes
63 integer :: number_dims, sliced_size, i, j, source_dim
74 dimensions_to_slice, indexes_to_slice, dim_weights, dim_periods, dim_starts, number_dims, sliced_size)
78 allocate(operator_result_values(sliced_size), indexes(number_dims))
83 source_dim=source_dim+(indexes(j)-1)*dim_weights(j)
85 operator_result_values(i)=field_local_values%values(source_dim)
86 indexes(1)=indexes(1)+dim_periods(1)
88 if (indexes(j) .gt. io_configuration%registered_moncs(source_monc_location)%local_dim_sizes(j))
then 90 if (j .lt. number_dims) indexes(j+1)=indexes(j+1)+dim_periods(j+1)
94 deallocate(dimensions_to_slice, indexes_to_slice, dim_weights, dim_periods, indexes, dim_starts)
103 integer,
intent(in) :: dimension_id, list_of_dims(:)
107 do i=1,
size(list_of_dims)
108 if (list_of_dims(i) == dimension_id)
then 127 indexes_to_slice, dim_weights, dim_periods, dim_starts, number_dims, sliced_size)
130 integer,
dimension(:),
intent(in) :: dimensions_to_slice, indexes_to_slice
131 integer,
dimension(:),
allocatable,
intent(out) :: dim_weights, dim_periods, dim_starts
132 integer,
intent(out) :: number_dims, sliced_size
134 integer :: i, j, dimension_id, amount_to_add, located_dim
135 integer,
dimension(:),
allocatable :: dim_sizes
136 logical,
dimension(:),
allocatable :: found_slice_field
138 number_dims=corresponding_field_definition%dimensions
139 allocate(dim_sizes(number_dims), dim_weights(number_dims), dim_periods(number_dims), dim_starts(number_dims),&
140 found_slice_field(
size(dimensions_to_slice)))
141 found_slice_field=.false.
146 if (located_dim .gt. 0)
then 147 dim_periods(i)=indexes_to_slice(located_dim)
148 if (registered_monc_info%local_dim_starts(dimension_id) == 1)
then 151 dim_starts(i)=dim_periods(i) - mod(registered_monc_info%local_dim_starts(dimension_id)-2, dim_periods(i))
153 dim_sizes(i)=ceiling(
real(registered_monc_info%local_dim_sizes(dimension_id) - (dim_starts(i)-1))/&
154 real(indexes_to_slice(located_dim)))
155 found_slice_field(located_dim)=.true.
157 dim_sizes(i)=registered_monc_info%local_dim_sizes(dimension_id)
162 do i=1,
size(found_slice_field)
163 if (.not. found_slice_field(i))
call log_log(
log_error,
"Can not find a dimension to slice in provided field")
170 if (j .lt. i) dim_weights(i)=dim_weights(i)*registered_monc_info%local_dim_sizes(j)
171 amount_to_add=amount_to_add*dim_sizes(j)
173 sliced_size=sliced_size+amount_to_add
175 deallocate(dim_sizes, found_slice_field)
184 character(len=*),
intent(in) :: str_dim_to_slice, str_index_to_slice
185 integer,
dimension(:),
allocatable,
intent(out) :: dimensions_to_slice, indexes_to_slice
187 integer :: num_dims, num_indexes, i, dim_idx, index_idx, idx
190 if (num_dims .ne. num_indexes)
then 191 call log_log(
log_error,
"Coarsening number of dimensions and indexes must match")
193 allocate(dimensions_to_slice(num_dims), indexes_to_slice(num_indexes))
197 idx=index(str_dim_to_slice(dim_idx:),
",")
200 idx=len_trim(str_dim_to_slice)
207 idx=index(str_index_to_slice(index_idx:),
",")
210 idx=len_trim(str_index_to_slice)
212 idx=idx+(index_idx-1)
224 character(len=*),
intent(in) :: source_str, search_char
229 n=len_trim(source_str)
232 idx=index(source_str(i:), search_char)
242 type(
list_type) function fieldcoarsener_operator_get_required_fields(action_attributes)
245 character(len=STRING_LENGTH) :: field_to_slice
248 call c_add_string(fieldcoarsener_operator_get_required_fields, field_to_slice)
255 character(len=*),
intent(in) :: dim_str
257 if (dim_str .eq.
"x")
then 259 else if (dim_str .eq.
"y")
then 261 else if (dim_str .eq.
"z")
then 264 call log_log(log_error,
"Can not translate dimension "//trim(dim_str))
273 type(io_configuration_type),
intent(inout) :: io_configuration
274 character(len=STRING_LENGTH),
intent(in) :: dimension_name
subroutine get_dimensions_and_indexes_to_slice(str_dim_to_slice, str_index_to_slice, dimensions_to_slice, indexes_to_slice)
Retrieves the dimensions and indexes to slice from the strings provided in configuration.
Overall IO configuration.
integer, parameter, public log_error
Only log ERROR messages.
Contains functionality for managing and extracting data from the raw data dumps that the IO server re...
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer, parameter, public z_index
Grid index parameters.
integer function convert_dimension_str_to_id(dim_str)
Converts a dimension string to the corresponding numeric ID.
integer function, public get_action_attribute_integer(action_attributes, field_name)
Retrieves the name of a field from the attributes specified in the configuration. ...
integer function get_occurances_of_character(source_str, search_char)
Retrieves the number of occurances of a character in a source string.
Contains common definitions for the data and datatypes used by MONC.
A hashmap structure, the same as a map but uses hashing for greatly improved performance when storing...
Gets a specific integer element out of the list, stack, queue or map with the corresponding key...
Conversion between common inbuilt FORTRAN data types.
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...
logical function, public get_prognostic_field_configuration(io_configuration, field_name, field_namespace, prognostic_config, prognostic_containing_data_defn)
Retrieves the prognostic field configuration corresponding to a specific field name and returns wheth...
Map data structure that holds string (length 20 maximum) key value pairs.
Collection data structures.
subroutine determine_dimension_bounds(corresponding_field_definition, registered_monc_info, dimensions_to_slice, indexes_to_slice, dim_weights, dim_periods, dim_starts, number_dims, sliced_size)
Determines the dimension bounds which are used in the slicing.
Configuration that representes the state of a registered MONC process.
integer, parameter, public string_length
Default length of strings.
type(list_type) function, public fieldcoarsener_operator_get_required_fields(action_attributes)
Retrieves a list of the required fields for running this operator.
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. ...
List data structure which implements a doubly linked list. This list will preserve its order...
Functionality to support the different types of grid and abstraction between global grids and local o...
integer function get_entire_dimension_size(io_configuration, dimension_name)
Looks up the global size of a dimension based upon its name.
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.
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...
integer function locate_dimension(dimension_id, list_of_dims)
Locates a dimension in a list of dimensions or 0 if none can be found.
Configuration associated with the representation of a specific data field.
Converts data types to integers.
Coarsens a field by selecting data with a specific period in any number of dimensions.
Adds a string to the end of the list.
integer, parameter, public y_index
Parses the XML configuration file to produce the io configuration description which contains the data...
integer, parameter, public x_index