Added check for source file size different from n_particles.

This commit is contained in:
Paul Romano 2012-03-22 18:20:12 -04:00
parent b940ec69f0
commit cfc1dc2ab3

View file

@ -275,10 +275,18 @@ contains
call MPI_FILE_OPEN(MPI_COMM_WORLD, 'source.binary', MPI_MODE_RDONLY, &
MPI_INFO_NULL, fh, mpi_err)
! Read number of source sites in file
offset = 0
call MPI_FILE_READ_AT(fh, offset, n_sites, 1, MPI_INTEGER8, &
MPI_STATUS_IGNORE, mpi_err)
! Check that number of source sites matches
if (n_sites /= n_particles) then
message = "No support yet for source files of different size than &
&specified number of particles per generation."
call fatal_error()
end if
! Set proper offset for source data on this processor
offset = 8*(1 + rank*maxwork*8)
@ -300,6 +308,13 @@ contains
! Read number of source sites in file
read(UNIT=UNIT_SOURCE) n_sites
! Check that number of source sites matches
if (n_sites /= n_particles) then
message = "No support yet for source files of different size than &
&specified number of particles per generation."
call fatal_error()
end if
! Read position, angle, and energy
read(UNIT=UNIT_SOURCE) source_bank(1:work)