take advantage of having the common Command base class to unify code paths

This commit is contained in:
Axel Kohlmeyer
2021-04-14 07:05:00 -04:00
parent 81578d9934
commit 75579fc100
47 changed files with 83 additions and 91 deletions

View File

@ -21,6 +21,7 @@
#include "comm.h"
#include "comm_brick.h"
#include "comm_tiled.h"
#include "command.h"
#include "compute.h"
#include "dihedral.h"
#include "domain.h"
@ -82,7 +83,7 @@ command line flags, holds the factory of commands and creates and
initializes an instance of the Variable class.
To execute a command, a specific class instance, derived from
:cpp:class:`Pointers`, is created, then its ``command()`` member
:cpp:class:`Command`, is created, then its ``command()`` member
function executed, and finally the class instance is deleted.
\endverbatim
@ -789,7 +790,8 @@ int Input::execute_command()
if (command_map->find(command) != command_map->end()) {
CommandCreator &command_creator = (*command_map)[command];
command_creator(lmp,narg,arg);
Command *cmd = command_creator(lmp);
cmd->command(narg,arg);
return 0;
}
@ -803,10 +805,9 @@ int Input::execute_command()
------------------------------------------------------------------------- */
template <typename T>
void Input::command_creator(LAMMPS *lmp, int narg, char **arg)
Command *Input::command_creator(LAMMPS *lmp)
{
T cmd(lmp);
cmd.command(narg,arg);
return new T(lmp);
}
/* ---------------------------------------------------------------------- */