get_unit Subroutine

public subroutine get_unit(iunit)

Provide for a free unit, from here John Burkardt website

Arguments

Type IntentOptional Attributes Name
integer(kind=I4), intent(out) :: iunit

free unit to use


Called by

proc~~get_unit~2~~CalledByGraph proc~get_unit~2 get_unit proc~least_squares_tcheby least_squares_tcheby proc~least_squares_tcheby->proc~get_unit~2 proc~list_files list_files proc~list_files->proc~get_unit~2 proc~open_surffile open_surffile proc~open_surffile->proc~get_unit~2 proc~trans_surf_txt trans_surf_txt proc~open_surffile->proc~trans_surf_txt proc~read_surf read_surf proc~read_surf->proc~get_unit~2 proc~read_surf~2 read_surf proc~read_surf~2->proc~get_unit~2 proc~read_surf~2->proc~open_surffile proc~save_surf save_surf proc~save_surf->proc~get_unit~2 proc~trans_surf_txt->proc~get_unit~2 proc~write_surf write_surf proc~write_surf->proc~get_unit~2 proc~write_surffile write_surffile proc~write_surf->proc~write_surffile proc~write_surffile->proc~get_unit~2 program~main main program~main->proc~get_unit~2 program~test_algen test_algen program~test_algen->proc~get_unit~2 program~test_data_arch test_data_arch program~test_data_arch->proc~get_unit~2 program~test_fftw3 test_fftw3 program~test_fftw3->proc~get_unit~2 program~test_fftw3->proc~read_surf program~test_fftw3->proc~save_surf program~test_solvers test_solvers program~test_solvers->proc~get_unit~2 program~test_tchebychev test_tchebychev program~test_tchebychev->proc~get_unit~2 program~test_tchebychev->proc~least_squares_tcheby program~test_files test_files program~test_files->proc~list_files program~test_surfile test_surfile program~test_surfile->proc~read_surf~2 program~test_surfile->proc~trans_surf_txt program~test_surfile->proc~write_surf

Source Code

   subroutine get_unit(iunit)
   !! Provide for a free unit, from here [John Burkardt website](https://people.sc.fsu.edu/~jburkardt/f_src)
   implicit none
   integer(kind=I4), intent(out) :: iunit !! free unit to use

      integer(kind=I4) :: i
      integer(kind=I4) :: ios
      logical(kind=I4) :: lopen

      iunit = 0
      do i = 10, 99

         if (i /= OPU .and. i /= IPU .and. i /= ERU) then
            inquire (unit = i, opened = lopen, iostat = ios)
            if (ios == 0) then
               if ( .not. lopen ) then
                  iunit = i
                  return
               endif
            endif
         endif

      enddo

   return
   endsubroutine get_unit