use symbolic constant

This commit is contained in:
Axel Kohlmeyer
2021-09-15 15:09:58 -04:00
parent 9c301822fd
commit f01681eae7
2 changed files with 4 additions and 3 deletions

View File

@ -196,8 +196,8 @@ void Balance::command(int narg, char **arg)
if (style != -1) error->all(FLERR,"Illegal balance command"); if (style != -1) error->all(FLERR,"Illegal balance command");
if (iarg+4 > narg) error->all(FLERR,"Illegal balance command"); if (iarg+4 > narg) error->all(FLERR,"Illegal balance command");
style = SHIFT; style = SHIFT;
if (strlen(arg[iarg+1]) > 3) error->all(FLERR,"Illegal balance command"); if (strlen(arg[iarg+1]) > BSTR_SIZE) error->all(FLERR,"Illegal balance command");
strcpy(bstr,arg[iarg+1]); strncpy(bstr,arg[iarg+1],BSTR_SIZE);
nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp); nitermax = utils::inumeric(FLERR,arg[iarg+2],false,lmp);
if (nitermax <= 0) error->all(FLERR,"Illegal balance command"); if (nitermax <= 0) error->all(FLERR,"Illegal balance command");
stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp); stopthresh = utils::numeric(FLERR,arg[iarg+3],false,lmp);

View File

@ -56,7 +56,8 @@ class Balance : public Command {
int nitermax; // params for shift LB int nitermax; // params for shift LB
double stopthresh; double stopthresh;
char bstr[4]; static constexpr int BSTR_SIZE = 3;
char bstr[BSTR_SIZE+1];
int shift_allocate; // 1 if SHIFT vectors have been allocated int shift_allocate; // 1 if SHIFT vectors have been allocated
int ndim; // length of balance string bstr int ndim; // length of balance string bstr