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