ESMF_GetVM Subroutine

public subroutine ESMF_GetVM(base, vm, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Base), intent(in) :: base
type(ESMF_VM), intent(out) :: vm
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_GetVM(base, vm, rc)
!
! !ARGUMENTS:
      type(ESMF_Base), intent(in)             :: base
      type(ESMF_VM),   intent(out)            :: vm
      integer,         intent(out), optional  :: rc

!
! !DESCRIPTION:
!     Return the vm of any type in the system.
!
!     The arguments are:
!     \begin{description}
!     \item[base]
!       Any ESMF type.
!     \item[vm]
!       The vm on which the Base object was created.
!     \item[{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!EOPI
      integer :: localrc

      ! Initialize return code; assume routine not implemented
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL

      ! access the VM from the C++ side
      call c_ESMC_GetVM(base , vm, localrc)
      if (present(rc)) rc = localrc
      
      ! Set init code
      call ESMF_VMSetInitCreated(vm, rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      ! return successfully
      if (present(rc)) rc = ESMF_SUCCESS

  end subroutine ESMF_GetVM