subroutine ESMF_XGridGetFracIntMesh(Mesh, Array, meshloc, &
rc)
!
! !ARGUMENTS:
type(ESMF_Mesh), intent(inout) :: Mesh
type(ESMF_Array), intent(inout) :: Array
type(ESMF_MeshLoc), intent(in) :: meshloc
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
real(ESMF_KIND_R8), pointer :: frac(:)
logical :: isMemFreed
integer :: localDeCount, i
! 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 ESMF_ArrayGet(Array, localDECount=localDeCount, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
do i = 0, localDeCount-1
call ESMF_ArrayGet(Array, localDe=i, farrayPtr=frac, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Call through to the C++ object that does the work
call ESMF_MeshGetElemFrac(Mesh, frac, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
enddo
rc = ESMF_SUCCESS
end subroutine ESMF_XGridGetFracIntMesh