move redundant enumerator to Variable class definition in variable.h
This commit is contained in:
11
src/info.cpp
11
src/info.cpp
@ -64,9 +64,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
// same as in variable.cpp
|
|
||||||
enum {INDEX,LOOP,WORLD,UNIVERSE,ULOOP,STRING,GETENV,
|
|
||||||
SCALARFILE,ATOMFILE,FORMAT,EQUAL,ATOM,VECTOR,PYTHON,INTERNAL};
|
|
||||||
|
|
||||||
enum {COMPUTES=1<<0,
|
enum {COMPUTES=1<<0,
|
||||||
DUMPS=1<<1,
|
DUMPS=1<<1,
|
||||||
@ -106,9 +103,11 @@ static const int STYLES = ATOM_STYLES | INTEGRATE_STYLES | MINIMIZE_STYLES
|
|||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
// must match enumerator in variable.h
|
||||||
static const char *varstyles[] = {
|
static const char *varstyles[] = {
|
||||||
"index", "loop", "world", "universe", "uloop", "string", "getenv",
|
"index", "loop", "world", "universe", "uloop", "string", "getenv",
|
||||||
"file", "atomfile", "format", "equal", "atom", "vector", "python", "internal", "(unknown)"};
|
"file", "atomfile", "format", "equal", "atom", "vector", "python",
|
||||||
|
"internal", "(unknown)"};
|
||||||
|
|
||||||
static const char *mapstyles[] = { "none", "array", "hash", "yes" };
|
static const char *mapstyles[] = { "none", "array", "hash", "yes" };
|
||||||
|
|
||||||
@ -649,11 +648,11 @@ void Info::command(int narg, char **arg)
|
|||||||
fmt::print(out,"Variable[{:3d}]: {:16} style = {:16} def =",
|
fmt::print(out,"Variable[{:3d}]: {:16} style = {:16} def =",
|
||||||
i,std::string(names[i])+',',
|
i,std::string(names[i])+',',
|
||||||
std::string(varstyles[style[i]])+',');
|
std::string(varstyles[style[i]])+',');
|
||||||
if (style[i] == INTERNAL) {
|
if (style[i] == Variable::INTERNAL) {
|
||||||
fmt::print(out,"{:.8}\n",input->variable->dvalue[i]);
|
fmt::print(out,"{:.8}\n",input->variable->dvalue[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((style[i] != LOOP) && (style[i] != ULOOP))
|
if ((style[i] != Variable::LOOP) && (style[i] != Variable::ULOOP))
|
||||||
ndata = input->variable->num[i];
|
ndata = input->variable->num[i];
|
||||||
for (int j=0; j < ndata; ++j)
|
for (int j=0; j < ndata; ++j)
|
||||||
if (data[i][j]) fmt::print(out," {}",data[i][j]);
|
if (data[i][j]) fmt::print(out," {}",data[i][j]);
|
||||||
|
|||||||
@ -54,8 +54,6 @@ using namespace MathConst;
|
|||||||
|
|
||||||
#define MYROUND(a) (( a-floor(a) ) >= .5) ? ceil(a) : floor(a)
|
#define MYROUND(a) (( a-floor(a) ) >= .5) ? ceil(a) : floor(a)
|
||||||
|
|
||||||
enum{INDEX,LOOP,WORLD,UNIVERSE,ULOOP,STRING,GETENV,
|
|
||||||
SCALARFILE,ATOMFILE,FORMAT,EQUAL,ATOM,VECTOR,PYTHON,INTERNAL};
|
|
||||||
enum{ARG,OP};
|
enum{ARG,OP};
|
||||||
|
|
||||||
// customize by adding a function
|
// customize by adding a function
|
||||||
@ -5023,7 +5021,7 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) :
|
|||||||
id_fix = nullptr;
|
id_fix = nullptr;
|
||||||
buffer = nullptr;
|
buffer = nullptr;
|
||||||
|
|
||||||
if (style == ATOMFILE) {
|
if (style == Variable::ATOMFILE) {
|
||||||
if (atom->map_style == Atom::MAP_NONE)
|
if (atom->map_style == Atom::MAP_NONE)
|
||||||
error->all(FLERR,"Cannot use atomfile-style "
|
error->all(FLERR,"Cannot use atomfile-style "
|
||||||
"variable unless an atom map exists");
|
"variable unless an atom map exists");
|
||||||
|
|||||||
@ -53,6 +53,10 @@ class Variable : protected Pointers {
|
|||||||
int nvar; // # of defined variables
|
int nvar; // # of defined variables
|
||||||
char **names; // name of each variable
|
char **names; // name of each variable
|
||||||
|
|
||||||
|
// must match "varstyles" array in info.cpp
|
||||||
|
enum{INDEX,LOOP,WORLD,UNIVERSE,ULOOP,STRING,GETENV,
|
||||||
|
SCALARFILE,ATOMFILE,FORMAT,EQUAL,ATOM,VECTOR,PYTHON,INTERNAL};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int me;
|
int me;
|
||||||
int maxvar; // max # of variables following lists can hold
|
int maxvar; // max # of variables following lists can hold
|
||||||
|
|||||||
Reference in New Issue
Block a user