1 !***********************************************************************
2 !* GNU Lesser General Public License
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
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.
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
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 !***********************************************************************
20 !> @brief Utilities used in multiple test
22 use platform_mod, only: r8_kind
25 public :: allocate_buffer
26 public :: test_normal, test_openmp, test_halos
27 public :: no_mask, logical_mask, real_mask
29 integer, parameter :: test_normal = 0 !< sending a buffer in the compute domain
30 integer, parameter :: test_openmp = 1 !< sending a buffer in the compute domain but with blocking
31 integer, parameter :: test_halos = 2 !< sending a buffer in the data domain (i.e with halos)
32 integer, parameter :: no_mask = 0 !< Not using a mask
33 integer, parameter :: logical_mask = 1 !< Using a logical mask
34 integer, parameter :: real_mask = 2 !< Using a real mask
38 !> @brief Allocate the output buffer based on the starting/ending indices
39 !! @return output buffer set to -999_r8_kind
40 function allocate_buffer(is, ie, js, je, k, l) &
42 integer, intent(in) :: is !< Starting x index
43 integer, intent(in) :: ie !< Ending x index
44 integer, intent(in) :: js !< Starting y index
45 integer, intent(in) :: je !< Ending y index
46 integer, intent(in) :: k !< Number of points in the 4th dimension
47 integer, intent(in) :: l !< Number of points in the 5th dimension
48 real(kind=r8_kind), allocatable :: buffer(:,:,:,:)
50 allocate(buffer(is:ie, js:je, 1:k, 1:l))
52 end function allocate_buffer