FMS  2025.04
Flexible Modeling System
array_utils.inc
1 !***********************************************************************
2 !* Apache License 2.0
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* Licensed under the Apache License, Version 2.0 (the "License");
7 !* you may not use this file except in compliance with the License.
8 !* You may obtain a copy of the License at
9 !*
10 !* http://www.apache.org/licenses/LICENSE-2.0
11 !*
12 !* FMS is distributed in the hope that it will be useful, but WITHOUT
13 !* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
14 !* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 !* PARTICULAR PURPOSE. See the License for the specific language
16 !* governing permissions and limitations under the License.
17 !***********************************************************************
18 !> @file
19 !> @brief Array allocation routines for multiple types for @ref allocate_array interface
20 
21 !> @addtogroup fms_io_utils_mod
22 !> @{
23 
24 !> @brief Allocate arrays using an input array of sizes.
25 subroutine allocate_array_i4_kind_1d(buf, sizes)
26 
27  integer(kind=i4_kind), dimension(:), allocatable, intent(inout) :: buf !< Array that will be allocated.
28  integer, dimension(1), intent(in) :: sizes !< Array of dimension sizes.
29 
30  if (allocated(buf)) then
31  deallocate(buf)
32  endif
33  allocate(buf(sizes(1)))
34 end subroutine allocate_array_i4_kind_1d
35 
36 
37 !> @brief Put a section of an array into a larger array.
38 subroutine put_array_section_i4_kind_1d(section, array, s, c)
39 
40  integer(kind=i4_kind), dimension(:), intent(in) :: section !< Section to be inserted.
41  integer(kind=i4_kind), dimension(:), intent(inout) :: array !< Array to insert the section in.
42  integer, dimension(1), intent(in) :: s !< Array of starting indices.
43  integer, dimension(1), intent(in) :: c !< Array of sizes.
44 
45  array(s(1):s(1)+c(1)-1 ) = section(:)
46 end subroutine put_array_section_i4_kind_1d
47 
48 
49 !> @brief Get a section of larger array.
50 subroutine get_array_section_i4_kind_1d(section, array, s, c)
51 
52  integer(kind=i4_kind), dimension(:), intent(inout) :: section !< Section to be extracted.
53  integer(kind=i4_kind), dimension(:), intent(in) :: array !< Array to extract the section from.
54  integer, dimension(1), intent(in) :: s !< Array of starting indices.
55  integer, dimension(1), intent(in) :: c !< Array of sizes.
56 
57  section(:) = array(s(1):s(1)+c(1)-1 )
58 end subroutine get_array_section_i4_kind_1d
59 
60 
61 !> @brief Allocate arrays using an input array of sizes.
62 subroutine allocate_array_i4_kind_2d(buf, sizes)
63 
64  integer(kind=i4_kind), dimension(:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
65  integer, dimension(2), intent(in) :: sizes !< Array of dimension sizes.
66 
67  if (allocated(buf)) then
68  deallocate(buf)
69  endif
70  allocate(buf(sizes(1),sizes(2)))
71 end subroutine allocate_array_i4_kind_2d
72 
73 
74 !> @brief Put a section of an array into a larger array.
75 subroutine put_array_section_i4_kind_2d(section, array, s, c)
76 
77  integer(kind=i4_kind), dimension(:,:), intent(in) :: section !< Section to be inserted.
78  integer(kind=i4_kind), dimension(:,:), intent(inout) :: array !< Array to insert the section in.
79  integer, dimension(2), intent(in) :: s !< Array of starting indices.
80  integer, dimension(2), intent(in) :: c !< Array of sizes.
81 
82  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ) = section(:,:)
83 end subroutine put_array_section_i4_kind_2d
84 
85 
86 !> @brief Get a section of larger array.
87 subroutine get_array_section_i4_kind_2d(section, array, s, c)
88 
89  integer(kind=i4_kind), dimension(:,:), intent(inout) :: section !< Section to be extracted.
90  integer(kind=i4_kind), dimension(:,:), intent(in) :: array !< Array to extract the section from.
91  integer, dimension(2), intent(in) :: s !< Array of starting indices.
92  integer, dimension(2), intent(in) :: c !< Array of sizes.
93 
94  section(:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 )
95 end subroutine get_array_section_i4_kind_2d
96 
97 
98 !> @brief Allocate arrays using an input array of sizes.
99 subroutine allocate_array_i4_kind_3d(buf, sizes)
100 
101  integer(kind=i4_kind), dimension(:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
102  integer, dimension(3), intent(in) :: sizes !< Array of dimension sizes.
103 
104  if (allocated(buf)) then
105  deallocate(buf)
106  endif
107  allocate(buf(sizes(1),sizes(2),sizes(3)))
108 end subroutine allocate_array_i4_kind_3d
109 
110 
111 !> @brief Put a section of an array into a larger array.
112 subroutine put_array_section_i4_kind_3d(section, array, s, c)
113 
114  integer(kind=i4_kind), dimension(:,:,:), intent(in) :: section !< Section to be inserted.
115  integer(kind=i4_kind), dimension(:,:,:), intent(inout) :: array !< Array to insert the section in.
116  integer, dimension(3), intent(in) :: s !< Array of starting indices.
117  integer, dimension(3), intent(in) :: c !< Array of sizes.
118 
119  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ) = section(:,:,:)
120 end subroutine put_array_section_i4_kind_3d
121 
122 
123 !> @brief Get a section of larger array.
124 subroutine get_array_section_i4_kind_3d(section, array, s, c)
125 
126  integer(kind=i4_kind), dimension(:,:,:), intent(inout) :: section !< Section to be extracted.
127  integer(kind=i4_kind), dimension(:,:,:), intent(in) :: array !< Array to extract the section from.
128  integer, dimension(3), intent(in) :: s !< Array of starting indices.
129  integer, dimension(3), intent(in) :: c !< Array of sizes.
130 
131  section(:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 )
132 end subroutine get_array_section_i4_kind_3d
133 
134 
135 !> @brief Allocate arrays using an input array of sizes.
136 subroutine allocate_array_i4_kind_4d(buf, sizes)
137 
138  integer(kind=i4_kind), dimension(:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
139  integer, dimension(4), intent(in) :: sizes !< Array of dimension sizes.
140 
141  if (allocated(buf)) then
142  deallocate(buf)
143  endif
144  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4)))
145 end subroutine allocate_array_i4_kind_4d
146 
147 
148 !> @brief Put a section of an array into a larger array.
149 subroutine put_array_section_i4_kind_4d(section, array, s, c)
150 
151  integer(kind=i4_kind), dimension(:,:,:,:), intent(in) :: section !< Section to be inserted.
152  integer(kind=i4_kind), dimension(:,:,:,:), intent(inout) :: array !< Array to insert the section in.
153  integer, dimension(4), intent(in) :: s !< Array of starting indices.
154  integer, dimension(4), intent(in) :: c !< Array of sizes.
155 
156  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ) = section(:,:,:,:)
157 end subroutine put_array_section_i4_kind_4d
158 
159 
160 !> @brief Get a section of larger array.
161 subroutine get_array_section_i4_kind_4d(section, array, s, c)
162 
163  integer(kind=i4_kind), dimension(:,:,:,:), intent(inout) :: section !< Section to be extracted.
164  integer(kind=i4_kind), dimension(:,:,:,:), intent(in) :: array !< Array to extract the section from.
165  integer, dimension(4), intent(in) :: s !< Array of starting indices.
166  integer, dimension(4), intent(in) :: c !< Array of sizes.
167 
168  section(:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 )
169 end subroutine get_array_section_i4_kind_4d
170 
171 
172 !> @brief Allocate arrays using an input array of sizes.
173 subroutine allocate_array_i4_kind_5d(buf, sizes)
174 
175  integer(kind=i4_kind), dimension(:,:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
176  integer, dimension(5), intent(in) :: sizes !< Array of dimension sizes.
177 
178  if (allocated(buf)) then
179  deallocate(buf)
180  endif
181  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4),sizes(5)))
182 end subroutine allocate_array_i4_kind_5d
183 
184 
185 !> @brief Put a section of an array into a larger array.
186 subroutine put_array_section_i4_kind_5d(section, array, s, c)
187 
188  integer(kind=i4_kind), dimension(:,:,:,:,:), intent(in) :: section !< Section to be inserted.
189  integer(kind=i4_kind), dimension(:,:,:,:,:), intent(inout) :: array !< Array to insert the section in.
190  integer, dimension(5), intent(in) :: s !< Array of starting indices.
191  integer, dimension(5), intent(in) :: c !< Array of sizes.
192 
193  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 ) = section(:,:,:,:,:)
194 end subroutine put_array_section_i4_kind_5d
195 
196 
197 !> @brief Get a section of larger array.
198 subroutine get_array_section_i4_kind_5d(section, array, s, c)
199 
200  integer(kind=i4_kind), dimension(:,:,:,:,:), intent(inout) :: section !< Section to be extracted.
201  integer(kind=i4_kind), dimension(:,:,:,:,:), intent(in) :: array !< Array to extract the section from.
202  integer, dimension(5), intent(in) :: s !< Array of starting indices.
203  integer, dimension(5), intent(in) :: c !< Array of sizes.
204 
205  section(:,:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 )
206 end subroutine get_array_section_i4_kind_5d
207 
208 
209 !> @brief Allocate arrays using an input array of sizes.
210 subroutine allocate_array_i8_kind_1d(buf, sizes)
211 
212  integer(kind=i8_kind), dimension(:), allocatable, intent(inout) :: buf !< Array that will be allocated.
213  integer, dimension(1), intent(in) :: sizes !< Array of dimension sizes.
214 
215  if (allocated(buf)) then
216  deallocate(buf)
217  endif
218  allocate(buf(sizes(1)))
219 end subroutine allocate_array_i8_kind_1d
220 
221 
222 !> @brief Put a section of an array into a larger array.
223 subroutine put_array_section_i8_kind_1d(section, array, s, c)
224 
225  integer(kind=i8_kind), dimension(:), intent(in) :: section !< Section to be inserted.
226  integer(kind=i8_kind), dimension(:), intent(inout) :: array !< Array to insert the section in.
227  integer, dimension(1), intent(in) :: s !< Array of starting indices.
228  integer, dimension(1), intent(in) :: c !< Array of sizes.
229 
230  array(s(1):s(1)+c(1)-1 ) = section(:)
231 end subroutine put_array_section_i8_kind_1d
232 
233 
234 !> @brief Get a section of larger array.
235 subroutine get_array_section_i8_kind_1d(section, array, s, c)
236 
237  integer(kind=i8_kind), dimension(:), intent(inout) :: section !< Section to be extracted.
238  integer(kind=i8_kind), dimension(:), intent(in) :: array !< Array to extract the section from.
239  integer, dimension(1), intent(in) :: s !< Array of starting indices.
240  integer, dimension(1), intent(in) :: c !< Array of sizes.
241 
242  section(:) = array(s(1):s(1)+c(1)-1 )
243 end subroutine get_array_section_i8_kind_1d
244 
245 
246 !> @brief Allocate arrays using an input array of sizes.
247 subroutine allocate_array_i8_kind_2d(buf, sizes)
248 
249  integer(kind=i8_kind), dimension(:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
250  integer, dimension(2), intent(in) :: sizes !< Array of dimension sizes.
251 
252  if (allocated(buf)) then
253  deallocate(buf)
254  endif
255  allocate(buf(sizes(1),sizes(2)))
256 end subroutine allocate_array_i8_kind_2d
257 
258 
259 !> @brief Put a section of an array into a larger array.
260 subroutine put_array_section_i8_kind_2d(section, array, s, c)
261 
262  integer(kind=i8_kind), dimension(:,:), intent(in) :: section !< Section to be inserted.
263  integer(kind=i8_kind), dimension(:,:), intent(inout) :: array !< Array to insert the section in.
264  integer, dimension(2), intent(in) :: s !< Array of starting indices.
265  integer, dimension(2), intent(in) :: c !< Array of sizes.
266 
267  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ) = section(:,:)
268 end subroutine put_array_section_i8_kind_2d
269 
270 
271 !> @brief Get a section of larger array.
272 subroutine get_array_section_i8_kind_2d(section, array, s, c)
273 
274  integer(kind=i8_kind), dimension(:,:), intent(inout) :: section !< Section to be extracted.
275  integer(kind=i8_kind), dimension(:,:), intent(in) :: array !< Array to extract the section from.
276  integer, dimension(2), intent(in) :: s !< Array of starting indices.
277  integer, dimension(2), intent(in) :: c !< Array of sizes.
278 
279  section(:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 )
280 end subroutine get_array_section_i8_kind_2d
281 
282 
283 !> @brief Allocate arrays using an input array of sizes.
284 subroutine allocate_array_i8_kind_3d(buf, sizes)
285 
286  integer(kind=i8_kind), dimension(:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
287  integer, dimension(3), intent(in) :: sizes !< Array of dimension sizes.
288 
289  if (allocated(buf)) then
290  deallocate(buf)
291  endif
292  allocate(buf(sizes(1),sizes(2),sizes(3)))
293 end subroutine allocate_array_i8_kind_3d
294 
295 
296 !> @brief Put a section of an array into a larger array.
297 subroutine put_array_section_i8_kind_3d(section, array, s, c)
298 
299  integer(kind=i8_kind), dimension(:,:,:), intent(in) :: section !< Section to be inserted.
300  integer(kind=i8_kind), dimension(:,:,:), intent(inout) :: array !< Array to insert the section in.
301  integer, dimension(3), intent(in) :: s !< Array of starting indices.
302  integer, dimension(3), intent(in) :: c !< Array of sizes.
303 
304  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ) = section(:,:,:)
305 end subroutine put_array_section_i8_kind_3d
306 
307 
308 !> @brief Get a section of larger array.
309 subroutine get_array_section_i8_kind_3d(section, array, s, c)
310 
311  integer(kind=i8_kind), dimension(:,:,:), intent(inout) :: section !< Section to be extracted.
312  integer(kind=i8_kind), dimension(:,:,:), intent(in) :: array !< Array to extract the section from.
313  integer, dimension(3), intent(in) :: s !< Array of starting indices.
314  integer, dimension(3), intent(in) :: c !< Array of sizes.
315 
316  section(:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 )
317 end subroutine get_array_section_i8_kind_3d
318 
319 
320 !> @brief Allocate arrays using an input array of sizes.
321 subroutine allocate_array_i8_kind_4d(buf, sizes)
322 
323  integer(kind=i8_kind), dimension(:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
324  integer, dimension(4), intent(in) :: sizes !< Array of dimension sizes.
325 
326  if (allocated(buf)) then
327  deallocate(buf)
328  endif
329  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4)))
330 end subroutine allocate_array_i8_kind_4d
331 
332 
333 !> @brief Put a section of an array into a larger array.
334 subroutine put_array_section_i8_kind_4d(section, array, s, c)
335 
336  integer(kind=i8_kind), dimension(:,:,:,:), intent(in) :: section !< Section to be inserted.
337  integer(kind=i8_kind), dimension(:,:,:,:), intent(inout) :: array !< Array to insert the section in.
338  integer, dimension(4), intent(in) :: s !< Array of starting indices.
339  integer, dimension(4), intent(in) :: c !< Array of sizes.
340 
341  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ) = section(:,:,:,:)
342 end subroutine put_array_section_i8_kind_4d
343 
344 
345 !> @brief Get a section of larger array.
346 subroutine get_array_section_i8_kind_4d(section, array, s, c)
347 
348  integer(kind=i8_kind), dimension(:,:,:,:), intent(inout) :: section !< Section to be extracted.
349  integer(kind=i8_kind), dimension(:,:,:,:), intent(in) :: array !< Array to extract the section from.
350  integer, dimension(4), intent(in) :: s !< Array of starting indices.
351  integer, dimension(4), intent(in) :: c !< Array of sizes.
352 
353  section(:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 )
354 end subroutine get_array_section_i8_kind_4d
355 
356 
357 !> @brief Allocate arrays using an input array of sizes.
358 subroutine allocate_array_i8_kind_5d(buf, sizes)
359 
360  integer(kind=i8_kind), dimension(:,:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
361  integer, dimension(5), intent(in) :: sizes !< Array of dimension sizes.
362 
363  if (allocated(buf)) then
364  deallocate(buf)
365  endif
366  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4),sizes(5)))
367 end subroutine allocate_array_i8_kind_5d
368 
369 
370 !> @brief Put a section of an array into a larger array.
371 subroutine put_array_section_i8_kind_5d(section, array, s, c)
372 
373  integer(kind=i8_kind), dimension(:,:,:,:,:), intent(in) :: section !< Section to be inserted.
374  integer(kind=i8_kind), dimension(:,:,:,:,:), intent(inout) :: array !< Array to insert the section in.
375  integer, dimension(5), intent(in) :: s !< Array of starting indices.
376  integer, dimension(5), intent(in) :: c !< Array of sizes.
377 
378  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 ) = section(:,:,:,:,:)
379 end subroutine put_array_section_i8_kind_5d
380 
381 
382 !> @brief Get a section of larger array.
383 subroutine get_array_section_i8_kind_5d(section, array, s, c)
384 
385  integer(kind=i8_kind), dimension(:,:,:,:,:), intent(inout) :: section !< Section to be extracted.
386  integer(kind=i8_kind), dimension(:,:,:,:,:), intent(in) :: array !< Array to extract the section from.
387  integer, dimension(5), intent(in) :: s !< Array of starting indices.
388  integer, dimension(5), intent(in) :: c !< Array of sizes.
389 
390  section(:,:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 )
391 end subroutine get_array_section_i8_kind_5d
392 
393 
394 !> @brief Allocate arrays using an input array of sizes.
395 subroutine allocate_array_r4_kind_1d(buf, sizes)
396 
397  real(kind=r4_kind), dimension(:), allocatable, intent(inout) :: buf !< Array that will be allocated.
398  integer, dimension(1), intent(in) :: sizes !< Array of dimension sizes.
399 
400  if (allocated(buf)) then
401  deallocate(buf)
402  endif
403  allocate(buf(sizes(1)))
404 end subroutine allocate_array_r4_kind_1d
405 
406 
407 !> @brief Put a section of an array into a larger array.
408 subroutine put_array_section_r4_kind_1d(section, array, s, c)
409 
410  real(kind=r4_kind), dimension(:), intent(in) :: section !< Section to be inserted.
411  real(kind=r4_kind), dimension(:), intent(inout) :: array !< Array to insert the section in.
412  integer, dimension(1), intent(in) :: s !< Array of starting indices.
413  integer, dimension(1), intent(in) :: c !< Array of sizes.
414 
415  array(s(1):s(1)+c(1)-1 ) = section(:)
416 end subroutine put_array_section_r4_kind_1d
417 
418 
419 !> @brief Get a section of larger array.
420 subroutine get_array_section_r4_kind_1d(section, array, s, c)
421 
422  real(kind=r4_kind), dimension(:), intent(inout) :: section !< Section to be extracted.
423  real(kind=r4_kind), dimension(:), intent(in) :: array !< Array to extract the section from.
424  integer, dimension(1), intent(in) :: s !< Array of starting indices.
425  integer, dimension(1), intent(in) :: c !< Array of sizes.
426 
427  section(:) = array(s(1):s(1)+c(1)-1 )
428 end subroutine get_array_section_r4_kind_1d
429 
430 
431 !> @brief Allocate arrays using an input array of sizes.
432 subroutine allocate_array_r4_kind_2d(buf, sizes)
433 
434  real(kind=r4_kind), dimension(:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
435  integer, dimension(2), intent(in) :: sizes !< Array of dimension sizes.
436 
437  if (allocated(buf)) then
438  deallocate(buf)
439  endif
440  allocate(buf(sizes(1),sizes(2)))
441 end subroutine allocate_array_r4_kind_2d
442 
443 
444 !> @brief Put a section of an array into a larger array.
445 subroutine put_array_section_r4_kind_2d(section, array, s, c)
446 
447  real(kind=r4_kind), dimension(:,:), intent(in) :: section !< Section to be inserted.
448  real(kind=r4_kind), dimension(:,:), intent(inout) :: array !< Array to insert the section in.
449  integer, dimension(2), intent(in) :: s !< Array of starting indices.
450  integer, dimension(2), intent(in) :: c !< Array of sizes.
451 
452  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ) = section(:,:)
453 end subroutine put_array_section_r4_kind_2d
454 
455 
456 !> @brief Get a section of larger array.
457 subroutine get_array_section_r4_kind_2d(section, array, s, c)
458 
459  real(kind=r4_kind), dimension(:,:), intent(inout) :: section !< Section to be extracted.
460  real(kind=r4_kind), dimension(:,:), intent(in) :: array !< Array to extract the section from.
461  integer, dimension(2), intent(in) :: s !< Array of starting indices.
462  integer, dimension(2), intent(in) :: c !< Array of sizes.
463 
464  section(:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 )
465 end subroutine get_array_section_r4_kind_2d
466 
467 
468 !> @brief Allocate arrays using an input array of sizes.
469 subroutine allocate_array_r4_kind_3d(buf, sizes)
470 
471  real(kind=r4_kind), dimension(:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
472  integer, dimension(3), intent(in) :: sizes !< Array of dimension sizes.
473 
474  if (allocated(buf)) then
475  deallocate(buf)
476  endif
477  allocate(buf(sizes(1),sizes(2),sizes(3)))
478 end subroutine allocate_array_r4_kind_3d
479 
480 
481 !> @brief Put a section of an array into a larger array.
482 subroutine put_array_section_r4_kind_3d(section, array, s, c)
483 
484  real(kind=r4_kind), dimension(:,:,:), intent(in) :: section !< Section to be inserted.
485  real(kind=r4_kind), dimension(:,:,:), intent(inout) :: array !< Array to insert the section in.
486  integer, dimension(3), intent(in) :: s !< Array of starting indices.
487  integer, dimension(3), intent(in) :: c !< Array of sizes.
488 
489  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ) = section(:,:,:)
490 end subroutine put_array_section_r4_kind_3d
491 
492 
493 !> @brief Get a section of larger array.
494 subroutine get_array_section_r4_kind_3d(section, array, s, c)
495 
496  real(kind=r4_kind), dimension(:,:,:), intent(inout) :: section !< Section to be extracted.
497  real(kind=r4_kind), dimension(:,:,:), intent(in) :: array !< Array to extract the section from.
498  integer, dimension(3), intent(in) :: s !< Array of starting indices.
499  integer, dimension(3), intent(in) :: c !< Array of sizes.
500 
501  section(:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 )
502 end subroutine get_array_section_r4_kind_3d
503 
504 
505 !> @brief Allocate arrays using an input array of sizes.
506 subroutine allocate_array_r4_kind_4d(buf, sizes)
507 
508  real(kind=r4_kind), dimension(:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
509  integer, dimension(4), intent(in) :: sizes !< Array of dimension sizes.
510 
511  if (allocated(buf)) then
512  deallocate(buf)
513  endif
514  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4)))
515 end subroutine allocate_array_r4_kind_4d
516 
517 
518 !> @brief Put a section of an array into a larger array.
519 subroutine put_array_section_r4_kind_4d(section, array, s, c)
520 
521  real(kind=r4_kind), dimension(:,:,:,:), intent(in) :: section !< Section to be inserted.
522  real(kind=r4_kind), dimension(:,:,:,:), intent(inout) :: array !< Array to insert the section in.
523  integer, dimension(4), intent(in) :: s !< Array of starting indices.
524  integer, dimension(4), intent(in) :: c !< Array of sizes.
525 
526  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ) = section(:,:,:,:)
527 end subroutine put_array_section_r4_kind_4d
528 
529 
530 !> @brief Get a section of larger array.
531 subroutine get_array_section_r4_kind_4d(section, array, s, c)
532 
533  real(kind=r4_kind), dimension(:,:,:,:), intent(inout) :: section !< Section to be extracted.
534  real(kind=r4_kind), dimension(:,:,:,:), intent(in) :: array !< Array to extract the section from.
535  integer, dimension(4), intent(in) :: s !< Array of starting indices.
536  integer, dimension(4), intent(in) :: c !< Array of sizes.
537 
538  section(:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 )
539 end subroutine get_array_section_r4_kind_4d
540 
541 
542 !> @brief Allocate arrays using an input array of sizes.
543 subroutine allocate_array_r4_kind_5d(buf, sizes)
544 
545  real(kind=r4_kind), dimension(:,:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
546  integer, dimension(5), intent(in) :: sizes !< Array of dimension sizes.
547 
548  if (allocated(buf)) then
549  deallocate(buf)
550  endif
551  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4),sizes(5)))
552 end subroutine allocate_array_r4_kind_5d
553 
554 
555 !> @brief Put a section of an array into a larger array.
556 subroutine put_array_section_r4_kind_5d(section, array, s, c)
557 
558  real(kind=r4_kind), dimension(:,:,:,:,:), intent(in) :: section !< Section to be inserted.
559  real(kind=r4_kind), dimension(:,:,:,:,:), intent(inout) :: array !< Array to insert the section in.
560  integer, dimension(5), intent(in) :: s !< Array of starting indices.
561  integer, dimension(5), intent(in) :: c !< Array of sizes.
562 
563  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 ) = section(:,:,:,:,:)
564 end subroutine put_array_section_r4_kind_5d
565 
566 
567 !> @brief Get a section of larger array.
568 subroutine get_array_section_r4_kind_5d(section, array, s, c)
569 
570  real(kind=r4_kind), dimension(:,:,:,:,:), intent(inout) :: section !< Section to be extracted.
571  real(kind=r4_kind), dimension(:,:,:,:,:), intent(in) :: array !< Array to extract the section from.
572  integer, dimension(5), intent(in) :: s !< Array of starting indices.
573  integer, dimension(5), intent(in) :: c !< Array of sizes.
574 
575  section(:,:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 )
576 end subroutine get_array_section_r4_kind_5d
577 
578 
579 !> @brief Allocate arrays using an input array of sizes.
580 subroutine allocate_array_r8_kind_1d(buf, sizes)
581 
582  real(kind=r8_kind), dimension(:), allocatable, intent(inout) :: buf !< Array that will be allocated.
583  integer, dimension(1), intent(in) :: sizes !< Array of dimension sizes.
584 
585  if (allocated(buf)) then
586  deallocate(buf)
587  endif
588  allocate(buf(sizes(1)))
589 end subroutine allocate_array_r8_kind_1d
590 
591 
592 !> @brief Put a section of an array into a larger array.
593 subroutine put_array_section_r8_kind_1d(section, array, s, c)
594 
595  real(kind=r8_kind), dimension(:), intent(in) :: section !< Section to be inserted.
596  real(kind=r8_kind), dimension(:), intent(inout) :: array !< Array to insert the section in.
597  integer, dimension(1), intent(in) :: s !< Array of starting indices.
598  integer, dimension(1), intent(in) :: c !< Array of sizes.
599 
600  array(s(1):s(1)+c(1)-1 ) = section(:)
601 end subroutine put_array_section_r8_kind_1d
602 
603 
604 !> @brief Get a section of larger array.
605 subroutine get_array_section_r8_kind_1d(section, array, s, c)
606 
607  real(kind=r8_kind), dimension(:), intent(inout) :: section !< Section to be extracted.
608  real(kind=r8_kind), dimension(:), intent(in) :: array !< Array to extract the section from.
609  integer, dimension(1), intent(in) :: s !< Array of starting indices.
610  integer, dimension(1), intent(in) :: c !< Array of sizes.
611 
612  section(:) = array(s(1):s(1)+c(1)-1 )
613 end subroutine get_array_section_r8_kind_1d
614 
615 
616 !> @brief Allocate arrays using an input array of sizes.
617 subroutine allocate_array_r8_kind_2d(buf, sizes)
618 
619  real(kind=r8_kind), dimension(:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
620  integer, dimension(2), intent(in) :: sizes !< Array of dimension sizes.
621 
622  if (allocated(buf)) then
623  deallocate(buf)
624  endif
625  allocate(buf(sizes(1),sizes(2)))
626 end subroutine allocate_array_r8_kind_2d
627 
628 
629 !> @brief Put a section of an array into a larger array.
630 subroutine put_array_section_r8_kind_2d(section, array, s, c)
631 
632  real(kind=r8_kind), dimension(:,:), intent(in) :: section !< Section to be inserted.
633  real(kind=r8_kind), dimension(:,:), intent(inout) :: array !< Array to insert the section in.
634  integer, dimension(2), intent(in) :: s !< Array of starting indices.
635  integer, dimension(2), intent(in) :: c !< Array of sizes.
636 
637  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ) = section(:,:)
638 end subroutine put_array_section_r8_kind_2d
639 
640 
641 !> @brief Get a section of larger array.
642 subroutine get_array_section_r8_kind_2d(section, array, s, c)
643 
644  real(kind=r8_kind), dimension(:,:), intent(inout) :: section !< Section to be extracted.
645  real(kind=r8_kind), dimension(:,:), intent(in) :: array !< Array to extract the section from.
646  integer, dimension(2), intent(in) :: s !< Array of starting indices.
647  integer, dimension(2), intent(in) :: c !< Array of sizes.
648 
649  section(:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 )
650 end subroutine get_array_section_r8_kind_2d
651 
652 
653 !> @brief Allocate arrays using an input array of sizes.
654 subroutine allocate_array_r8_kind_3d(buf, sizes)
655 
656  real(kind=r8_kind), dimension(:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
657  integer, dimension(3), intent(in) :: sizes !< Array of dimension sizes.
658 
659  if (allocated(buf)) then
660  deallocate(buf)
661  endif
662  allocate(buf(sizes(1),sizes(2),sizes(3)))
663 end subroutine allocate_array_r8_kind_3d
664 
665 
666 !> @brief Put a section of an array into a larger array.
667 subroutine put_array_section_r8_kind_3d(section, array, s, c)
668 
669  real(kind=r8_kind), dimension(:,:,:), intent(in) :: section !< Section to be inserted.
670  real(kind=r8_kind), dimension(:,:,:), intent(inout) :: array !< Array to insert the section in.
671  integer, dimension(3), intent(in) :: s !< Array of starting indices.
672  integer, dimension(3), intent(in) :: c !< Array of sizes.
673 
674  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ) = section(:,:,:)
675 end subroutine put_array_section_r8_kind_3d
676 
677 
678 !> @brief Get a section of larger array.
679 subroutine get_array_section_r8_kind_3d(section, array, s, c)
680 
681  real(kind=r8_kind), dimension(:,:,:), intent(inout) :: section !< Section to be extracted.
682  real(kind=r8_kind), dimension(:,:,:), intent(in) :: array !< Array to extract the section from.
683  integer, dimension(3), intent(in) :: s !< Array of starting indices.
684  integer, dimension(3), intent(in) :: c !< Array of sizes.
685 
686  section(:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 )
687 end subroutine get_array_section_r8_kind_3d
688 
689 
690 !> @brief Allocate arrays using an input array of sizes.
691 subroutine allocate_array_r8_kind_4d(buf, sizes)
692 
693  real(kind=r8_kind), dimension(:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
694  integer, dimension(4), intent(in) :: sizes !< Array of dimension sizes.
695 
696  if (allocated(buf)) then
697  deallocate(buf)
698  endif
699  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4)))
700 end subroutine allocate_array_r8_kind_4d
701 
702 
703 !> @brief Put a section of an array into a larger array.
704 subroutine put_array_section_r8_kind_4d(section, array, s, c)
705 
706  real(kind=r8_kind), dimension(:,:,:,:), intent(in) :: section !< Section to be inserted.
707  real(kind=r8_kind), dimension(:,:,:,:), intent(inout) :: array !< Array to insert the section in.
708  integer, dimension(4), intent(in) :: s !< Array of starting indices.
709  integer, dimension(4), intent(in) :: c !< Array of sizes.
710 
711  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ) = section(:,:,:,:)
712 end subroutine put_array_section_r8_kind_4d
713 
714 
715 !> @brief Get a section of larger array.
716 subroutine get_array_section_r8_kind_4d(section, array, s, c)
717 
718  real(kind=r8_kind), dimension(:,:,:,:), intent(inout) :: section !< Section to be extracted.
719  real(kind=r8_kind), dimension(:,:,:,:), intent(in) :: array !< Array to extract the section from.
720  integer, dimension(4), intent(in) :: s !< Array of starting indices.
721  integer, dimension(4), intent(in) :: c !< Array of sizes.
722 
723  section(:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 )
724 end subroutine get_array_section_r8_kind_4d
725 
726 
727 !> @brief Allocate arrays using an input array of sizes.
728 subroutine allocate_array_r8_kind_5d(buf, sizes)
729 
730  real(kind=r8_kind), dimension(:,:,:,:,:), allocatable, intent(inout) :: buf !< Array that will be allocated.
731  integer, dimension(5), intent(in) :: sizes !< Array of dimension sizes.
732 
733  if (allocated(buf)) then
734  deallocate(buf)
735  endif
736  allocate(buf(sizes(1),sizes(2),sizes(3),sizes(4),sizes(5)))
737 end subroutine allocate_array_r8_kind_5d
738 
739 
740 !> @brief Put a section of an array into a larger array.
741 subroutine put_array_section_r8_kind_5d(section, array, s, c)
742 
743  real(kind=r8_kind), dimension(:,:,:,:,:), intent(in) :: section !< Section to be inserted.
744  real(kind=r8_kind), dimension(:,:,:,:,:), intent(inout) :: array !< Array to insert the section in.
745  integer, dimension(5), intent(in) :: s !< Array of starting indices.
746  integer, dimension(5), intent(in) :: c !< Array of sizes.
747 
748  array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 ) = section(:,:,:,:,:)
749 end subroutine put_array_section_r8_kind_5d
750 
751 
752 !> @brief Get a section of larger array.
753 subroutine get_array_section_r8_kind_5d(section, array, s, c)
754 
755  real(kind=r8_kind), dimension(:,:,:,:,:), intent(inout) :: section !< Section to be extracted.
756  real(kind=r8_kind), dimension(:,:,:,:,:), intent(in) :: array !< Array to extract the section from.
757  integer, dimension(5), intent(in) :: s !< Array of starting indices.
758  integer, dimension(5), intent(in) :: c !< Array of sizes.
759 
760  section(:,:,:,:,:) = array(s(1):s(1)+c(1)-1 ,s(2):s(2)+c(2)-1 ,s(3):s(3)+c(3)-1 ,s(4):s(4)+c(4)-1 ,s(5):s(5)+c(5)-1 )
761 end subroutine get_array_section_r8_kind_5d
762 !> @}
subroutine allocate_array_r8_kind_1d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine put_array_section_i8_kind_2d(section, array, s, c)
Put a section of an array into a larger array.
subroutine put_array_section_r8_kind_4d(section, array, s, c)
Put a section of an array into a larger array.
subroutine put_array_section_i4_kind_2d(section, array, s, c)
Put a section of an array into a larger array.
Definition: array_utils.inc:76
subroutine put_array_section_i4_kind_1d(section, array, s, c)
Put a section of an array into a larger array.
Definition: array_utils.inc:39
subroutine get_array_section_i8_kind_4d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r4_kind_3d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r8_kind_1d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_i8_kind_3d(section, array, s, c)
Get a section of larger array.
subroutine allocate_array_i8_kind_2d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine put_array_section_i4_kind_3d(section, array, s, c)
Put a section of an array into a larger array.
subroutine put_array_section_r8_kind_2d(section, array, s, c)
Put a section of an array into a larger array.
subroutine put_array_section_r8_kind_3d(section, array, s, c)
Put a section of an array into a larger array.
subroutine get_array_section_i8_kind_5d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r4_kind_1d(section, array, s, c)
Get a section of larger array.
subroutine put_array_section_i8_kind_1d(section, array, s, c)
Put a section of an array into a larger array.
subroutine put_array_section_i8_kind_5d(section, array, s, c)
Put a section of an array into a larger array.
subroutine allocate_array_r4_kind_3d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_i8_kind_1d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_r8_kind_4d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_r8_kind_3d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_i8_kind_5d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_i4_kind_2d(buf, sizes)
Allocate arrays using an input array of sizes.
Definition: array_utils.inc:63
subroutine allocate_array_r4_kind_1d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine get_array_section_r8_kind_5d(section, array, s, c)
Get a section of larger array.
subroutine put_array_section_r4_kind_5d(section, array, s, c)
Put a section of an array into a larger array.
subroutine allocate_array_r8_kind_5d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_r4_kind_4d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine get_array_section_i4_kind_5d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_i4_kind_3d(section, array, s, c)
Get a section of larger array.
subroutine allocate_array_r4_kind_2d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_i4_kind_4d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine put_array_section_i8_kind_4d(section, array, s, c)
Put a section of an array into a larger array.
subroutine allocate_array_i4_kind_3d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine put_array_section_r4_kind_3d(section, array, s, c)
Put a section of an array into a larger array.
subroutine get_array_section_i8_kind_1d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r4_kind_4d(section, array, s, c)
Get a section of larger array.
subroutine put_array_section_r8_kind_1d(section, array, s, c)
Put a section of an array into a larger array.
subroutine get_array_section_i4_kind_2d(section, array, s, c)
Get a section of larger array.
Definition: array_utils.inc:88
subroutine get_array_section_r8_kind_2d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r8_kind_4d(section, array, s, c)
Get a section of larger array.
subroutine allocate_array_i8_kind_3d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine put_array_section_i4_kind_5d(section, array, s, c)
Put a section of an array into a larger array.
subroutine get_array_section_i4_kind_4d(section, array, s, c)
Get a section of larger array.
subroutine put_array_section_i4_kind_4d(section, array, s, c)
Put a section of an array into a larger array.
subroutine allocate_array_i4_kind_5d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_r4_kind_5d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine allocate_array_i4_kind_1d(buf, sizes)
Allocate arrays using an input array of sizes.
Definition: array_utils.inc:26
subroutine put_array_section_r8_kind_5d(section, array, s, c)
Put a section of an array into a larger array.
subroutine get_array_section_i4_kind_1d(section, array, s, c)
Get a section of larger array.
Definition: array_utils.inc:51
subroutine put_array_section_i8_kind_3d(section, array, s, c)
Put a section of an array into a larger array.
subroutine get_array_section_i8_kind_2d(section, array, s, c)
Get a section of larger array.
subroutine put_array_section_r4_kind_1d(section, array, s, c)
Put a section of an array into a larger array.
subroutine allocate_array_i8_kind_4d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine put_array_section_r4_kind_4d(section, array, s, c)
Put a section of an array into a larger array.
subroutine allocate_array_r8_kind_2d(buf, sizes)
Allocate arrays using an input array of sizes.
subroutine get_array_section_r4_kind_2d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r8_kind_3d(section, array, s, c)
Get a section of larger array.
subroutine get_array_section_r4_kind_5d(section, array, s, c)
Get a section of larger array.
subroutine put_array_section_r4_kind_2d(section, array, s, c)
Put a section of an array into a larger array.