subroutine RedistOnlyFromPet0(arrayPet0, array, rh, buffer, rc)
type(ESMF_Array), intent(inout) :: arrayPet0
type(ESMF_Array), intent(inout) :: array
type(ESMF_RouteHandle), intent(inout) :: rh
real(ESMF_KIND_R8),pointer, optional:: buffer(:)
integer, intent(out), optional :: rc
real(ESMF_KIND_R8), pointer :: fptr1d(:)
integer :: localrc
if (present(rc)) rc=ESMF_SUCCESS
! Set the value at PET0 only
if (present(buffer)) then
call ESMF_ArrayGet(arrayPet0, localDe=0, farrayPtr=fptr1d, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return ! bail out
fptr1d = buffer
endif
call ESMF_ArrayRedist(arrayPet0, array, rh, rc=localrc)
if (ESMF_LogFoundError(rcToCheck=localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return ! bail out
return
end subroutine RedistOnlyFromPet0