f_esmf_statecollectgarbage Subroutine

subroutine f_esmf_statecollectgarbage(state, rc)

Uses

  • proc~~f_esmf_statecollectgarbage~~UsesGraph proc~f_esmf_statecollectgarbage f_esmf_statecollectgarbage module~esmf_basemod ESMF_BaseMod proc~f_esmf_statecollectgarbage->module~esmf_basemod module~esmf_logerrmod ESMF_LogErrMod proc~f_esmf_statecollectgarbage->module~esmf_logerrmod module~esmf_statemod ESMF_StateMod proc~f_esmf_statecollectgarbage->module~esmf_statemod module~esmf_statetypesmod ESMF_StateTypesMod proc~f_esmf_statecollectgarbage->module~esmf_statetypesmod module~esmf_utiltypesmod ESMF_UtilTypesMod proc~f_esmf_statecollectgarbage->module~esmf_utiltypesmod module~esmf_basemod->module~esmf_logerrmod module~esmf_basemod->module~esmf_utiltypesmod iso_c_binding iso_c_binding module~esmf_basemod->iso_c_binding module~esmf_initmacrosmod ESMF_InitMacrosMod module~esmf_basemod->module~esmf_initmacrosmod module~esmf_ioutilmod ESMF_IOUtilMod module~esmf_basemod->module~esmf_ioutilmod module~esmf_vmmod ESMF_VMMod module~esmf_basemod->module~esmf_vmmod module~esmf_logerrmod->module~esmf_utiltypesmod module~esmf_logerrmod->module~esmf_ioutilmod module~esmf_utilstringmod ESMF_UtilStringMod module~esmf_logerrmod->module~esmf_utilstringmod ESMF_StateAPIMod ESMF_StateAPIMod module~esmf_statemod->ESMF_StateAPIMod ESMF_StateRemRepMod ESMF_StateRemRepMod module~esmf_statemod->ESMF_StateRemRepMod module~esmf_statetypesmod->module~esmf_basemod module~esmf_statetypesmod->module~esmf_logerrmod module~esmf_statetypesmod->module~esmf_utiltypesmod ESMF_FieldBundleMod ESMF_FieldBundleMod module~esmf_statetypesmod->ESMF_FieldBundleMod module~esmf_arraybundlemod ESMF_ArrayBundleMod module~esmf_statetypesmod->module~esmf_arraybundlemod module~esmf_arraymod ESMF_ArrayMod module~esmf_statetypesmod->module~esmf_arraymod module~esmf_fieldmod ESMF_FieldMod module~esmf_statetypesmod->module~esmf_fieldmod module~esmf_statetypesmod->module~esmf_initmacrosmod module~esmf_rhandlemod ESMF_RHandleMod module~esmf_statetypesmod->module~esmf_rhandlemod module~esmf_statecontainermod ESMF_StateContainerMod module~esmf_statetypesmod->module~esmf_statecontainermod module~esmf_stateitemmod ESMF_StateItemMod module~esmf_statetypesmod->module~esmf_stateitemmod module~esmf_statetypesmod->module~esmf_vmmod module~esmf_utiltypesmod->iso_c_binding

Arguments

Type IntentOptional Attributes Name
type(ESMF_State) :: state
integer, intent(out) :: rc

Calls

proc~~f_esmf_statecollectgarbage~~CallsGraph proc~f_esmf_statecollectgarbage f_esmf_statecollectgarbage esmf_statedestruct esmf_statedestruct proc~f_esmf_statecollectgarbage->esmf_statedestruct proc~esmf_logfounddeallocerror ESMF_LogFoundDeallocError proc~f_esmf_statecollectgarbage->proc~esmf_logfounddeallocerror proc~esmf_logfounderror ESMF_LogFoundError proc~f_esmf_statecollectgarbage->proc~esmf_logfounderror esmf_breakpoint esmf_breakpoint proc~esmf_logfounddeallocerror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounddeallocerror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounddeallocerror->proc~esmf_logwrite proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logfounderror->proc~esmf_logwrite c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Source Code

  subroutine f_esmf_statecollectgarbage(state, rc)
#undef  ESMF_METHOD
#define ESMF_METHOD "f_esmf_statecollectgarbage"
    use ESMF_UtilTypesMod
    use ESMF_BaseMod
    use ESMF_LogErrMod
    use ESMF_StateTypesMod
    use ESMF_StateMod
    
    implicit none
    
    type(ESMF_State)     :: state
    integer, intent(out) :: rc
  
    integer :: localrc
  
    ! initialize return code; assume routine not implemented
    localrc = ESMF_RC_NOT_IMPL
    rc = ESMF_RC_NOT_IMPL
  
    !print *, "collecting State garbage"

    if (associated(state%statep)) then
      ! destruct internal data allocations
      call ESMF_StateDestruct(state%statep, rc=localrc)
      if (ESMF_LogFoundError(localrc, &
        ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, &
        rcToReturn=rc)) return
      ! deallocate actual StateClass allocation
      deallocate(state%statep, stat=localrc)
      localrc = merge (ESMF_SUCCESS, ESMF_RC_MEM_DEALLOCATE, localrc == 0)
      if (ESMF_LogFoundDeallocError(localrc, msg="Deallocating State", &
        ESMF_CONTEXT, &
        rcToReturn=rc)) return
    endif
    nullify(state%statep)

    ! return successfully
    rc = ESMF_SUCCESS

  end subroutine f_esmf_statecollectgarbage