ESMF_GeomDestroy Subroutine

public subroutine ESMF_GeomDestroy(geom, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Geom) :: geom
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_GeomDestroy(geom, rc)
!
! !ARGUMENTS:
      type(ESMF_Geom)            :: geom
      integer, intent(out), optional :: rc
!
! !DESCRIPTION:
!   Destroys an {\tt ESMF\_Geom} object. This call does not destroy wrapped
!   Grid, LocStream, or other objects.
!
!     The arguments are:
! \begin{description}
! \item[geom]
!   {\tt ESMF\_Geom} to be destroyed.
! \item[{[rc]}]
!    Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP

    ! Initialize return code; assume failure until success is certain
    integer                 :: localrc ! local error status

    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! Check init status of arguments
    ESMF_INIT_CHECK_DEEP(ESMF_GeomGetInit, geom, rc)

    ! deallocate Geom type
    deallocate(geom%gbcp, stat=localrc)
    if (ESMF_LogFoundDeallocError(localrc, &
      msg="Deallocating Geom type object", &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! Set init code
    ESMF_INIT_SET_DELETED(geom)

    ! Return successfully
    if (present(rc)) rc = ESMF_SUCCESS

 end subroutine ESMF_GeomDestroy