subroutine test7d2(rc)
integer, intent(out) :: rc
real(ESMF_KIND_R8), dimension(:,:,:,:,:,:,:), pointer :: farray
type(ESMF_Field) :: f8
type(ESMF_Grid) :: grid
type(ESMF_DistGrid) :: distgrid
integer :: localrc
integer :: flb(7), fub(7)
localrc = ESMF_SUCCESS
rc = ESMF_SUCCESS
distgrid = ESMF_DistGridCreate(minIndex=(/1,1,1,1,1/), maxIndex=(/3,4,3,4,2/), &
regDecomp=(/2,1,2,1,1/), rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
grid = ESMF_GridCreate(distgrid=distgrid, name="grid", rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_GridGetFieldBounds(grid, localDe=0, ungriddedLBound=(/1,2/), &
ungriddedUBound=(/2,3/), &
totalLWidth=(/1,1,1,2,2/), totalUWidth=(/1,2,3,2,1/), &
totalLBound=flb, totalUBound=fub, &
rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
allocate(farray(flb(1):fub(1), flb(2):fub(2), flb(3):fub(3), &
flb(4):fub(4), flb(5):fub(5), flb(6):fub(6), flb(7):fub(7)) )
f8 = ESMF_FieldCreate(grid, farray, &
indexflag=ESMF_INDEX_DELOCAL, &
ungriddedLBound=(/1,2/), ungriddedUBound=(/2,3/), &
totalLWidth=(/1,1,1,2,2/), totalUWidth=(/1,2,3,2,1/), &
rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_FieldDestroy(f8, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_GridDestroy(grid, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_DistGridDestroy(distgrid, rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
deallocate(farray)
end subroutine test7d2