Skip to content

Commit

Permalink
Avoid using memory macros in MOM_random.F90
Browse files Browse the repository at this point in the history
  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.
  • Loading branch information
Hallberg-NOAA committed Jan 3, 2021
1 parent 6111327 commit 0b019b6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/framework/MOM_random.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -23,8 +23,6 @@ module MOM_random
public :: random_2d_norm
public :: random_unit_tests

#include <MOM_memory.h>

!> Container for pseudo-random number generators
type, public :: PRNG ; private

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit 0b019b6

Please sign in to comment.