subroutine ESMF_RegridGetIwts(Grid, Mesh, Array, staggerLoc, &
rc)
!
! !ARGUMENTS:
type(ESMF_Grid), intent(inout) :: Grid
type(ESMF_Mesh), intent(inout) :: Mesh
type(ESMF_Array), intent(inout) :: Array
type(ESMF_StaggerLoc), intent(in) :: staggerLoc
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! The arguments are:
! \begin{description}
! \item[Mesh]
! The mesh.
! \item[Array]
! The grid array.
! \item[{rc}]
! Return code.
! \end{description}
!EOPI
integer :: localrc
logical :: isMemFreed
! Logic to determine if valid optional args are passed.
! Initialize return code; assume failure until success is certain
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Make sure the srcMesh has its internal bits in place
call ESMF_MeshGet(Mesh, isMemFreed=isMemFreed, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
if (isMemFreed) then
call ESMF_LogSetError(rcToCheck=ESMF_RC_OBJ_WRONG, &
msg="- Mesh has had its coordinate and connectivity info freed", &
ESMF_CONTEXT, rcToReturn=rc)
return
endif
! Call through to the C++ object that does the work
call c_ESMC_regrid_getiwts(Grid, Mesh, Array, staggerLoc, &
localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
rc = ESMF_SUCCESS
end subroutine ESMF_RegridGetIwts