74 lines
1.8 KiB
Fortran
74 lines
1.8 KiB
Fortran
! This modules contains the definitions of the unit numbers used for
|
|
! all the GRAY output ifles and a mechanism to toggle them
|
|
module units
|
|
|
|
! Unit numbers
|
|
#ifdef JINTRAC
|
|
! JINTRAC
|
|
integer, parameter :: uprm =602, ubeam =603, uprf =644, ueq =644
|
|
integer, parameter :: uprfin =645, uflx =646, ubres =630, ucnt =631
|
|
integer, parameter :: uprj0 =608, uwbm =612, ucenr =604, uoutr =633
|
|
integer, parameter :: udisp =617, upec =648, usumm =607, umaps =632
|
|
integer, parameter :: uhead =638
|
|
#else
|
|
! STANDARD
|
|
integer, parameter :: uprm = 2, ubeam = 97, uprf = 98, ueq = 99
|
|
integer, parameter :: uprfin = 55, uflx = 56, ubres = 70, ucnt = 71
|
|
integer, parameter :: uprj0 = 8, uwbm = 12, ucenr = 4, uoutr = 33
|
|
integer, parameter :: udisp = 17, upec = 48, usumm = 7, umaps = 72
|
|
integer, parameter :: uhead = 78
|
|
#endif
|
|
|
|
! List of active units
|
|
integer, allocatable, save :: active_units(:)
|
|
|
|
contains
|
|
|
|
subroutine set_active_units(units)
|
|
! Activate the given units
|
|
!
|
|
! All units are inactive by default and no output
|
|
! will be directed to them.
|
|
|
|
implicit none
|
|
|
|
! subroutine arguments
|
|
integer, intent(in) :: units(:)
|
|
|
|
active_units = units
|
|
|
|
end subroutine set_active_units
|
|
|
|
|
|
subroutine close_units
|
|
! Close all the active units to flush the buffer.
|
|
|
|
implicit none
|
|
|
|
integer :: i
|
|
|
|
if (allocated(active_units)) then
|
|
do i = 1, size(active_units)
|
|
close(active_units(i))
|
|
end do
|
|
deallocate(active_units)
|
|
end if
|
|
|
|
end subroutine close_units
|
|
|
|
|
|
function unit_active(unit) result(on)
|
|
! Checks whether the given `unit` is active
|
|
|
|
implicit none
|
|
|
|
! function arguments
|
|
integer, intent(in) :: unit
|
|
logical :: on
|
|
|
|
on = any(active_units == unit)
|
|
|
|
end function unit_active
|
|
|
|
end module units
|