close_ephemeris Subroutine

private subroutine close_ephemeris(me)

Close the ephemeris.

Type Bound

jpl_ephemeris

Arguments

Type IntentOptional Attributes Name
class(jpl_ephemeris), intent(inout) :: me

Source Code

    subroutine close_ephemeris(me)

    implicit none

    class(jpl_ephemeris),intent(inout) :: me

    logical :: is_open
    integer :: istat

    if (me%initialized) then

        !close the file:
        inquire(unit=me%nrfile,opened=is_open,iostat=istat)
        if (is_open) close(unit=me%nrfile,iostat=istat)

        !initialize all class variables to defaults:
        call clear(me)

    end if

    contains

        subroutine clear(eph)
            !! clear all the variables in the [[jpl_ephemeris]] class.
            implicit none
            class(jpl_ephemeris),intent(out) :: eph
        end subroutine clear

    end subroutine close_ephemeris