subroutine ESMF_ArrayBundleGetItem(arraybundle, arrayName, &
keywordEnforcer, array, arrayCount, isPresent, rc)
!
! !ARGUMENTS:
type(ESMF_ArrayBundle), intent(in) :: arraybundle
character(len=*), intent(in) :: arrayName
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
type(ESMF_Array), intent(out), optional :: array
integer, intent(out), optional :: arrayCount
logical, intent(out), optional :: isPresent
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
! Get information about items that match {\tt arrayName} in ArrayBundle.
!
! \begin{description}
! \item [arraybundle]
! {\tt ESMF\_ArrayBundle} to be queried.
! \item [arrayName]
! Specified name.
! \item [{[array]}]
! Upon return holds the requested Array item. It is an error if this
! argument was specified and there is not exactly one Array item in
! {\tt arraybundle} that matches {\tt arrayName}.
! \item [{[arrayCount]}]
! Number of Arrays with {\tt arrayName} in {\tt arraybundle}.
! \item [{[isPresent]}]
! Upon return indicates whether Array(s) with {\tt arrayName} exist
! in {\tt arraybundle}.
! \item [{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_Logical) :: dummyIsPresent
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check init status of arguments
ESMF_INIT_CHECK_DEEP_SHORT(ESMF_ArrayBundleGetInit, arraybundle, rc)
if (present(array)) then
! Call into the C++ interface
call c_ESMC_ArrayBundleGetItem(arraybundle, trim(arrayName), array, &
localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Set init code for deep C++ object
call ESMF_ArraySetInitCreated(array, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
endif
if (present(arrayCount)) then
! Call into the C++ interface
call c_ESMC_ArrayBundleGetCount(arraybundle, trim(arrayName), &
arrayCount, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
endif
if (present(isPresent)) then
! Call into the C++ interface
call c_ESMC_ArrayBundleGetIsPresent(arraybundle, trim(arrayName), &
dummyIsPresent, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
isPresent = dummyIsPresent
endif
! Return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_ArrayBundleGetItem