f_esmf_stategetarray Subroutine

subroutine f_esmf_stategetarray(state, arrayName, array, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_State) :: state
character(len=*) :: arrayName
type(ESMF_Array) :: array
integer, intent(out) :: rc

Source Code

   subroutine f_esmf_stategetarray(state, arrayName, array, rc)
#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_stategetarray"

       use ESMF_UtilTypesMod
       use ESMF_LogErrMod
       use ESMF_BaseMod    ! ESMF base class
       use ESMF_StateMod
       use ESMF_ArrayCreateMod
       implicit none

       type(ESMF_State) :: state        !in
       character(len=*) :: arrayName    !in
       type(ESMF_Array) :: array        !out
       integer, intent(out) :: rc       !out

       ! local variable
       type(ESMF_Array) :: farray

       integer :: localrc

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

       call ESMF_StateGet(state=state, itemName=arrayName, &
                               array=farray, rc=localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU,  &
           ESMF_CONTEXT, rcToReturn=rc)) return

       ! 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(farray, array, localrc)
       if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU,  &
           ESMF_CONTEXT, rcToReturn=rc)) return

       rc = localrc

   end subroutine f_esmf_stategetarray