release_io_id Subroutine

public subroutine release_io_id(io_id)

Function that releases the last assigned file unit.

Arguments

Type IntentOptional AttributesName
integer(kind=ip), intent(inout) :: io_id

The file unit to attempt to release. If this is not the last assigned file unit, the routine aborts the execution.


Called by

proc~~release_io_id~~CalledByGraph proc~release_io_id release_io_id proc~read_all_modes read_all_modes proc~read_all_modes->proc~release_io_id proc~output_coords output_coords proc~output_coords->proc~release_io_id interface~read_all_modes read_all_modes interface~read_all_modes->proc~read_all_modes interface~output_coords output_coords interface~output_coords->proc~output_coords

Contents

Source Code


Source Code

  subroutine release_io_id ( io_id )
  !! Function that releases the last assigned file unit.

    integer(ip), intent(inout) :: io_id
    !! The file unit to attempt to release. If this is not the last assigned
    !! file unit, the routine aborts the execution.

!$OMP CRITICAL
    if ( io_id == next_id-1 ) then
      next_id = next_id - 1
      close(io_id)
      print*,'io_id: ', io_id, ' has been released'
      io_id = -1
    else
      print*,'release_io_id called with invalid io_id'
      stop
    end if
!$OMP END CRITICAL
  end subroutine release_io_id