From 0b019b66773b6b8589b68fe565193cab10e6307f Mon Sep 17 00:00:00 2001 From: Robert Hallberg Date: Sun, 3 Jan 2021 09:58:00 -0500 Subject: [PATCH] Avoid using memory macros in MOM_random.F90 Expanded the SZI_ and SZJ_ macros in random_2d_ routines to eliminate any dependence on MOM_memory.h and facilitate the future compilation of MOM_random as a part of a MOM framework library. All answers are bitwise identical. --- src/framework/MOM_random.F90 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/framework/MOM_random.F90 b/src/framework/MOM_random.F90 index 161236572c..21e3223a03 100644 --- a/src/framework/MOM_random.F90 +++ b/src/framework/MOM_random.F90 @@ -11,7 +11,7 @@ module MOM_random use MersenneTwister_mod, only : getRandomReal ! Generates a random number use MersenneTwister_mod, only : getRandomPositiveInt ! Generates a random positive integer -use MOM_io, only : stdout, stderr +use iso_fortran_env, only : stdout=>output_unit, stderr=>error_unit implicit none ; private @@ -23,8 +23,6 @@ module MOM_random public :: random_2d_norm public :: random_unit_tests -#include - !> Container for pseudo-random number generators type, public :: PRNG ; private @@ -63,7 +61,7 @@ end function random_norm subroutine random_2d_01(CS, HI, rand) type(PRNG), intent(inout) :: CS !< Container for pseudo-random number generators type(hor_index_type), intent(in) :: HI !< Horizontal index structure - real, dimension(SZI_(HI),SZJ_(HI)), intent(out) :: rand !< Random numbers between 0 and 1 + real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), intent(out) :: rand !< Random numbers between 0 and 1 ! Local variables integer :: i,j @@ -80,7 +78,7 @@ end subroutine random_2d_01 subroutine random_2d_norm(CS, HI, rand) type(PRNG), intent(inout) :: CS !< Container for pseudo-random number generators type(hor_index_type), intent(in) :: HI !< Horizontal index structure - real, dimension(SZI_(HI),SZJ_(HI)), intent(out) :: rand !< Random numbers between 0 and 1 + real, dimension(HI%isd:HI%ied,HI%jsd:HI%jed), intent(out) :: rand !< Random numbers between 0 and 1 ! Local variables integer :: i,j,n