subroutine createArrays(rc)
! Creates Arrays and ArrayBundles used by the tests in this module
integer, intent(out) :: rc
! Information for a 2-d, 3-tile array
integer :: minIndexPTile(2,3)
integer :: maxIndexPTile(2,3)
integer :: decompPTile(2,3)
type(ESMF_ArraySpec) :: arraySpec
!------------------------------------------------------------------------
! Set up 3-tile distgrid
!------------------------------------------------------------------------
minIndexPTile(:,1) = [11,1]
maxIndexPTile(:,1) = [20,10]
minIndexPTile(:,2) = [11,11]
maxIndexPTile(:,2) = [20,20]
minIndexPTile(:,3) = [1,11]
maxIndexPTile(:,3) = [10,20]
! Decomposition for 8 PEs: Tiles 1 and 3 each have 2 DEs (along different
! dimensions); tile 2 has 4 DEs (2x2)
decompPTile(:,1) = [1,2]
decompPTile(:,2) = [2,2]
decompPTile(:,3) = [2,1]
distgrid3tile = ESMF_DistGridCreate( &
minIndexPTile = minIndexPTile, &
maxIndexPTile = maxIndexPTile, &
regDecompPTile = decompPTile, &
rc = rc)
if (rc /= ESMF_SUCCESS) return
!------------------------------------------------------------------------
! Create arrays on the 3-tile distgrid and associated array bundle
!------------------------------------------------------------------------
call ESMF_ArraySpecSet(arraySpec, typekind=ESMF_TYPEKIND_R8, rank=2, rc=rc)
if (rc /= ESMF_SUCCESS) return
array1 = ESMF_ArrayCreate(distgrid3tile, arraySpec, name="array1", rc=rc)
if (rc /= ESMF_SUCCESS) return
call ESMF_ArrayGet(array1, farrayPtr=array1Data, rc=rc)
if (rc /= ESMF_SUCCESS) return
call fillArray(array1Data, 1)
array1Read = ESMF_ArrayCreate(distgrid3tile, arraySpec, name="array1", rc=rc)
if (rc /= ESMF_SUCCESS) return
call ESMF_ArrayGet(array1Read, farrayPtr=array1ReadData, rc=rc)
if (rc /= ESMF_SUCCESS) return
array2 = ESMF_ArrayCreate(distgrid3tile, arraySpec, name="array2", rc=rc)
if (rc /= ESMF_SUCCESS) return
call ESMF_ArrayGet(array2, farrayPtr=array2Data, rc=rc)
if (rc /= ESMF_SUCCESS) return
call fillArray(array2Data, 2)
array2Read = ESMF_ArrayCreate(distgrid3tile, arraySpec, name="array2", rc=rc)
if (rc /= ESMF_SUCCESS) return
call ESMF_ArrayGet(array2Read, farrayPtr=array2ReadData, rc=rc)
if (rc /= ESMF_SUCCESS) return
array3 = ESMF_ArrayCreate(distgrid3tile, arraySpec, name="array3", rc=rc)
if (rc /= ESMF_SUCCESS) return
call ESMF_ArrayGet(array3, farrayPtr=array3Data, rc=rc)
if (rc /= ESMF_SUCCESS) return
call fillArray(array3Data, 3)
array3Read = ESMF_ArrayCreate(distgrid3tile, arraySpec, name="array3", rc=rc)
if (rc /= ESMF_SUCCESS) return
call ESMF_ArrayGet(array3Read, farrayPtr=array3ReadData, rc=rc)
if (rc /= ESMF_SUCCESS) return
arrayBundle = ESMF_ArrayBundleCreate(arrayList=[array1, array2], name="ab", rc=rc)
if (rc /= ESMF_SUCCESS) return
arrayBundleRead = ESMF_ArrayBundleCreate(arrayList=[array1Read, array2Read], name="abRead", rc=rc)
if (rc /= ESMF_SUCCESS) return
end subroutine createArrays