GetUnit Function

private function GetUnit() result(Free_Unit)

The GetUnit function is used for getting a free logic unit. The users of \LIBVTKIO does not know which is the logical unit: \LIBVTKIO handels this information without boring the users. The logical unit used is safe-free: if the program calling \LIBVTKIO has others logical units used \LIBVTKIO will never use these units, but will choice one that is free.

GetUnit function is private and cannot be called outside \LIBVTKIO. If you are interested to use it change its scope to public.

Arguments

None

Return Value integer(kind=I4P)


Called by

proc~~getunit~~CalledByGraph proc~getunit GetUnit proc~vtk_ini_xml VTK_INI_XML proc~vtk_ini_xml->proc~getunit proc~vtk_ini VTK_INI proc~vtk_ini->proc~getunit proc~vtm_ini_xml VTM_INI_XML proc~vtm_ini_xml->proc~getunit proc~save_fe_f_vtk save_fe_f_vtk proc~save_fe_f_vtk->proc~vtk_ini

Contents

Source Code


Source Code

  function GetUnit() result(Free_Unit)
  !---------------------------------------------------------------------------------------------------------------------------------
  !!The GetUnit function is used for getting a free logic unit. The users of \LIBVTKIO does not know which is
  !!the logical unit: \LIBVTKIO handels this information without boring the users. The logical unit used is safe-free: if the
  !!program calling \LIBVTKIO has others logical units used \LIBVTKIO will never use these units, but will choice one that is free.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  implicit none
  integer(I4P):: Free_Unit ! free logic unit
  integer(I4P):: n1        ! counter
  integer(I4P):: ios       ! inquiring flag
  logical(4)::   lopen     ! inquiring flag
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  !!The following is the code snippet of GetUnit function: the units 0, 5, 6, 9 and all non-free units are discarded.
  !!
  !(\doc)codesnippet
  Free_Unit = -1_I4P                                      ! initializing free logic unit
  n1=1_I4P                                                ! initializing counter
  do
    if ((n1/=5_I4P).AND.(n1/=6_I4P).AND.(n1/=9_I4P)) then
      inquire (unit=n1,opened=lopen,iostat=ios)           ! verify logic units
      if (ios==0_I4P) then
        if (.NOT.lopen) then
          Free_Unit = n1                                  ! assignment of free logic
          return
        endif
      endif
    endif
    n1=n1+1_I4P                                           ! updating counter
  enddo
  return
  !(doc/)codesnippet
  !!GetUnit function is private and cannot be called outside \LIBVTKIO. If you are interested to use it change its scope to public.
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction GetUnit