recursive subroutine ESMF_CplCompSetEntryPoint(cplcomp, methodflag, &
userRoutine, keywordEnforcer, phase, rc)
! !ARGUMENTS:
type(ESMF_CplComp), intent(inout) :: cplcomp
type(ESMF_Method_Flag), intent(in) :: methodflag
interface
subroutine userRoutine(cplcomp, importState, exportState, clock, rc)
use ESMF_CompMod
use ESMF_StateMod
use ESMF_ClockMod
implicit none
type(ESMF_CplComp) :: cplcomp ! must not be optional
type(ESMF_State) :: importState ! must not be optional
type(ESMF_State) :: exportState ! must not be optional
type(ESMF_Clock) :: clock ! must not be optional
integer, intent(out) :: rc ! must not be optional
end subroutine
end interface
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer, intent(in), optional :: phase
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
! Registers a user-supplied {\tt userRoutine} as the entry point for one of the
! predefined Component {\tt methodflag}s. After this call the {\tt userRoutine}
! becomes accessible via the standard Component method API.
!
! The arguments are:
! \begin{description}
! \item[cplcomp]
! An {\tt ESMF\_CplComp} object.
! \item[methodflag]
! \begin{sloppypar}
! One of a set of predefined Component methods - e.g.
! {\tt ESMF\_METHOD\_INITIALIZE}, {\tt ESMF\_METHOD\_RUN},
! {\tt ESMF\_METHOD\_FINALIZE}. See section \ref{const:method}
! for a complete list of valid method options.
! \end{sloppypar}
! \item[userRoutine]
! The user-supplied subroutine to be associated for this {\tt methodflag}.
! The Component writer must supply a subroutine with the exact interface
! shown above for the {\tt userRoutine} argument. Arguments in {\tt userRoutine}
! must not be declared as optional, and the types, intent and order must match.
! Prior to Fortran-2008, the subroutine must be either a module scope procedure,
! or an external procedure that has a matching interface block specified for it.
! An internal procedure which is contained within another procedure must not be used.
! From Fortran-2008 onwards, an internal procedure contained within either a main program
! or a module procedure may be used. If the internal procedure is contained within a
! module procedure, it is subject to initialization requirements. See: \ref{sec:AppDriverIntProc}
! \item[{[phase]}]
! The {\tt phase} number for multi-phase methods. For single phase
! methods the {\tt phase} argument can be omitted. The default setting
! is 1.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
integer :: localrc ! local error status
integer :: phaseArg
! 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)
phaseArg = 1 ! default
if (present(phase)) phaseArg = phase
call c_ESMC_SetEntryPoint(cplcomp, methodflag, userRoutine, phaseArg, &
localrc)
!TODO: back in once thread-safe if (ESMF_LogFoundError(localrc, &
!TODO: back in once thread-safe ESMF_ERR_PASSTHRU, &
!TODO: back in once thread-safe ESMF_CONTEXT, rcToReturn=rc)) return
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_CplCompSetEntryPoint