simplify nested include file handling

# Conflicts:
#	src/input.h
This commit is contained in:
Axel Kohlmeyer
2019-06-24 14:16:51 -04:00
parent 826a14f54a
commit 7f26862f98

View File

@ -78,7 +78,6 @@ Input::Input(LAMMPS *lmp, int argc, char **argv) : Pointers(lmp)
echo_screen = 0; echo_screen = 0;
echo_log = 1; echo_log = 1;
eof_return = 0;
label_active = 0; label_active = 0;
labelstr = NULL; labelstr = NULL;
@ -207,18 +206,7 @@ void Input::file()
MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(&n,1,MPI_INT,0,world);
if (n == 0) { if (n == 0) {
if (label_active) error->all(FLERR,"Label wasn't found in input script"); if (label_active) error->all(FLERR,"Label wasn't found in input script");
if (eof_return) break; break;
if (me == 0) {
if (infile != stdin) {
fclose(infile);
infile = NULL;
}
nfile--;
}
MPI_Bcast(&nfile,1,MPI_INT,0,world);
if (nfile == 0) break;
if (me == 0) infile = infiles[nfile-1];
continue;
} }
if (n > maxline) reallocate(line,maxline,n); if (n > maxline) reallocate(line,maxline,n);
@ -1059,9 +1047,8 @@ void Input::include()
error->one(FLERR,str); error->one(FLERR,str);
} }
infiles[nfile++] = infile; infiles[nfile++] = infile;
eof_return = 1;
file(); file();
eof_return = 0; fclose(infile);
nfile--; nfile--;
infile = infiles[nfile-1]; infile = infiles[nfile-1];
} }