usercpl_run Subroutine

private subroutine usercpl_run(comp, importState, exportState, clock, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_CplComp) :: comp
type(ESMF_State) :: importState
type(ESMF_State) :: exportState
type(ESMF_Clock) :: clock
integer, intent(out) :: rc

Source Code

  subroutine usercpl_run(comp, importState, exportState, clock, rc)
    type(ESMF_CplComp) :: comp
    type(ESMF_State) :: importState, exportState
    type(ESMF_Clock) :: clock
    integer, intent(out) :: rc

    type(ESMF_VM)               :: vm
    integer                     :: myPet

    integer, dimension(2)       :: rootList
    type(ESMF_InfoDescribe) :: eidesc
    character(:), allocatable :: idump

    rc = ESMF_SUCCESS

    call ESMF_CplCompGet(comp, vm=vm, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call ESMF_VMGet(vm, localPet=myPet, rc=rc)
    if (rc/=ESMF_SUCCESS) return

    call ESMF_StateGet(importState, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call ESMF_StateGet(exportState, rc=rc)
    if (rc/=ESMF_SUCCESS) return

    rootList = (/0,1/)
    call ESMF_AttributeUpdate(importState, vm, rootList=rootList, rc=rc)
    if (rc/=ESMF_SUCCESS) return

#if 0
    eidesc = eidesc%Create(addBaseAddress=.true., addObjectInfo=.true., rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call eidesc%Update(exportState, "", rc=rc)
    if (rc/=ESMF_SUCCESS) return
    idump = ESMF_InfoDump(eidesc%info, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call ESMF_LogWrite("usercpl_run: exportState dump before copy=...", ESMF_LOGMSG_INFO, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call ESMF_LogWrite(idump, ESMF_LOGMSG_INFO, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call eidesc%Destroy(rc=rc)
    if (rc/=ESMF_SUCCESS) return
#endif

    call ESMF_AttributeCopy(importState, exportState, rc=rc)
    !call ESMF_AttributeCopy(importState, exportState, &
    !  attcopy=ESMF_ATTCOPY_REFERENCE, rc=rc)
    if (rc/=ESMF_SUCCESS) return

#if 0
    eidesc = eidesc%Create(addBaseAddress=.true., addObjectInfo=.true., rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call eidesc%Update(exportState, "", rc=rc)
    if (rc/=ESMF_SUCCESS) return
    idump = ESMF_InfoDump(eidesc%info, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call ESMF_LogWrite("usercpl_run: exportState dump after copy=...", ESMF_LOGMSG_INFO, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call ESMF_LogWrite(idump, ESMF_LOGMSG_INFO, rc=rc)
    if (rc/=ESMF_SUCCESS) return
    call eidesc%Destroy(rc=rc)
    if (rc/=ESMF_SUCCESS) return
#endif

  end subroutine usercpl_run