Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(MAPL_VarSpec), | pointer | :: | SPEC(:) | |||
type(MAPL_VarSpec), | intent(inout) | :: | ITEM | |||
integer, | intent(out), | optional | :: | RC |
subroutine MAPL_VarSpecReconnect(SPEC,ITEM,RC) type (MAPL_VarSpec ), pointer :: SPEC(:) type (MAPL_VarSpec ), intent(INOUT) :: ITEM integer, optional , intent(OUT) :: RC integer :: STATUS type(ESMF_Field), pointer :: FIELD type(ESMF_FieldBundle), pointer :: BUNDLE type(ESMF_State), pointer :: STATE integer I if(.not.associated(ITEM%SPECPtr)) then _RETURN(ESMF_FAILURE) endif if(.not.associated(SPEC)) then _RETURN(ESMF_FAILURE) endif I=MAPL_VarSpecGetIndex(SPEC, ITEM, RC=STATUS) _VERIFY(STATUS) if (I == -1) then _RETURN(ESMF_FAILURE) endif if (associated(ITEM%SPECptr%FIELD)) then deallocate(ITEM%SPECptr%FIELD, STAT=STATUS) _VERIFY(STATUS) end if call MAPL_VarSpecGet(SPEC(I), FIELDPTR=FIELD, RC=STATUS) _VERIFY(STATUS) call MAPL_VarSpecSet(ITEM, FIELDPTR=FIELD, RC=STATUS) _VERIFY(STATUS) if (associated(ITEM%SPECptr%BUNDLE)) then deallocate(ITEM%SPECptr%BUNDLE, STAT=STATUS) _VERIFY(STATUS) end if call MAPL_VarSpecGet(SPEC(I), BUNDLEPTR=BUNDLE, RC=STATUS) _VERIFY(STATUS) call MAPL_VarSpecSet(ITEM, BUNDLEPTR=BUNDLE, RC=STATUS) _VERIFY(STATUS) if (associated(ITEM%SPECptr%STATE)) then deallocate(ITEM%SPECptr%STATE, STAT=STATUS) _VERIFY(STATUS) end if call MAPL_VarSpecGet(SPEC(I), STATEPTR=STATE, RC=STATUS) _VERIFY(STATUS) call MAPL_VarSpecSet(ITEM, STATEPTR=STATE, RC=STATUS) _VERIFY(STATUS) ! deallocate(ITEM%SPECptr, stat=status) ! _VERIFY(STATUS) ! ITEM%SPECptr => SPEC(I)%SPECPtr _RETURN(ESMF_SUCCESS) end subroutine MAPL_VarSpecReconnect