may only close files on MPI ranks that have a file reader instance

This commit is contained in:
Axel Kohlmeyer
2019-12-16 07:22:41 -05:00
parent 6c3161cb55
commit 55fde76d59

View File

@ -434,8 +434,9 @@ bigint ReadDump::next(bigint ncurrent, bigint nlast, int nevery, int nskip)
// all filereader procs close all their files and return
if (ntimestep < 0) {
for (int i = 0; i < nreader; i++)
readers[i]->close_file();
if (filereader)
for (int i = 0; i < nreader; i++)
readers[i]->close_file();
return ntimestep;
}