skip print_headers with no active units

This commit is contained in:
Michele Guerini Rocco 2022-05-03 23:16:21 +02:00
parent 281a649212
commit 3f79a6e9cd
Signed by: rnhmjoj
GPG Key ID: BFBAF4C975F76450
2 changed files with 14 additions and 16 deletions

View File

@ -82,8 +82,6 @@ contains
logical, dimension(:), pointer :: iwait=>null() logical, dimension(:), pointer :: iwait=>null()
logical, dimension(:,:), pointer :: iroff=>null() logical, dimension(:,:), pointer :: iroff=>null()
! parameters log in file headers
character(len=headw), dimension(headl) :: strheader
! buffer for formatting log messages ! buffer for formatting log messages
character(256) :: msg character(256) :: msg
@ -131,8 +129,7 @@ contains
! ========= set environment END ========= ! ========= set environment END =========
! ======== pre-proc prints BEGIN ======== ! ======== pre-proc prints BEGIN ========
call print_parameters(params, strheader) call print_headers(params)
call print_headers(strheader)
! print ψ surface for q=1.5 and q=2 on file and log psi,rhot,rhop ! print ψ surface for q=1.5 and q=2 on file and log psi,rhot,rhop
call print_surfq([1.5_wp_, 2.0_wp_]) call print_surfq([1.5_wp_, 2.0_wp_])
@ -1890,21 +1887,23 @@ bb: do
subroutine print_headers(strheader) subroutine print_headers(params)
! Prints the headers of all gray_main output tables ! Prints the headers of all gray_main output tables
use units, only : uprj0, uwbm, udisp, ucenr, uoutr, upec, usumm, & use units, only : uprj0, uwbm, udisp, ucenr, uoutr, upec, usumm, &
unit_active unit_active, active_units
use gray_params, only : gray_parameters, headw, headl, print_parameters
implicit none implicit none
! subroutine arguments ! subroutine arguments
character(len=*), dimension(:), intent(in) :: strheader type(gray_parameters), intent(in) :: params
! local variables ! local variables
integer :: i, j integer :: i, j
integer :: main_units(8) integer :: main_units(8)
character(256) :: main_headers(8) character(256) :: main_headers(8)
character(len=headw), dimension(headl) :: header
main_units = [uprj0, uprj0+1, uwbm, udisp, ucenr, uoutr, upec, usumm] main_units = [uprj0, uprj0+1, uwbm, udisp, ucenr, uoutr, upec, usumm]
@ -1922,10 +1921,14 @@ bb: do
// 'chipol index_rt Jphimx dPdVmx drhotj drhotp P0 ' & // 'chipol index_rt Jphimx dPdVmx drhotj drhotp P0 ' &
// 'cplO cplX' // 'cplO cplX'
if (all(active_units == 0)) return
call print_parameters(params, header)
do i=1,size(main_units) do i=1,size(main_units)
if (unit_active(main_units(i))) then if (unit_active(main_units(i))) then
do j=1,size(strheader) do j=1,size(header)
write (main_units(i), '(1x,a)') strheader(j) write (main_units(i), '(1x,a)') header(j)
end do end do
write (main_units(i), '(1x,a)') trim(main_headers(i)) write (main_units(i), '(1x,a)') trim(main_headers(i))
end if end if

View File

@ -443,12 +443,7 @@ contains
! ======= set environment END ====== ! ======= set environment END ======
! ======== pre-proc prints BEGIN ======== ! ======== pre-proc prints BEGIN ========
block call print_headers(params)
! Parameters log in file headers
character(len=headw), dimension(headl) :: strheader
call print_parameters(params, strheader)
call print_headers(strheader)
end block
! Print ψ surface for q=1.5 and q=2 on file and psi,rhot,rhop on stdout ! Print ψ surface for q=1.5 and q=2 on file and psi,rhot,rhop on stdout
call print_surfq([1.5_wp_, 2.0_wp_]) call print_surfq([1.5_wp_, 2.0_wp_])