initial attempt to refactor the citation logging in LAMMPS

this implements the basic features and flow of control.
to be done are the specific texts and the documentation.
This commit is contained in:
Axel Kohlmeyer
2020-12-27 12:14:12 -05:00
parent ab5a1f229e
commit 4912cde2ae
6 changed files with 122 additions and 37 deletions

View File

@ -171,6 +171,9 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
int restart2dump = 0;
int restartremap = 0;
int citeflag = 1;
int citescreen = CiteMe::TERSE;
int citelogfile = CiteMe::VERBOSE;
char *citefile = nullptr;
int helpflag = 0;
suffix = suffix2 = suffixp = nullptr;
@ -190,7 +193,35 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
iarg = 1;
while (iarg < narg) {
if (strcmp(arg[iarg],"-echo") == 0 ||
if (strcmp(arg[iarg],"-cite") == 0 ||
strcmp(arg[iarg],"-c") == 0) {
if (iarg+2 > narg)
error->universe_all(FLERR,"Invalid command-line argument");
if (strcmp(arg[iarg+1],"both") == 0) {
citescreen = CiteMe::VERBOSE;
citelogfile = CiteMe::VERBOSE;
citefile = nullptr;
} else if (strcmp(arg[iarg+1],"none") == 0) {
citescreen = CiteMe::TERSE;
citelogfile = CiteMe::TERSE;
citefile = nullptr;
} else if (strcmp(arg[iarg+1],"screen") == 0) {
citescreen = CiteMe::VERBOSE;
citelogfile = CiteMe::TERSE;
citefile = nullptr;
} else if (strcmp(arg[iarg+1],"log") == 0) {
citescreen = CiteMe::TERSE;
citelogfile = CiteMe::VERBOSE;
citefile = nullptr;
} else {
citescreen = CiteMe::TERSE;
citelogfile = CiteMe::TERSE;
citefile = arg[iarg+1];
}
iarg += 2;
} else if (strcmp(arg[iarg],"-echo") == 0 ||
strcmp(arg[iarg],"-e") == 0) {
if (iarg+2 > narg)
error->universe_all(FLERR,"Invalid command-line argument");
@ -605,7 +636,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) :
// allocate CiteMe class if enabled
if (citeflag) citeme = new CiteMe(this);
if (citeflag) citeme = new CiteMe(this,citescreen,citelogfile,citefile);
else citeme = nullptr;
// allocate input class now that MPI is fully setup
@ -669,8 +700,8 @@ LAMMPS::~LAMMPS()
{
const int me = comm->me;
destroy();
delete citeme;
destroy();
if (num_package) {
for (int i = 0; i < num_package; i++) {