make Output::add_dump() return pointer to the created dump
This commit is contained in:
@ -735,15 +735,15 @@ void Output::reset_dt()
|
||||
add a Dump to list of Dumps
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Output::add_dump(int narg, char **arg)
|
||||
Dump *Output::add_dump(int narg, char **arg)
|
||||
{
|
||||
if (narg < 5) error->all(FLERR,"Illegal dump command");
|
||||
|
||||
// error checks
|
||||
|
||||
for (int idump = 0; idump < ndump; idump++)
|
||||
if (strcmp(arg[0],dump[idump]->id) == 0)
|
||||
error->all(FLERR,"Reuse of dump ID: {}", arg[0]);
|
||||
if (strcmp(arg[0],dump[idump]->id) == 0) error->all(FLERR,"Reuse of dump ID: {}", arg[0]);
|
||||
|
||||
int igroup = group->find(arg[1]);
|
||||
if (igroup == -1) error->all(FLERR,"Could not find dump group ID: {}", arg[1]);
|
||||
if (utils::inumeric(FLERR,arg[3],false,lmp) <= 0)
|
||||
@ -765,25 +765,27 @@ void Output::add_dump(int narg, char **arg)
|
||||
}
|
||||
|
||||
// create the Dump
|
||||
int idump = ndump;
|
||||
|
||||
if (dump_map->find(arg[2]) != dump_map->end()) {
|
||||
DumpCreator &dump_creator = (*dump_map)[arg[2]];
|
||||
dump[ndump] = dump_creator(lmp, narg, arg);
|
||||
dump[idump] = dump_creator(lmp, narg, arg);
|
||||
} else error->all(FLERR,utils::check_packages_for_style("dump",arg[2],lmp));
|
||||
|
||||
// initialize per-dump data to suitable default values
|
||||
|
||||
mode_dump[ndump] = 0;
|
||||
every_dump[ndump] = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
if (every_dump[ndump] <= 0) error->all(FLERR,"Illegal dump command");
|
||||
every_time_dump[ndump] = 0.0;
|
||||
next_time_dump[ndump] = -1.0;
|
||||
last_dump[ndump] = -1;
|
||||
var_dump[ndump] = nullptr;
|
||||
ivar_dump[ndump] = -1;
|
||||
next_dump[ndump] = 0;
|
||||
mode_dump[idump] = 0;
|
||||
every_dump[idump] = utils::inumeric(FLERR,arg[3],false,lmp);
|
||||
if (every_dump[idump] <= 0) error->all(FLERR,"Illegal dump command");
|
||||
every_time_dump[idump] = 0.0;
|
||||
next_time_dump[idump] = -1.0;
|
||||
last_dump[idump] = -1;
|
||||
var_dump[idump] = nullptr;
|
||||
ivar_dump[idump] = -1;
|
||||
next_dump[idump] = 0;
|
||||
|
||||
ndump++;
|
||||
return dump[idump];
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
||||
11
src/output.h
11
src/output.h
@ -80,11 +80,12 @@ class Output : protected Pointers {
|
||||
void reset_timestep(bigint); // reset output which depends on timestep
|
||||
void reset_dt(); // reset output which depends on timestep size
|
||||
|
||||
void add_dump(int, char **); // add a Dump to Dump list
|
||||
void modify_dump(int, char **); // modify a Dump
|
||||
void delete_dump(char *); // delete a Dump from Dump list
|
||||
int find_dump(const char *); // find a Dump ID
|
||||
int check_time_dumps(bigint); // check if any time dump is output now
|
||||
Dump *add_dump(int, char **); // add a Dump to Dump list
|
||||
void modify_dump(int, char **); // modify a Dump
|
||||
void delete_dump(const std::string &); // delete a Dump from Dump list
|
||||
int find_dump(const char *); // find a Dump ID
|
||||
Dump *get_dump_by_id(const std::string &); // find a Dump by ID
|
||||
int check_time_dumps(bigint); // check if any time dump is output now
|
||||
|
||||
void set_thermo(int, char **); // set thermo output freqquency
|
||||
void create_thermo(int, char **); // create a thermo style
|
||||
|
||||
Reference in New Issue
Block a user