Commit 865b6bb2 authored by Keith Bennett's avatar Keith Bennett

Merge branch 'hotfix/1.4.4'

parents 7bd62a02 9beaef9c
......@@ -83,6 +83,7 @@ MODULE sdf_common
INTEGER :: errhandler, nstations
LOGICAL :: done_header, restart_flag, other_domains, writing, handled_error
LOGICAL :: station_file, first, print_errors, print_warnings, exit_on_error
LOGICAL :: station_file_wrote
CHARACTER(LEN=1), POINTER :: buffer(:)
CHARACTER(LEN=c_id_length) :: code_name
CHARACTER(LEN=c_id_length), POINTER :: station_ids(:)
......@@ -179,8 +180,8 @@ MODULE sdf_common
CHARACTER(LEN=*), PARAMETER :: c_checksum_sha1 = 'sha1'
CHARACTER(LEN=*), PARAMETER :: c_checksum_sha256 = 'sha256'
INTEGER(i4), PARAMETER :: sdf_version = 1, sdf_revision = 3
INTEGER(i4), PARAMETER :: sdf_minor_rev = 1
INTEGER(i4), PARAMETER :: sdf_version = 1, sdf_revision = 4
INTEGER(i4), PARAMETER :: sdf_minor_rev = 0
INTEGER(i4), PARAMETER :: soi4 = 4 ! Size of 4-byte integer
INTEGER(i4), PARAMETER :: soi8 = 8 ! Size of 8-byte integer
......
......@@ -67,6 +67,8 @@ CONTAINS
CALL read_entry_logical(h, h%other_domains)
CALL read_entry_logical(h, h%station_file)
END SUBROUTINE read_header
......
......@@ -155,6 +155,8 @@ CONTAINS
b => b%next_block
ENDDO
h%station_file = found
IF (.NOT.found) RETURN
found = .TRUE.
......
......@@ -75,37 +75,46 @@ CONTAINS
MPI_INTEGER8, MPI_STATUS_IGNORE, errcode)
h%summary_location_wrote = h%summary_location
! c_summary_offset + soi8
CALL MPI_FILE_WRITE(h%filehandle, h%summary_size, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
h%summary_size_wrote = h%summary_size
! c_summary_offset + soi4 + soi8
CALL MPI_FILE_WRITE(h%filehandle, h%nblocks, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
h%nblocks_wrote = h%nblocks
! c_summary_offset + 2 * soi4 + soi8
CALL MPI_FILE_WRITE(h%filehandle, h%block_header_length, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
! c_summary_offset + 3 * soi4 + soi8
int4 = INT(step,i4)
CALL MPI_FILE_WRITE(h%filehandle, int4, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
h%step = step
h%step_wrote = h%step
! c_summary_offset + 4 * soi4 + soi8
CALL MPI_FILE_WRITE(h%filehandle, time, 1, &
MPI_REAL8, MPI_STATUS_IGNORE, errcode)
h%time = time
h%time_wrote = h%time
! c_summary_offset + 4 * soi4 + soi8 + sof8
CALL MPI_FILE_WRITE(h%filehandle, h%jobid%start_seconds, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
! c_summary_offset + 5 * soi4 + soi8 + sof8
CALL MPI_FILE_WRITE(h%filehandle, h%jobid%start_milliseconds, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
! c_summary_offset + 6 * soi4 + soi8 + sof8
CALL MPI_FILE_WRITE(h%filehandle, h%string_length, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
! c_summary_offset + 7 * soi4 + soi8 + sof8
int4 = INT(code_io_version,i4)
CALL MPI_FILE_WRITE(h%filehandle, int4, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
......@@ -116,15 +125,32 @@ CONTAINS
flag = ACHAR(0)
ENDIF
! restart_flag
! c_summary_offset + 8 * soi4 + soi8 + sof8
CALL MPI_FILE_WRITE(h%filehandle, flag, 1, &
MPI_CHARACTER, MPI_STATUS_IGNORE, errcode)
! other_domains
! c_summary_offset + 8 * soi4 + soi8 + sof8 + 1
flag = ACHAR(0)
CALL MPI_FILE_WRITE(h%filehandle, flag, 1, &
MPI_CHARACTER, MPI_STATUS_IGNORE, errcode)
IF (h%station_file) THEN
flag = ACHAR(1)
ELSE
flag = ACHAR(0)
ENDIF
! station_file
! c_summary_offset + 8 * soi4 + soi8 + sof8 + 2
CALL MPI_FILE_WRITE(h%filehandle, flag, 1, &
MPI_CHARACTER, MPI_STATUS_IGNORE, errcode)
h%station_file_wrote = h%station_file
! c_summary_offset + 8 * soi4 + soi8 + sof8 + 3
padding = ACHAR(0)
CALL MPI_FILE_WRITE(h%filehandle, padding, 6, &
CALL MPI_FILE_WRITE(h%filehandle, padding, 5, &
MPI_CHARACTER, MPI_STATUS_IGNORE, errcode)
ENDIF
......@@ -2258,6 +2284,7 @@ CONTAINS
INTEGER(KIND=MPI_OFFSET_KIND) :: offset
INTEGER :: errcode
INTEGER(i4) :: int4
CHARACTER(LEN=1) :: flag
! No open file or not writing
IF (h%filehandle == -1 .OR. .NOT.h%writing) RETURN
......@@ -2276,30 +2303,41 @@ CONTAINS
h%summary_location_wrote = h%summary_location
ENDIF
IF (h%summary_size /= h%summary_size_wrote) THEN
offset = c_summary_offset + 8
offset = c_summary_offset + soi8
CALL MPI_FILE_WRITE_AT(h%filehandle, offset, h%summary_size, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
h%summary_size_wrote = h%summary_size
ENDIF
IF (h%nblocks /= h%nblocks_wrote) THEN
offset = c_summary_offset + 12
offset = c_summary_offset + soi4 + soi8
CALL MPI_FILE_WRITE_AT(h%filehandle, offset, h%nblocks, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
h%nblocks_wrote = h%nblocks
ENDIF
IF (h%step /= h%step_wrote) THEN
offset = c_summary_offset + 20
offset = c_summary_offset + 3 * soi4 + soi8
int4 = INT(h%step,i4)
CALL MPI_FILE_WRITE_AT(h%filehandle, offset, int4, 1, &
MPI_INTEGER4, MPI_STATUS_IGNORE, errcode)
h%step_wrote = h%step
ENDIF
IF (ABS(h%time - h%time_wrote) > c_tiny) THEN
offset = c_summary_offset + 24
offset = c_summary_offset + 4 * soi4 + soi8
CALL MPI_FILE_WRITE_AT(h%filehandle, offset, h%time, 1, &
MPI_REAL8, MPI_STATUS_IGNORE, errcode)
h%time_wrote = h%time
ENDIF
IF (h%station_file .NEQV. h%station_file_wrote) THEN
offset = c_summary_offset + 8 * soi4 + soi8 + sof8 + 2
IF (h%station_file) THEN
flag = ACHAR(1)
ELSE
flag = ACHAR(0)
ENDIF
CALL MPI_FILE_WRITE_AT(h%filehandle, offset, flag, 1, &
MPI_CHARACTER, MPI_STATUS_IGNORE, errcode)
h%station_file_wrote = h%station_file
ENDIF
ENDIF
END SUBROUTINE sdf_update
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment