starting to add timer-style variable
This commit is contained in:
@ -110,7 +110,7 @@ using namespace LAMMPS_NS;
|
|||||||
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",
|
"file", "atomfile", "format", "equal", "atom", "vector", "python",
|
||||||
"internal", "(unknown)"};
|
"timer", "internal", "(unknown)"};
|
||||||
|
|
||||||
static const char *mapstyles[] = { "none", "array", "hash", "yes" };
|
static const char *mapstyles[] = { "none", "array", "hash", "yes" };
|
||||||
|
|
||||||
|
|||||||
@ -500,6 +500,22 @@ void Variable::set(int narg, char **arg)
|
|||||||
strcpy(data[nvar][1],"(undefined)");
|
strcpy(data[nvar][1],"(undefined)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TIMER
|
||||||
|
// num = listed args, which = 1st value, data = copied args
|
||||||
|
|
||||||
|
} else if (strcmp(arg[1],"timer") == 0) {
|
||||||
|
if (narg != 2) error->all(FLERR,"Illegal variable command");
|
||||||
|
if (find(arg[0]) >= 0) return;
|
||||||
|
if (nvar == maxvar) grow();
|
||||||
|
style[nvar] = TIMER;
|
||||||
|
num[nvar] = 1;
|
||||||
|
which[nvar] = 0;
|
||||||
|
pad[nvar] = 0;
|
||||||
|
data[nvar] = new char*[num[nvar]];
|
||||||
|
copy(num[nvar],&arg[2],data[nvar]);
|
||||||
|
|
||||||
|
// NOTE: set value to MPI_Wtime() evaulated by proc 0
|
||||||
|
|
||||||
// INTERNAL
|
// INTERNAL
|
||||||
// replace pre-existing var if also style INTERNAL (allows it to be reset)
|
// replace pre-existing var if also style INTERNAL (allows it to be reset)
|
||||||
// num = 1, for string representation of dvalue, set by retrieve()
|
// num = 1, for string representation of dvalue, set by retrieve()
|
||||||
|
|||||||
@ -71,6 +71,7 @@ class Variable : protected Pointers {
|
|||||||
ATOM,
|
ATOM,
|
||||||
VECTOR,
|
VECTOR,
|
||||||
PYTHON,
|
PYTHON,
|
||||||
|
TIMER,
|
||||||
INTERNAL
|
INTERNAL
|
||||||
};
|
};
|
||||||
static constexpr int VALUELENGTH = 64;
|
static constexpr int VALUELENGTH = 64;
|
||||||
|
|||||||
Reference in New Issue
Block a user