From e8d56d3ea605878c645de5d6b41ddf32c2ebf00e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 14 Feb 2019 16:22:52 -0500 Subject: [PATCH] revert broken changes to compute reduce --- src/compute_reduce.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/compute_reduce.cpp b/src/compute_reduce.cpp index 67b34f3c59..16dc84628a 100644 --- a/src/compute_reduce.cpp +++ b/src/compute_reduce.cpp @@ -27,7 +27,6 @@ #include "variable.h" #include "memory.h" #include "error.h" -#include "utils.h" using namespace LAMMPS_NS; @@ -88,7 +87,6 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : // parse values until one isn't recognized - char *suffix = NULL; which = new int[nargnew]; argindex = new int[nargnew]; flavor = new int[nargnew]; @@ -134,18 +132,26 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) : which[nvalues] = F; argindex[nvalues++] = 2; - } else if ((which[nvalues] = utils::cfvarg("cfv",arg[iarg],suffix)) - != utils::NONE ) { + } else if (strncmp(arg[iarg],"c_",2) == 0 || + strncmp(arg[iarg],"f_",2) == 0 || + strncmp(arg[iarg],"v_",2) == 0) { + if (arg[iarg][0] == 'c') which[nvalues] = COMPUTE; + else if (arg[iarg][0] == 'f') which[nvalues] = FIX; + else if (arg[iarg][0] == 'v') which[nvalues] = VARIABLE; + + int n = strlen(arg[iarg]); + char *suffix = new char[n]; + strcpy(suffix,&arg[iarg][2]); char *ptr = strchr(suffix,'['); if (ptr) { - if (!utils::strmatch(suffix,"\\[[0-9]+\\]$")) + if (suffix[strlen(suffix)-1] != ']') error->all(FLERR,"Illegal compute reduce command"); argindex[nvalues] = atoi(ptr+1); *ptr = '\0'; } else argindex[nvalues] = 0; - int n = strlen(suffix) + 1; + n = strlen(suffix) + 1; ids[nvalues] = new char[n]; strcpy(ids[nvalues],suffix); nvalues++;