Merge branch 'master' into reconnection

This commit is contained in:
Grzegorz Kowal 2020-11-12 07:23:44 -03:00
commit 6b466befcb

View File

@ -962,7 +962,9 @@ module integrals
write(eunit,efmt) step, time, dtn, dte, maxval(errors(:)), errors(:) write(eunit,efmt) step, time, dtn, dte, maxval(errors(:)), errors(:)
write(runit,"(i9, 11es18.8e3)") step, time, inarr(11:20) write(runit,"(i9, 11es18.8e3)") step, time, inarr(11:20)
call flush() call flush_and_sync(funit)
call flush_and_sync(sunit)
call flush_and_sync(eunit)
end if end if
#ifdef PROFILE #ifdef PROFILE
@ -974,6 +976,50 @@ module integrals
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! !
end subroutine store_integrals end subroutine store_integrals
!
!===============================================================================
!
! subroutine FLUSH_AND_SYNC:
! -----------------------
!
! Function flushes and fsyncs the I/O buffers.
!
! Arguments:
!
! iounit - the I/O unit to flash;
!
!===============================================================================
!
subroutine flush_and_sync(iounit)
use iso_fortran_env, only : error_unit
implicit none
interface
function fsync (fd) bind(c,name="fsync")
use iso_c_binding, only: c_int
integer(c_int), value :: fd
integer(c_int) :: fsync
end function fsync
end interface
integer, intent(in) :: iounit
integer :: ret
!-------------------------------------------------------------------------------
!
call flush(iounit)
ret = fsync(fnum(iounit))
if (ret /= 0) &
write(error_unit,"('Error calling FSYNC for unit:',1i4)") iounit
!-------------------------------------------------------------------------------
!
end subroutine flush_and_sync
!=============================================================================== !===============================================================================
! !