git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@3113 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2009-08-18 18:43:28 +00:00
parent f483e4001e
commit b16daa15d8
3 changed files with 10 additions and 7 deletions

View File

@ -58,6 +58,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"-partition") == 0) { if (strcmp(arg[iarg],"-partition") == 0) {
universe->existflag = 1;
if (iarg+2 > narg) if (iarg+2 > narg)
error->universe_all("Invalid command-line argument"); error->universe_all("Invalid command-line argument");
iarg++; iarg++;
@ -91,18 +92,18 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
} else error->universe_all("Invalid command-line argument"); } else error->universe_all("Invalid command-line argument");
} }
// if procs was not a command-line switch, universe is one world w/ all procs // if no partition command-line switch, universe is one world w/ all procs
if (universe->nworlds == 0) universe->add_world(NULL); if (universe->existflag == 0) universe->add_world(NULL);
// sum of procs in all worlds must equal total # of procs // sum of procs in all worlds must equal total # of procs
if (!universe->consistent()) if (!universe->consistent())
error->universe_all("Processor partitions are inconsistent"); error->universe_all("Processor partitions are inconsistent");
// multiple-world universe must define input file // universe cannot use stdin for input file
if (universe->nworlds > 1 && inflag == 0) if (universe->existflag && inflag == 0)
error->universe_all("Must use -in switch with multiple partitions"); error->universe_all("Must use -in switch with multiple partitions");
// set universe screen and logfile // set universe screen and logfile
@ -136,12 +137,12 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
universe->ulogfile = NULL; universe->ulogfile = NULL;
} }
// universe is single world // universe does not exist on its own, only a single world
// inherit settings from universe // inherit settings from universe
// set world screen, logfile, communicator, infile // set world screen, logfile, communicator, infile
// open input script if from file // open input script if from file
if (universe->nworlds == 1) { if (universe->existflag == 0) {
screen = universe->uscreen; screen = universe->uscreen;
logfile = universe->ulogfile; logfile = universe->ulogfile;
world = universe->uworld; world = universe->uworld;
@ -162,7 +163,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator)
if (logfile) fprintf(logfile,"LAMMPS (%s)\n",universe->version); if (logfile) fprintf(logfile,"LAMMPS (%s)\n",universe->version);
} }
// universe is multiple worlds // universe is one or more worlds
// split into separate communicators // split into separate communicators
// set world screen, logfile, communicator, infile // set world screen, logfile, communicator, infile
// open input script // open input script

View File

@ -35,6 +35,7 @@ Universe::Universe(LAMMPS *lmp, MPI_Comm communicator) : Pointers(lmp)
uscreen = stdout; uscreen = stdout;
ulogfile = NULL; ulogfile = NULL;
existflag = 0;
nworlds = 0; nworlds = 0;
procs_per_world = NULL; procs_per_world = NULL;
root_proc = NULL; root_proc = NULL;

View File

@ -30,6 +30,7 @@ class Universe : protected Pointers {
FILE *uscreen; // universe screen output FILE *uscreen; // universe screen output
FILE *ulogfile; // universe logfile FILE *ulogfile; // universe logfile
int existflag; // 1 if universe exists due to -partition flag
int nworlds; // # of worlds in universe int nworlds; // # of worlds in universe
int iworld; // which world I am in int iworld; // which world I am in
int *procs_per_world; // # of procs in each world int *procs_per_world; // # of procs in each world