ESMF_DELayoutVASMatch Subroutine

private subroutine ESMF_DELayoutVASMatch(delayout, de, vmMatch, petMatchCount, petMatchList, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_DELayout), intent(in) :: delayout
integer, intent(in) :: de
type(ESMF_VM), intent(in) :: vmMatch
integer, intent(out), optional :: petMatchCount
integer, intent(out), optional, target :: petMatchList(:)
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_DELayoutVASMatch(delayout, de, vmMatch, &
    petMatchCount, petMatchList, rc)
!
! !ARGUMENTS:
    type(ESMF_DELayout),  intent(in)            :: delayout
    integer,              intent(in)            :: de
    type(ESMF_VM),        intent(in)            :: vmMatch
    integer,              intent(out), optional :: petMatchCount
    integer, target,      intent(out), optional :: petMatchList(:)
    integer,              intent(out), optional :: rc  
!
! !DESCRIPTION:
!     Match the virtual address space of the specified DE in the DELayout with 
!     that of the PETs of a VM object. The use of this method is crutial when
!     dealing with decomposed data structures that were not defined in the
!     current VM context, i.e. defined in another component.
!
!     The arguments are:
!     \begin{description}
!     \item[delayout] 
!        {\tt ESMF\_DELayout} object in which the specified DE is defined.
!     \item[de]
!        DE for which to find matching PETs.
!     \item[vmMatch] 
!        VM object in which to find PETs that match the virtual address
!        space of the specified DE.
!     \item[{[petMatchCount]}]
!        Upon return this holds the number of PETs in vmMatch that share
!        virtual address space with the specified DE.
!     \item[{[petMatchList]}]
!        Upon return this holds the list of PETs in vmMatch that share
!        virtual address space with the specified DE.
!     \item[{[rc]}] 
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!EOPI
!------------------------------------------------------------------------------
    integer                 :: localrc      ! local return code
    integer                 :: len_petMatchList
    integer, target         :: dummy(1)     ! used to satisfy the C interface...
    integer, pointer        :: opt_petMatchList(:)

    ! 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(ESMF_DELayoutGetInit, delayout, rc)
    ESMF_INIT_CHECK_DEEP(ESMF_VMGetInit, vmMatch, rc)
    
    ! Deal with optional array arguments
    if (present(petMatchList)) then
      len_petMatchList = size(petMatchList)
      opt_petMatchList => petMatchList
    else
      len_petMatchList = 0
      opt_petMatchList => dummy
    endif

    ! Call into the C++ interface.
    call c_ESMC_DELayoutGetDEMatchPET(delayout, de, vmMatch, &
      petMatchCount, opt_petMatchList(1), len_petMatchList, localrc)
    if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! return successfully
    if (present(rc)) rc = ESMF_SUCCESS
    
  end subroutine ESMF_DELayoutVASMatch