Skip to content

Commit 91a6518

Browse files
committed
bug fix
1 parent 4281144 commit 91a6518

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

src/post_process/m_data_input.f90

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -153,30 +153,36 @@ impure subroutine s_read_ib_data_files(file_loc_base)
153153

154154
if (.not. ib) return
155155

156-
write (file_loc, '(A)') trim(file_loc_base)//'/ib.dat'
156+
if (parallel_io) then
157+
write (file_loc, '(A)') trim(file_loc_base)//'ib.dat'
158+
else
159+
write (file_loc, '(A)') trim(file_loc_base)//'/ib.dat'
160+
end if
157161
inquire (FILE=trim(file_loc), EXIST=file_exist)
158162

159163
if (file_exist) then
164+
if (parallel_io) then
160165
#ifdef MFC_MPI
161-
call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
166+
call MPI_FILE_OPEN(MPI_COMM_WORLD, file_loc, MPI_MODE_RDONLY, mpi_info_int, ifile, ierr)
162167

163-
data_size = (m + 1)*(n + 1)*(p + 1)
164-
disp = 0
168+
data_size = (m + 1)*(n + 1)*(p + 1)
169+
disp = 0
165170

166-
call MPI_FILE_SET_VIEW(ifile, disp, MPI_INTEGER, MPI_IO_IB_DATA%view, &
167-
'native', mpi_info_int, ierr)
168-
call MPI_FILE_READ(ifile, MPI_IO_IB_DATA%var%sf, data_size, &
169-
MPI_INTEGER, status, ierr)
171+
call MPI_FILE_SET_VIEW(ifile, disp, MPI_INTEGER, MPI_IO_IB_DATA%view, &
172+
'native', mpi_info_int, ierr)
173+
call MPI_FILE_READ(ifile, MPI_IO_IB_DATA%var%sf, data_size, &
174+
MPI_INTEGER, status, ierr)
170175

171-
call MPI_FILE_CLOSE(ifile, ierr)
172-
#else
173-
open (2, FILE=trim(file_loc), &
174-
FORM='unformatted', &
175-
ACTION='read', &
176-
STATUS='old')
177-
read (2) ib_markers%sf(0:m, 0:n, 0:p)
178-
close (2)
176+
call MPI_FILE_CLOSE(ifile, ierr)
179177
#endif
178+
else
179+
open (2, FILE=trim(file_loc), &
180+
FORM='unformatted', &
181+
ACTION='read', &
182+
STATUS='old')
183+
read (2) ib_markers%sf(0:m, 0:n, 0:p)
184+
close (2)
185+
end if
180186
else
181187
call s_mpi_abort('File '//trim(file_loc)//' is missing. Exiting.')
182188
end if

0 commit comments

Comments
 (0)