tem_unit_close Subroutine

public subroutine tem_unit_close(me)

Check, if a unit is open, and close it

Arguments

Type IntentOptional Attributes Name
integer :: me

the restart type to close


Source Code

  subroutine tem_unit_close(me)
    ! -------------------------------------------------------------------- !
    !> the restart type to close
    integer :: me
    ! -------------------------------------------------------------------- !
    logical :: nUnitOpened
    ! -------------------------------------------------------------------- !
    ! Check, if any open units have to be closed
    if ( me >= 0 ) then
      ! unit has be to be >= 0
      inquire(unit=me, opened=nUnitOpened)
      if (nUnitOpened) then
        close( me )
      end if
    end if

  end subroutine tem_unit_close