take advantage of having the common Command base class to unify code paths
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user