add option to the print command to also print to the global universe screen and logfile

This commit is contained in:
Axel Kohlmeyer
2017-11-07 10:00:57 -05:00
parent ba43465268
commit 2e40c00995
2 changed files with 21 additions and 3 deletions

View File

@ -1175,6 +1175,7 @@ void Input::print()
FILE *fp = NULL;
int screenflag = 1;
int universeflag = 0;
int iarg = 1;
while (iarg < narg) {
@ -1197,6 +1198,12 @@ void Input::print()
else if (strcmp(arg[iarg+1],"no") == 0) screenflag = 0;
else error->all(FLERR,"Illegal print command");
iarg += 2;
} else if (strcmp(arg[iarg],"universe") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal print command");
if (strcmp(arg[iarg+1],"yes") == 0) universeflag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) universeflag = 0;
else error->all(FLERR,"Illegal print command");
iarg += 2;
} else error->all(FLERR,"Illegal print command");
}
@ -1208,6 +1215,10 @@ void Input::print()
fclose(fp);
}
}
if (universeflag && (universe->me == 0)) {
if (universe->uscreen) fprintf(universe->uscreen, "%s\n",line);
if (universe->ulogfile) fprintf(universe->ulogfile,"%s\n",line);
}
}
/* ---------------------------------------------------------------------- */