apply utils::logical() to more commands

This commit is contained in:
Axel Kohlmeyer
2021-09-20 22:44:42 -04:00
parent 6adac6b637
commit 41a3eccd1c
39 changed files with 210 additions and 410 deletions

View File

@ -47,7 +47,7 @@ using namespace MathConst;
enum{NUMERIC,ATOM,TYPE,ELEMENT,ATTRIBUTE};
enum{SPHERE,LINE,TRI}; // also in some Body and Fix child classes
enum{STATIC,DYNAMIC};
enum{NO,YES};
enum{NO=0,YES=1};
/* ---------------------------------------------------------------------- */
@ -146,9 +146,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
while (iarg < narg) {
if (strcmp(arg[iarg],"atom") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) atomflag = YES;
else if (strcmp(arg[iarg+1],"no") == 0) atomflag = NO;
else error->all(FLERR,"Illegal dump image command");
atomflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2;
} else if (strcmp(arg[iarg],"adiam") == 0) {
@ -290,18 +288,14 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"box") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) boxflag = YES;
else if (strcmp(arg[iarg+1],"no") == 0) boxflag = NO;
else error->all(FLERR,"Illegal dump image command");
boxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
boxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (boxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
iarg += 3;
} else if (strcmp(arg[iarg],"axes") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) axesflag = YES;
else if (strcmp(arg[iarg+1],"no") == 0) axesflag = NO;
else error->all(FLERR,"Illegal dump image command");
axesflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
axeslen = utils::numeric(FLERR,arg[iarg+2],false,lmp);
axesdiam = utils::numeric(FLERR,arg[iarg+3],false,lmp);
if (axeslen < 0.0 || axesdiam < 0.0)
@ -310,9 +304,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"subbox") == 0) {
if (iarg+3 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) subboxflag = YES;
else if (strcmp(arg[iarg+1],"no") == 0) subboxflag = NO;
else error->all(FLERR,"Illegal dump image command");
subboxflag = utils::logical(FLERR,arg[iarg+1],false,lmp);
subboxdiam = utils::numeric(FLERR,arg[iarg+2],false,lmp);
if (subboxdiam < 0.0) error->all(FLERR,"Illegal dump image command");
iarg += 3;
@ -327,9 +319,7 @@ DumpImage::DumpImage(LAMMPS *lmp, int narg, char **arg) :
} else if (strcmp(arg[iarg],"ssao") == 0) {
if (iarg+4 > narg) error->all(FLERR,"Illegal dump image command");
if (strcmp(arg[iarg+1],"yes") == 0) image->ssao = YES;
else if (strcmp(arg[iarg+1],"no") == 0) image->ssao = NO;
else error->all(FLERR,"Illegal dump image command");
image->ssao = utils::logical(FLERR,arg[iarg+1],false,lmp);
int seed = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (seed <= 0) error->all(FLERR,"Illegal dump image command");
image->seed = seed;