MAPL_GridCompSetEntryPoint Subroutine

public subroutine MAPL_GridCompSetEntryPoint(GC, registeredMethod, usersRoutine, RC)

Arguments

Type IntentOptional Attributes Name
type(ESMF_GridComp), intent(inout) :: GC
type(ESMF_Method_Flag), intent(in) :: registeredMethod
real :: usersRoutine
integer, intent(out), optional :: RC

Calls

proc~~mapl_gridcompsetentrypoint~~CallsGraph proc~mapl_gridcompsetentrypoint MAPL_GridCompSetEntryPoint ESMF_GridCompSetEntryPoint ESMF_GridCompSetEntryPoint proc~mapl_gridcompsetentrypoint->ESMF_GridCompSetEntryPoint none~push_back~6 entryPointVector%push_back proc~mapl_gridcompsetentrypoint->none~push_back~6 proc~mapl_internalstateretrieve MAPL_InternalStateRetrieve proc~mapl_gridcompsetentrypoint->proc~mapl_internalstateretrieve proc~mapl_return MAPL_Return proc~mapl_gridcompsetentrypoint->proc~mapl_return proc~mapl_verify MAPL_Verify proc~mapl_gridcompsetentrypoint->proc~mapl_verify none~capacity~31 entryPointVector%capacity none~push_back~6->none~capacity~31 none~resize~12 entryPointVector%resize none~push_back~6->none~resize~12 proc~mapl_internalstateretrieve->proc~mapl_return proc~mapl_internalstateretrieve->proc~mapl_verify ESMF_GridCompGet ESMF_GridCompGet proc~mapl_internalstateretrieve->ESMF_GridCompGet ESMF_UserCompGetInternalState ESMF_UserCompGetInternalState proc~mapl_internalstateretrieve->ESMF_UserCompGetInternalState proc~mapl_internalstatecreate MAPL_InternalStateCreate proc~mapl_internalstateretrieve->proc~mapl_internalstatecreate at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception none~resize_size_kind~2 entryPointVector%resize_size_kind none~resize~12->none~resize_size_kind~2 proc~mapl_internalstatecreate->proc~mapl_return proc~mapl_internalstatecreate->proc~mapl_verify proc~mapl_internalstatecreate->ESMF_GridCompGet ESMF_UserCompSetInternalState ESMF_UserCompSetInternalState proc~mapl_internalstatecreate->ESMF_UserCompSetInternalState none~get_component~2 ConcreteComposite%get_component proc~mapl_internalstatecreate->none~get_component~2 none~initialize~15 ConcreteComposite%initialize proc~mapl_internalstatecreate->none~initialize~15 none~set_composite~2 CompositeComponent%set_composite proc~mapl_internalstatecreate->none~set_composite~2 none~reserve~12 entryPointVector%reserve none~resize_size_kind~2->none~reserve~12

Called by

proc~~mapl_gridcompsetentrypoint~~CalledByGraph proc~mapl_gridcompsetentrypoint MAPL_GridCompSetEntryPoint proc~mapl_genericsetservices MAPL_GenericSetServices proc~mapl_genericsetservices->proc~mapl_gridcompsetentrypoint proc~setservices~2 SetServices proc~setservices~2->proc~mapl_gridcompsetentrypoint proc~setservices~2->proc~mapl_genericsetservices proc~setservices~4 SetServices proc~setservices~4->proc~mapl_gridcompsetentrypoint proc~setservices~4->proc~mapl_genericsetservices proc~setservices~5 SetServices proc~setservices~5->proc~mapl_gridcompsetentrypoint proc~setservices~5->proc~mapl_genericsetservices proc~setservices~6 SetServices proc~setservices~6->proc~mapl_gridcompsetentrypoint proc~setservices~6->proc~mapl_genericsetservices proc~setservices~7 SetServices proc~setservices~7->proc~mapl_gridcompsetentrypoint proc~setservices~7->proc~mapl_genericsetservices

Source Code

   subroutine MAPL_GridCompSetEntryPoint(GC, registeredMethod, usersRoutine, RC)

      !ARGUMENTS:
      type(ESMF_GridComp),                  intent(INOUT) :: GC         ! Gridded component
      type(ESMF_Method_Flag),               intent(IN   ) :: registeredMethod
      external                                            :: usersRoutine
      integer,                    optional, intent(  OUT) :: RC         ! Return code
      !EOPI

      integer                               :: status

      type (MAPL_MetaComp),     pointer     :: META
      integer                               :: phase
      type(runEntryPoint) :: run_entry_point

      call MAPL_InternalStateRetrieve( GC, META, RC=status)
      _VERIFY(status)

      if (registeredMethod == ESMF_METHOD_INITIALIZE) then
         phase = MAPL_AddMethod(META%phase_init, RC=status)
      else if (registeredMethod == ESMF_METHOD_RUN) then
         phase = MAPL_AddMethod(META%phase_run, RC=status)
         run_entry_point%run_entry_point => usersRoutine
         call META%run_entry_points%push_back(run_entry_point)
      else if (registeredMethod == ESMF_METHOD_FINALIZE) then
         phase = MAPL_AddMethod(META%phase_final, RC=status)
      else if (registeredMethod == ESMF_METHOD_WRITERESTART) then
         phase = MAPL_AddMethod(META%phase_record, RC=status)
      else if (registeredMethod == ESMF_METHOD_READRESTART) then
         phase = MAPL_AddMethod(META%phase_coldstart, RC=status)
      else
         _RETURN(ESMF_FAILURE)
      endif
      _VERIFY(status)

      if (phase > MAPL_MAX_PHASES) then
         print *, 'ERROR: exceeded maximum number of run phases. Increase MAPL_MAX_PHASES and recompile'
      end if

      call ESMF_GridCompSetEntryPoint(GC, registeredMethod, MAPL_GenericWrapper, &
           phase=phase, rc=status)
      _VERIFY(status)
      call ESMF_GridCompSetEntryPoint(GC, registeredMethod,  usersRoutine, &
           phase=MAPL_MAX_PHASES+phase, rc=status)
      _VERIFY(status)

      _RETURN(ESMF_SUCCESS)
   end subroutine MAPL_GridCompSetEntryPoint