recursive subroutine ESMF_CplCompSetServicesComp(cplcomp, &
actualCplcomp, keywordEnforcer, rc)
!
! !ARGUMENTS:
type(ESMF_CplComp), intent(inout) :: cplcomp
type(ESMF_CplComp), intent(in) :: actualCplcomp
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Set the services of a Coupler Component to serve a "dual" Component for an
! "actual" Component. The component tunnel is VM based.
!
! The arguments are:
! \begin{description}
! \item[cplcomp]
! Dual Coupler Component.
! \item[actualCplcomp]
! Actual Coupler Component.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
integer :: localrc ! local error status
integer, pointer :: actualCompPetList(:)
integer :: actualCompRootPet, i
! initialize return code; assume routine not implemented
if (present(rc)) rc = ESMF_RC_NOT_IMPL
localrc = ESMF_RC_NOT_IMPL
ESMF_INIT_CHECK_DEEP(ESMF_CplCompGetInit, cplcomp, rc)
ESMF_INIT_CHECK_DEEP(ESMF_CplCompGetInit, actualCplcomp, rc)
! access the petList of the actualCplcomp and find the lowest PET
! -> this is going to be the rendezvous PET for the component tunnel setup
nullify(actualCompPetList)
! call Comp method
call ESMF_CompGet(actualCplcomp%compp, petList=actualCompPetList, &
rc=localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
actualCompRootPet = actualCompPetList(1) ! prime the search variable
do i=2, size(actualCompPetList)
if (actualCompPetList(i) < actualCompRootPet) &
actualCompRootPet = actualCompPetList(i)
enddo
deallocate(actualCompPetList)
call c_ESMC_SetServicesComp(cplcomp, cplcomp%compp%compTunnel, &
actualCplcomp, actualCompRootPet, localrc)
if (ESMF_LogFoundError(localrc, &
ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! now indicate that this Component has a VM associated
cplcomp%compp%compStatus%vmIsPresent = .true.
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_CplCompSetServicesComp