ESMF_PointListDestroy Subroutine

public subroutine ESMF_PointListDestroy(pointlist, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_PointList), intent(inout) :: pointlist
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_PointListDestroy(pointlist, rc)
!
! !ARGUMENTS:
    type(ESMF_PointList), intent(inout) :: pointlist
    integer, intent(out), optional :: rc
!
! !DESCRIPTION:
!   Destroys an {\tt ESMF\_PointList}, releaseing the resources associated
!   with the object.
!
!   The arguments are:
!   \begin{description}
!   \item[pointlist]
!     The {\tt ESMF\_PointList} to be destroyed.
!   \item[{[rc]}]
!     Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!   \end{description}
!
!EOPI
!------------------------------------------------------------------------------
    integer                 :: localrc      ! local return code

    ! initialize return code; assume routine not implemented
    localrc = ESMF_RC_NOT_IMPL
    if (present(rc)) rc = ESMF_RC_NOT_IMPL

    ! check input variable
    ESMF_INIT_CHECK_DEEP(ESMF_PointListGetInit,pointlist,rc)

    ! was pointlist already destroyed?
    if (pointlist%this .eq. ESMF_NULL_POINTER) then
      if (present(rc)) rc = ESMF_SUCCESS
      return
    endif

    ! Call C++ destroy code

    call c_ESMC_PointListDestroy(pointlist, localrc)
    if (ESMF_LogFoundError(localrc, &
      ESMF_ERR_PASSTHRU, &
      ESMF_CONTEXT, rcToReturn=rc)) return

    ! nullify pointer
    pointlist%this = ESMF_NULL_POINTER
    ESMF_INIT_SET_DELETED(pointlist)

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

  end subroutine ESMF_PointListDestroy