SetServices Subroutine

public subroutine SetServices(GC, RC)

SetServices — Sets IRF services for the MAPL_ExtData

Sets Initialize, Run and Finalize services.

History

  • 12Dec2009 da Silva Design and first implementation.

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout) :: GC

gridded component

integer, optional :: RC

return code


Calls

proc~~setservices~4~~CallsGraph proc~setservices~4 SetServices ESMF_GridCompGet ESMF_GridCompGet proc~setservices~4->ESMF_GridCompGet ESMF_UserCompSetInternalState ESMF_UserCompSetInternalState proc~setservices~4->ESMF_UserCompSetInternalState proc~mapl_genericsetservices MAPL_GenericSetServices proc~setservices~4->proc~mapl_genericsetservices proc~mapl_gridcompsetentrypoint MAPL_GridCompSetEntryPoint proc~setservices~4->proc~mapl_gridcompsetentrypoint proc~mapl_return MAPL_Return proc~setservices~4->proc~mapl_return proc~mapl_verify MAPL_Verify proc~setservices~4->proc~mapl_verify

Source Code

   SUBROUTINE SetServices ( GC, RC )

    type(ESMF_GridComp), intent(INOUT) :: GC  !! gridded component
    integer, optional                  :: RC  !! return code
!
!-------------------------------------------------------------------------

!   Local derived type aliases
!   --------------------------
    type (MAPL_ExtData_State), pointer  :: self   ! internal, that is
    type (MAPL_ExtData_wrap)            :: wrap

    character(len=ESMF_MAXSTR)          :: comp_name
    character(len=ESMF_MAXSTR)          :: Iam
    integer                             :: status

!                              ------------

!   Get my name and set-up traceback handle
!   ---------------------------------------
    Iam = 'SetServices'
    call ESMF_GridCompGet( GC, name=comp_name, _RC )
    Iam = trim(comp_name) // '::' // trim(Iam)

!   Wrap internal state for storing in GC; rename legacyState
!   -------------------------------------
    allocate ( self, stat=STATUS )
    _VERIFY(STATUS)
    wrap%ptr => self

!                       ------------------------
!                       ESMF Functional Services
!                       ------------------------

!   Set the Initialize, Run, Finalize entry points
!   ----------------------------------------------
    call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_INITIALIZE,  Initialize_, _RC )
    call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_RUN,   Run_,        _RC )
    call MAPL_GridCompSetEntryPoint ( GC, ESMF_METHOD_FINALIZE, Finalize_,   _RC )

!   Store internal state in GC
!   --------------------------
    call ESMF_UserCompSetInternalState ( GC, 'MAPL_ExtData_state', wrap, STATUS )
    _VERIFY(STATUS)


!   Generic Set Services
!   --------------------
    call MAPL_GenericSetServices ( GC, _RC )

!   All done
!   --------

    _RETURN(ESMF_SUCCESS)

  END SUBROUTINE SetServices