Close open units on exit to flush the buffer
This commit is contained in:
parent
b379a20192
commit
d3a87e1044
@ -1,7 +1,7 @@
|
|||||||
program main
|
program main
|
||||||
use const_and_precisions, only : wp_, one, zero
|
use const_and_precisions, only : wp_, one, zero
|
||||||
use logger, only : INFO, ERROR, set_log_level, log_message
|
use logger, only : INFO, ERROR, set_log_level, log_message
|
||||||
use units, only : set_active_units
|
use units, only : set_active_units, close_units
|
||||||
use gray_cli, only : cli_options, parse_cli_options
|
use gray_cli, only : cli_options, parse_cli_options
|
||||||
use gray_core, only : gray_main
|
use gray_core, only : gray_main
|
||||||
use gray_params, only : gray_parameters, gray_data, gray_results, &
|
use gray_params, only : gray_parameters, gray_data, gray_results, &
|
||||||
@ -143,6 +143,7 @@ program main
|
|||||||
call deinit_profiles(data%profiles)
|
call deinit_profiles(data%profiles)
|
||||||
call deinit_misc
|
call deinit_misc
|
||||||
deallocate(results%dpdv, results%jcd)
|
deallocate(results%dpdv, results%jcd)
|
||||||
|
call close_units
|
||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
|
@ -40,6 +40,23 @@ contains
|
|||||||
end subroutine set_active_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)
|
function unit_active(unit) result(on)
|
||||||
! Checks whether the given `unit` is active
|
! Checks whether the given `unit` is active
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user