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)
243 type(
map_type),
intent(inout) :: action_attributes
245 character(len=STRING_LENGTH) :: 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