Commit b4fe6be2 authored by Keith Bennett's avatar Keith Bennett

Changed 'ENDIF'/'ENDDO' to 'END IF'/'END DO'

parent 2d67f268
......@@ -352,13 +352,13 @@ CONTAINS
CALL initialise_block_type(h%current_block%next_block)
next => h%current_block%next_block
next%block_start = h%current_block%next_block_location
ENDIF
END IF
ELSE
ALLOCATE(h%blocklist)
CALL initialise_block_type(h%blocklist)
next => h%blocklist
next%block_start = h%summary_location
ENDIF
END IF
h%first = .FALSE.
next%done_header = .FALSE.
......@@ -399,9 +399,9 @@ CONTAINS
IF (sdf_string_equal(block_id, b%id)) RETURN
IF (use_truncated .AND. b%truncated_id) THEN
IF (sdf_string_equal(block_id, b%long_id)) RETURN
ENDIF
END IF
b => b%next_block
ENDDO
END DO
found = .FALSE.
NULLIFY(b)
......@@ -437,7 +437,7 @@ CONTAINS
CALL sdf_safe_copy_string(b%id, block_id)
ELSE
CALL sdf_safe_copy_string(long_id, block_id)
ENDIF
END IF
END FUNCTION sdf_get_block_id
......@@ -490,15 +490,15 @@ CONTAINS
IF (len1 > 0) THEN
IF (IACHAR(str1(len1:len1)) == 0) len1 = len1 - 1
ENDIF
END IF
IF (len2 > 0) THEN
IF (IACHAR(str2(len2:len2)) == 0) len2 = len2 - 1
ENDIF
END IF
IF (len1 /= len2) THEN
equal = .FALSE.
RETURN
ENDIF
END IF
equal = (str1(1:len1) == str2(1:len1))
......@@ -519,12 +519,12 @@ CONTAINS
s2(1:olen) = s1(1:olen)
DO i = olen+1,len2
s2(i:i) = ' '
ENDDO
END DO
ELSE
DO i = 1,len2
s2(i:i) = ' '
ENDDO
ENDIF
END DO
END IF
END SUBROUTINE sdf_safe_copy_string
......@@ -540,8 +540,8 @@ CONTAINS
IF (h%print_warnings .AND. h%rank == h%rank_master) THEN
PRINT*, '*** WARNING ***'
PRINT*, 'SDF ID string "' // TRIM(id) // '" was truncated.'
ENDIF
ENDIF
END IF
END IF
CALL sdf_safe_copy_string(id, new_id)
......@@ -566,9 +566,9 @@ CONTAINS
IF (h%print_warnings .AND. h%rank == h%rank_master) THEN
PRINT*, '*** WARNING ***'
PRINT*, 'SDF ID string "' // TRIM(id) // '" was truncated.'
ENDIF
ENDIF
ENDIF
END IF
END IF
END IF
CALL sdf_safe_copy_string(id, b%id)
old_len = LEN_TRIM(b%id)
......@@ -585,7 +585,7 @@ CONTAINS
pos = pos + 1
n = MOD(num,10)
num = num / 10
ENDDO
END DO
num = i
......@@ -599,11 +599,11 @@ CONTAINS
n = MOD(num,10)
b%id(pos:pos) = numbers(n+1:n+1)
num = num / 10
ENDDO
END DO
found = sdf_find_block(h, tmp, b%id)
i = i + 1
ENDDO
END DO
END SUBROUTINE sdf_safe_copy_unique_id
......@@ -727,16 +727,16 @@ CONTAINS
set_err_handler = set_handler
ELSE
set_err_handler = .TRUE.
ENDIF
END IF
IF (set_err_handler) THEN
CALL MPI_FILE_GET_ERRHANDLER(MPI_FILE_NULL, var%old_errhandler, ierr)
IF (errhandler_handle == MPI_ERRHANDLER_NULL) THEN
CALL MPI_FILE_CREATE_ERRHANDLER(error_handler, errhandler_handle, ierr)
ENDIF
END IF
var%errhandler = errhandler_handle
CALL MPI_FILE_SET_ERRHANDLER(MPI_FILE_NULL, var%errhandler, ierr)
ENDIF
END IF
END SUBROUTINE initialise_file_handle
......@@ -755,7 +755,7 @@ CONTAINS
IF (var%old_errhandler /= MPI_ERRHANDLER_NULL) THEN
CALL MPI_FILE_SET_ERRHANDLER(MPI_FILE_NULL, var%old_errhandler, errcode)
var%old_errhandler = MPI_ERRHANDLER_NULL
ENDIF
END IF
IF (var%comm /= 0) CALL MPI_COMM_FREE(var%comm, errcode)
......@@ -764,15 +764,15 @@ CONTAINS
sdf_handles(i)%filehandle = 0
open_handles = open_handles - 1
EXIT
ENDIF
ENDDO
END IF
END DO
CALL initialise_file_handle(var, set_handler=.FALSE.)
IF (open_handles == 0 .AND. errhandler_handle /= MPI_ERRHANDLER_NULL) THEN
CALL MPI_ERRHANDLER_FREE(errhandler_handle, errcode)
errhandler_handle = MPI_ERRHANDLER_NULL
ENDIF
END IF
END SUBROUTINE deallocate_file_handle
......@@ -788,8 +788,8 @@ CONTAINS
IF (error_code == mpi_error_codes(i)) THEN
errcode = i + c_mpi_error_start - 1
RETURN
ENDIF
ENDDO
END IF
END DO
END FUNCTION map_error_code
......@@ -814,9 +814,9 @@ CONTAINS
h => sdf_handles(i)%handle
found = .TRUE.
EXIT
ENDIF
ENDDO
ENDIF
END IF
END DO
END IF
sdf_error = map_error_code(error_code)
......@@ -831,9 +831,9 @@ CONTAINS
h%error_code = sdf_error + 64 * h%nblocks
h%handled_error = .TRUE.
print_error = h%print_errors
ENDIF
ENDIF
ENDIF
END IF
END IF
END IF
IF (print_error) THEN
CALL MPI_ERROR_STRING(error_code, message, message_len, ierr)
......@@ -842,7 +842,7 @@ CONTAINS
IF (found) THEN
WRITE(0,*) 'Process: ', h%rank
WRITE(0,*) 'Filename: ' // TRIM(h%filename)
ENDIF
END IF
WRITE(0,*) 'File handle: ', filehandle
WRITE(0,*) 'Error code: ', error_code
WRITE(0,*) 'SDF error: ' // TRIM(c_errcodes_char(sdf_error))
......@@ -850,7 +850,7 @@ CONTAINS
IF (filehandle > 0) THEN
CALL MPI_FILE_GET_POSITION(filehandle, filepos, ierr)
WRITE(0,*) 'Position: ', filepos
ENDIF
END IF
IF (filehandle > 0) THEN
CALL MPI_FILE_GET_INFO(filehandle, info, ierr)
......@@ -862,11 +862,11 @@ CONTAINS
CALL MPI_INFO_GET(info, key, MPI_MAX_INFO_VAL, info_value, &
found, ierr)
WRITE(0,'(10X,A,": ",A)') TRIM(key), TRIM(info_value)
ENDDO
ENDIF
END DO
END IF
CALL MPI_INFO_FREE(info, ierr)
ENDIF
ENDIF
END IF
END IF
IF (do_abort) THEN
! First try to generate a floating-point error.
......@@ -875,7 +875,7 @@ CONTAINS
zz = 1.0 / zz
CALL MPI_ABORT(MPI_COMM_WORLD, 10, ierr)
STOP
ENDIF
END IF
END SUBROUTINE error_handler
......
......@@ -45,13 +45,13 @@ CONTAINS
h%error_code = c_err_unsupported_datarep + 64 * h%nblocks
h%handled_error = .TRUE.
RETURN
ENDIF
END IF
IF (PRESENT(mode)) THEN
file_mode = mode
ELSE
file_mode = c_sdf_write
ENDIF
END IF
IF (file_mode == c_sdf_write) THEN
h%writing = .TRUE.
......@@ -62,7 +62,7 @@ CONTAINS
INQUIRE(file=TRIM(filename), exist=exists)
IF (exists) &
CALL MPI_FILE_DELETE(TRIM(filename), MPI_INFO_NULL, errcode)
ENDIF
END IF
ELSE IF (file_mode == c_sdf_append) THEN
h%writing = .TRUE.
h%mode = MPI_MODE_CREATE + MPI_MODE_RDWR
......@@ -70,7 +70,7 @@ CONTAINS
! We're opening a file which already exists, so don't damage it
h%writing = .FALSE.
h%mode = MPI_MODE_RDONLY
ENDIF
END IF
CALL MPI_INFO_CREATE(info, errcode)
CALL MPI_INFO_SET(info, 'romio_cb_write', 'enable', errcode)
......@@ -85,11 +85,11 @@ CONTAINS
CALL MPI_FILE_GET_ERRHANDLER(MPI_FILE_NULL, errcode, ierr)
IF (errcode /= h%old_errhandler) THEN
CALL MPI_FILE_SET_ERRHANDLER(MPI_FILE_NULL, h%old_errhandler, errcode)
ENDIF
END IF
h%old_errhandler = MPI_ERRHANDLER_NULL
CALL MPI_FILE_SET_ERRHANDLER(h%filehandle, h%errhandler, errcode)
ENDIF
END IF
DO i = 1, max_handles
IF (sdf_handles(i)%filehandle == 0) THEN
......@@ -97,9 +97,9 @@ CONTAINS
sdf_handles(i)%handle => h
open_handles = open_handles + 1
EXIT
ENDIF
ENDDO
ENDIF
END IF
END DO
END IF
END SUBROUTINE sdf_open
......@@ -118,7 +118,7 @@ CONTAINS
IF (.NOT.h%station_file) CALL sdf_write_summary(h)
CALL sdf_flush(h)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -161,7 +161,7 @@ CONTAINS
next => b%next_block
CALL sdf_destroy_block(b)
b => next
ENDDO
END DO
NULLIFY(h%blocklist)
NULLIFY(h%current_block)
......@@ -245,7 +245,7 @@ CONTAINS
sdf_errorcode = h%error_code
ELSE
sdf_errorcode = c_err_success
ENDIF
END IF
END FUNCTION sdf_errorcode
......
......@@ -37,14 +37,14 @@ CONTAINS
DO i = 1,b%ndims
clen = MIN(LEN(dim_labels(i)),INT(c_id_length))
dim_labels(i)(1:clen) = b%dim_labels(i)(1:clen)
ENDDO
ENDIF
END DO
END IF
IF (PRESENT(dim_units)) THEN
DO i = 1,b%ndims
clen = MIN(LEN(dim_units(i)),INT(c_id_length))
dim_units(i)(1:clen) = b%dim_units(i)(1:clen)
ENDDO
ENDIF
END DO
END IF
END SUBROUTINE read_plain_mesh_info_r4
......@@ -70,7 +70,7 @@ CONTAINS
errcode)
CALL MPI_FILE_READ(h%filehandle, x, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(x, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -102,7 +102,7 @@ CONTAINS
errcode)
CALL MPI_FILE_READ(h%filehandle, x, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(x, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -110,7 +110,7 @@ CONTAINS
IF (h%rank == h%rank_master) THEN
CALL MPI_FILE_READ(h%filehandle, y, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(y, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -142,7 +142,7 @@ CONTAINS
errcode)
CALL MPI_FILE_READ(h%filehandle, x, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(x, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -150,7 +150,7 @@ CONTAINS
IF (h%rank == h%rank_master) THEN
CALL MPI_FILE_READ(h%filehandle, y, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(y, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -158,7 +158,7 @@ CONTAINS
IF (h%rank == h%rank_master) THEN
CALL MPI_FILE_READ(h%filehandle, z, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(z, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -197,7 +197,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -237,7 +237,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
h%current_location = h%current_location + b%dims(1) * b%type_size
......@@ -250,7 +250,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, y, SIZE(y), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -290,7 +290,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
h%current_location = h%current_location + b%dims(1) * b%type_size
......@@ -303,7 +303,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, y, SIZE(y), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
h%current_location = h%current_location + b%dims(2) * b%type_size
......@@ -316,7 +316,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, z, SIZE(z), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -356,7 +356,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -402,7 +402,7 @@ CONTAINS
CALL MPI_FILE_READ_ALL(h%filehandle, y, SIZE(y), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -454,7 +454,7 @@ CONTAINS
CALL MPI_FILE_READ_ALL(h%filehandle, z, SIZE(z), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -680,14 +680,14 @@ CONTAINS
last = last_in
ELSE
last = .FALSE.
ENDIF
END IF
cur => h%current_block
nm = cur%ndims
nsub = 0
DO i = 1,nm
IF (cur%variable_ids(i) /= '') nsub = nsub + 1
ENDDO
END DO
j = 0
IF (last) THEN
......@@ -699,7 +699,7 @@ CONTAINS
j = j + 1
CALL read_1d_var_last_r4(h, nsub, b%dims, variable, j, distribution, &
subarray)
ENDDO
END DO
ELSE
DO i = 1,nm
IF (cur%variable_ids(i) == '') CYCLE
......@@ -709,8 +709,8 @@ CONTAINS
j = j + 1
CALL read_1d_var_first_r4(h, nsub, b%dims, variable, j, distribution, &
subarray)
ENDDO
ENDIF
END DO
END IF
h%current_block => cur
......@@ -737,14 +737,14 @@ CONTAINS
last = last_in
ELSE
last = .FALSE.
ENDIF
END IF
cur => h%current_block
nm = cur%ndims
nsub = 0
DO i = 1,nm
IF (cur%variable_ids(i) /= '') nsub = nsub + 1
ENDDO
END DO
j = 0
IF (last) THEN
......@@ -756,7 +756,7 @@ CONTAINS
j = j + 1
CALL read_2d_var_last_r4(h, nsub, b%dims, variable, j, distribution, &
subarray)
ENDDO
END DO
ELSE
DO i = 1,nm
IF (cur%variable_ids(i) == '') CYCLE
......@@ -766,8 +766,8 @@ CONTAINS
j = j + 1
CALL read_2d_var_first_r4(h, nsub, b%dims, variable, j, distribution, &
subarray)
ENDDO
ENDIF
END DO
END IF
h%current_block => cur
......@@ -794,14 +794,14 @@ CONTAINS
last = last_in
ELSE
last = .FALSE.
ENDIF
END IF
cur => h%current_block
nm = cur%ndims
nsub = 0
DO i = 1,nm
IF (cur%variable_ids(i) /= '') nsub = nsub + 1
ENDDO
END DO
j = 0
IF (last) THEN
......@@ -813,7 +813,7 @@ CONTAINS
j = j + 1
CALL read_3d_var_last_r4(h, nsub, b%dims, variable, j, distribution, &
subarray)
ENDDO
END DO
ELSE
DO i = 1,nm
IF (cur%variable_ids(i) == '') CYCLE
......@@ -823,8 +823,8 @@ CONTAINS
j = j + 1
CALL read_3d_var_first_r4(h, nsub, b%dims, variable, j, distribution, &
subarray)
ENDDO
ENDIF
END DO
END IF
h%current_block => cur
......@@ -850,7 +850,7 @@ CONTAINS
CALL read_nd_float_r4(h, variable(1,1), distribution, subarray)
ELSE
CALL read_1d_material_r4(h, variable, distribution, subarray, last_in)
ENDIF
END IF
END SUBROUTINE read_2d_variable_r4
......@@ -874,7 +874,7 @@ CONTAINS
CALL read_nd_float_r4(h, variable(1,1,1), distribution, subarray)
ELSE
CALL read_2d_material_r4(h, variable, distribution, subarray, last_in)
ENDIF
END IF
END SUBROUTINE read_3d_variable_r4
......
......@@ -37,14 +37,14 @@ CONTAINS
DO i = 1,b%ndims
clen = MIN(LEN(dim_labels(i)),INT(c_id_length))
dim_labels(i)(1:clen) = b%dim_labels(i)(1:clen)
ENDDO
ENDIF
END DO
END IF
IF (PRESENT(dim_units)) THEN
DO i = 1,b%ndims
clen = MIN(LEN(dim_units(i)),INT(c_id_length))
dim_units(i)(1:clen) = b%dim_units(i)(1:clen)
ENDDO
ENDIF
END DO
END IF
END SUBROUTINE read_plain_mesh_info_r8
......@@ -70,7 +70,7 @@ CONTAINS
errcode)
CALL MPI_FILE_READ(h%filehandle, x, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(x, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -102,7 +102,7 @@ CONTAINS
errcode)
CALL MPI_FILE_READ(h%filehandle, x, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(x, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -110,7 +110,7 @@ CONTAINS
IF (h%rank == h%rank_master) THEN
CALL MPI_FILE_READ(h%filehandle, y, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(y, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -142,7 +142,7 @@ CONTAINS
errcode)
CALL MPI_FILE_READ(h%filehandle, x, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(x, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -150,7 +150,7 @@ CONTAINS
IF (h%rank == h%rank_master) THEN
CALL MPI_FILE_READ(h%filehandle, y, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(y, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -158,7 +158,7 @@ CONTAINS
IF (h%rank == h%rank_master) THEN
CALL MPI_FILE_READ(h%filehandle, z, intn, b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_BCAST(z, intn, b%mpitype, h%rank_master, h%comm, errcode)
......@@ -197,7 +197,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -237,7 +237,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
h%current_location = h%current_location + b%dims(1) * b%type_size
......@@ -250,7 +250,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, y, SIZE(y), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &
MPI_INFO_NULL, errcode)
......@@ -290,7 +290,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, x, SIZE(x), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
h%current_location = h%current_location + b%dims(1) * b%type_size
......@@ -303,7 +303,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, y, SIZE(y), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
h%current_location = h%current_location + b%dims(2) * b%type_size
......@@ -316,7 +316,7 @@ CONTAINS
ELSE
CALL MPI_FILE_READ_ALL(h%filehandle, z, SIZE(z), b%mpitype, &
MPI_STATUS_IGNORE, errcode)
ENDIF
END IF
CALL MPI_FILE_SET_VIEW(h%filehandle, c_off0, MPI_BYTE, MPI_BYTE, 'native', &