f_esmf_locstreamgetkeyarray Subroutine

subroutine f_esmf_locstreamgetkeyarray(locstream, keyName, array, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_LocStream) :: locstream
character(len=*), intent(in) :: keyName
type(ESMF_Array) :: array
integer, intent(out) :: rc

Source Code

  subroutine f_esmf_locstreamgetkeyarray(locstream, keyName, array, rc)

    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_ArraySpecMod
    use ESMF_ArrayMod
    use ESMF_LocStreamMod

    implicit none

    type(ESMF_LocStream)         :: locstream
    character(len=*),intent(in)  :: keyName
    type(ESMF_Array)             :: array
    integer, intent(out)         :: rc

    ! local
    type(ESMF_Array)               :: l_array

  ! initialize return code; assume routine not implemented
    rc = ESMF_RC_NOT_IMPL

    call ESMF_LocStreamGetKey(locstream, keyName=keyName, keyArray=l_array, rc=rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! because ESMF_Array.this is private, it cannot be accessed directly
    ! we use the public interface to do the ptr copy;
    ! the array object returned to the C interface must consist only of the
    ! this pointer. It must not contain the isInit member.
    call ESMF_ArrayCopyThis(l_array, array, rc)
    if (ESMF_LogFoundError(rc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    rc = ESMF_SUCCESS

  end subroutine f_esmf_locstreamgetkeyarray