subroutine ESMF_LocStreamGetKeyR4(locstream, keyName, keywordEnforcer, &
localDE, exclusiveLBound, exclusiveUBound, exclusiveCount, &
computationalLBound, computationalUBound, computationalCount, &
totalLBound, totalUBound, totalCount, &
farray, datacopyflag, rc)
!
! !ARGUMENTS:
type(ESMF_LocStream), intent(in) :: locstream
character (len=*), intent(in) :: keyName
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(in), optional :: localDE
integer, intent(out), optional :: exclusiveLBound
integer, intent(out), optional :: exclusiveUBound
integer, intent(out), optional :: exclusiveCount
integer, intent(out), optional :: computationalLBound
integer, intent(out), optional :: computationalUBound
integer, intent(out), optional :: computationalCount
integer, intent(out), optional :: totalLBound
integer, intent(out), optional :: totalUBound
integer, intent(out), optional :: totalCount
real(ESMF_KIND_R4), pointer :: farray(:)
type(ESMF_DataCopy_Flag), intent(in), optional :: datacopyflag
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! This method gets a Fortran pointer to the piece of memory which holds the
! key data for a particular key on the given local DE.
! This is useful, for example, for setting the key values in a LocStream, or
! for reading the values.
!
! The arguments are:
! \begin{description}
! \item[{locstream}]
! LocStream to get the information from.
! \item[{keyName}]
! The key to get the information from.
! \item[{[localDE]}]
! The local DE for which information is requested. {\tt [0,..,localDECount-1]}.
! For {\tt localDECount==1} the {\tt localDE} argument may be omitted,
! in which case it will default to {\tt localDE=0}.
! \item[{[exclusiveLBound]}]
! Upon return this holds the lower bounds of the exclusive region.
! \item[{[exclusiveUBound]}]
! Upon return this holds the upper bounds of the exclusive region.
! \item[{[exclusiveCount]}]
! Upon return this holds the number of items in the exclusive region
! (i.e. {\tt exclusiveUBound-exclusiveLBound+1}). {\tt exclusiveCount}.
! \item[{[computationalLBound]}]
! Upon return this holds the lower bounds of the computational region.
! \item[{[computationalUBound]}]
! Upon return this holds the upper bounds of the computational region.
! \item[{[computationalCount]}]
! Upon return this holds the number of items in the computational region
! (i.e. {\tt computationalUBound-computationalLBound+1}).
! \item[{[totalLBound]}]
! Upon return this holds the lower bounds of the total region.
! \item[{[totalUBound]}]
! Upon return this holds the upper bounds of the total region.
! \item[{[totalCount]}]
! Upon return this holds the number of items in the total region
! (i.e. {\tt totalUBound-totalLBound+1}).
! \item[{farray}]
! The pointer to the coordinate data.
! \item[{[datacopyflag]}]
! If not specified, default to {\tt ESMF\_DATACOPY\_REFERENCE}, in this case
! farray is a reference to the data in the Grid coordinate arrays.
! Please see Section~\ref{const:datacopyflag} for further description and a
! list of valid values.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOPI
! Local variables
type(ESMF_Array) :: array
integer :: localrc ! local error status
type(ESMF_LocalArray) :: larray
type(ESMF_DataCopy_Flag) :: datacopyflagInt
! Initialize return code
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! Check init status of arguments
ESMF_INIT_CHECK_DEEP(ESMF_LocStreamGetInit, locstream, rc)
! Set Defaults
if (present(datacopyflag)) then
datacopyflagInt=datacopyflag
else
datacopyflagInt=ESMF_DATACOPY_REFERENCE
endif
! Get Key Array
call ESMF_LocStreamGetKeyArray(locstream, keyName=keyName, keyArray=array, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Obtain the native array pointer via the LocalArray interface
call ESMF_ArrayGet(array, localDE=localDE, localarray=larray, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
call ESMF_LocalArrayGet(larray, farray, datacopyflag=datacopyflag, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
!TODO: Add computational Bounds Calc
! Get Bounds via C++
call c_ESMC_locstreamgetkeybnds(array, localDE, &
exclusiveLBound, exclusiveUBound, exclusiveCount, &
computationalLBound, computationalUBound, computationalCount, &
totalLBound, totalUBound, totalCount, &
localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! Return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_LocStreamGetKeyR4