get_callbacks Subroutine

public subroutine get_callbacks(state, callbacks, rc)

Uses

  • proc~~get_callbacks~~UsesGraph proc~get_callbacks get_callbacks module~mapl_callbackmap mapl_CallbackMap proc~get_callbacks->module~mapl_callbackmap module~mapl_esmf_interfaces mapl_ESMF_Interfaces proc~get_callbacks->module~mapl_esmf_interfaces module~mapl_callbackmap->module~mapl_esmf_interfaces

Arguments

Type IntentOptional Attributes Name
type(ESMF_State), intent(inout) :: state
type(CallbackMap), intent(out), pointer :: callbacks
integer, intent(out), optional :: rc

Calls

proc~~get_callbacks~~CallsGraph proc~get_callbacks get_callbacks ESMF_InfoGet ESMF_InfoGet proc~get_callbacks->ESMF_InfoGet ESMF_InfoGetFromHost ESMF_InfoGetFromHost proc~get_callbacks->ESMF_InfoGetFromHost ESMF_InfoIsPresent ESMF_InfoIsPresent proc~get_callbacks->ESMF_InfoIsPresent ESMF_InfoSet ESMF_InfoSet proc~get_callbacks->ESMF_InfoSet proc~mapl_return MAPL_Return proc~get_callbacks->proc~mapl_return proc~mapl_verify MAPL_Verify proc~get_callbacks->proc~mapl_verify 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

Called by

proc~~get_callbacks~~CalledByGraph proc~get_callbacks get_callbacks proc~mapl_methodadd MAPL_MethodAdd proc~mapl_methodadd->proc~get_callbacks

Source Code

    subroutine get_callbacks(state, callbacks, rc)
       use mapl_ESMF_Interfaces
       use mapl_CallbackMap
       type(ESMF_State), intent(inout) :: state
       type(CallbackMap), pointer, intent(out) :: callbacks
       integer, optional, intent(out) :: rc

       integer :: status
       integer(kind=ESMF_KIND_I4), allocatable :: valueList(:)
       logical :: isPresent
       type(ESMF_Info) :: infoh

       type CallbackMapWrapper
          type(CallbackMap), pointer :: map
       end type
       type(CallbackMapWrapper) :: wrapper

       call ESMF_InfoGetFromHost(state, infoh, _RC)
       isPresent = ESMF_InfoIsPresent(infoh,'MAPL_CALLBACK_MAP',_RC)
       if (.not. isPresent) then ! create callback map for this state
          allocate(callbacks)
          wrapper%map => callbacks
          valueList = transfer(wrapper, valueList)
          call ESMF_InfoSet(infoh, key='MAPL_CALLBACK_MAP', values=valueList, _RC)
       end if

       ! Ugly hack to decode ESMF attribute as a gFTL map
       valueList = transfer(wrapper, valueList)
       call ESMF_InfoGet(infoh, key='MAPL_CALLBACK_MAP', values=valueList, _RC)
       wrapper = transfer(valueList, wrapper)
       callbacks => wrapper%map

       _RETURN(ESMF_SUCCESS)

    end subroutine get_callbacks