use references when creating styles
This commit is contained in:
@ -653,7 +653,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (avec_map->find(estyle) != avec_map->end()) {
|
||||
AtomVecCreator avec_creator = (*avec_map)[estyle];
|
||||
AtomVecCreator &avec_creator = (*avec_map)[estyle];
|
||||
return avec_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -662,7 +662,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 2;
|
||||
std::string estyle = style + "/" + lmp->suffix2;
|
||||
if (avec_map->find(estyle) != avec_map->end()) {
|
||||
AtomVecCreator avec_creator = (*avec_map)[estyle];
|
||||
AtomVecCreator &avec_creator = (*avec_map)[estyle];
|
||||
return avec_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -670,7 +670,7 @@ AtomVec *Atom::new_avec(const std::string &style, int trysuffix, int &sflag)
|
||||
|
||||
sflag = 0;
|
||||
if (avec_map->find(style) != avec_map->end()) {
|
||||
AtomVecCreator avec_creator = (*avec_map)[style];
|
||||
AtomVecCreator &avec_creator = (*avec_map)[style];
|
||||
return avec_creator(lmp);
|
||||
}
|
||||
|
||||
|
||||
@ -1764,7 +1764,7 @@ void Domain::add_region(int narg, char **arg)
|
||||
if (lmp->suffix) {
|
||||
std::string estyle = std::string(arg[1]) + "/" + lmp->suffix;
|
||||
if (region_map->find(estyle) != region_map->end()) {
|
||||
RegionCreator region_creator = (*region_map)[estyle];
|
||||
RegionCreator ®ion_creator = (*region_map)[estyle];
|
||||
regions[nregion] = region_creator(lmp, narg, arg);
|
||||
regions[nregion]->init();
|
||||
nregion++;
|
||||
@ -1775,7 +1775,7 @@ void Domain::add_region(int narg, char **arg)
|
||||
if (lmp->suffix2) {
|
||||
std::string estyle = std::string(arg[1]) + "/" + lmp->suffix2;
|
||||
if (region_map->find(estyle) != region_map->end()) {
|
||||
RegionCreator region_creator = (*region_map)[estyle];
|
||||
RegionCreator ®ion_creator = (*region_map)[estyle];
|
||||
regions[nregion] = region_creator(lmp, narg, arg);
|
||||
regions[nregion]->init();
|
||||
nregion++;
|
||||
@ -1785,7 +1785,7 @@ void Domain::add_region(int narg, char **arg)
|
||||
}
|
||||
|
||||
if (region_map->find(arg[1]) != region_map->end()) {
|
||||
RegionCreator region_creator = (*region_map)[arg[1]];
|
||||
RegionCreator ®ion_creator = (*region_map)[arg[1]];
|
||||
regions[nregion] = region_creator(lmp, narg, arg);
|
||||
} else error->all(FLERR,utils::check_packages_for_style("region",arg[1],lmp));
|
||||
|
||||
|
||||
@ -259,7 +259,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (pair_map->find(estyle) != pair_map->end()) {
|
||||
PairCreator pair_creator = (*pair_map)[estyle];
|
||||
PairCreator &pair_creator = (*pair_map)[estyle];
|
||||
return pair_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -267,7 +267,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 2;
|
||||
std::string estyle = style + "/" + lmp->suffix2;
|
||||
if (pair_map->find(estyle) != pair_map->end()) {
|
||||
PairCreator pair_creator = (*pair_map)[estyle];
|
||||
PairCreator &pair_creator = (*pair_map)[estyle];
|
||||
return pair_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -276,7 +276,7 @@ Pair *Force::new_pair(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 0;
|
||||
if (style == "none") return NULL;
|
||||
if (pair_map->find(style) != pair_map->end()) {
|
||||
PairCreator pair_creator = (*pair_map)[style];
|
||||
PairCreator &pair_creator = (*pair_map)[style];
|
||||
return pair_creator(lmp);
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (bond_map->find(estyle) != bond_map->end()) {
|
||||
BondCreator bond_creator = (*bond_map)[estyle];
|
||||
BondCreator &bond_creator = (*bond_map)[estyle];
|
||||
return bond_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -378,7 +378,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 2;
|
||||
std::string estyle = style + "/" + lmp->suffix2;
|
||||
if (bond_map->find(estyle) != bond_map->end()) {
|
||||
BondCreator bond_creator = (*bond_map)[estyle];
|
||||
BondCreator &bond_creator = (*bond_map)[estyle];
|
||||
return bond_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -387,7 +387,7 @@ Bond *Force::new_bond(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 0;
|
||||
if (style == "none") return NULL;
|
||||
if (bond_map->find(style) != bond_map->end()) {
|
||||
BondCreator bond_creator = (*bond_map)[style];
|
||||
BondCreator &bond_creator = (*bond_map)[style];
|
||||
return bond_creator(lmp);
|
||||
}
|
||||
|
||||
@ -446,7 +446,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (angle_map->find(estyle) != angle_map->end()) {
|
||||
AngleCreator angle_creator = (*angle_map)[estyle];
|
||||
AngleCreator &angle_creator = (*angle_map)[estyle];
|
||||
return angle_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -455,7 +455,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 2;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (angle_map->find(estyle) != angle_map->end()) {
|
||||
AngleCreator angle_creator = (*angle_map)[estyle];
|
||||
AngleCreator &angle_creator = (*angle_map)[estyle];
|
||||
return angle_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -464,7 +464,7 @@ Angle *Force::new_angle(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 0;
|
||||
if (style == "none") return NULL;
|
||||
if (angle_map->find(style) != angle_map->end()) {
|
||||
AngleCreator angle_creator = (*angle_map)[style];
|
||||
AngleCreator &angle_creator = (*angle_map)[style];
|
||||
return angle_creator(lmp);
|
||||
}
|
||||
|
||||
@ -523,7 +523,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (dihedral_map->find(estyle) != dihedral_map->end()) {
|
||||
DihedralCreator dihedral_creator = (*dihedral_map)[estyle];
|
||||
DihedralCreator &dihedral_creator = (*dihedral_map)[estyle];
|
||||
return dihedral_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -532,7 +532,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla
|
||||
sflag = 2;
|
||||
std::string estyle = style + "/" + lmp->suffix2;
|
||||
if (dihedral_map->find(estyle) != dihedral_map->end()) {
|
||||
DihedralCreator dihedral_creator = (*dihedral_map)[estyle];
|
||||
DihedralCreator &dihedral_creator = (*dihedral_map)[estyle];
|
||||
return dihedral_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -541,7 +541,7 @@ Dihedral *Force::new_dihedral(const std::string &style, int trysuffix, int &sfla
|
||||
sflag = 0;
|
||||
if (style == "none") return NULL;
|
||||
if (dihedral_map->find(style) != dihedral_map->end()) {
|
||||
DihedralCreator dihedral_creator = (*dihedral_map)[style];
|
||||
DihedralCreator &dihedral_creator = (*dihedral_map)[style];
|
||||
return dihedral_creator(lmp);
|
||||
}
|
||||
|
||||
@ -600,7 +600,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (improper_map->find(estyle) != improper_map->end()) {
|
||||
ImproperCreator improper_creator = (*improper_map)[estyle];
|
||||
ImproperCreator &improper_creator = (*improper_map)[estyle];
|
||||
return improper_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -609,7 +609,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla
|
||||
sflag = 2;
|
||||
std::string estyle = style + "/" + lmp->suffix2;
|
||||
if (improper_map->find(estyle) != improper_map->end()) {
|
||||
ImproperCreator improper_creator = (*improper_map)[estyle];
|
||||
ImproperCreator &improper_creator = (*improper_map)[estyle];
|
||||
return improper_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -618,7 +618,7 @@ Improper *Force::new_improper(const std::string &style, int trysuffix, int &sfla
|
||||
sflag = 0;
|
||||
if (style == "none") return NULL;
|
||||
if (improper_map->find(style) != improper_map->end()) {
|
||||
ImproperCreator improper_creator = (*improper_map)[style];
|
||||
ImproperCreator &improper_creator = (*improper_map)[style];
|
||||
return improper_creator(lmp);
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix;
|
||||
if (kspace_map->find(estyle) != kspace_map->end()) {
|
||||
KSpaceCreator kspace_creator = (*kspace_map)[estyle];
|
||||
KSpaceCreator &kspace_creator = (*kspace_map)[estyle];
|
||||
return kspace_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -690,7 +690,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 1;
|
||||
std::string estyle = style + "/" + lmp->suffix2;
|
||||
if (kspace_map->find(estyle) != kspace_map->end()) {
|
||||
KSpaceCreator kspace_creator = (*kspace_map)[estyle];
|
||||
KSpaceCreator &kspace_creator = (*kspace_map)[estyle];
|
||||
return kspace_creator(lmp);
|
||||
}
|
||||
}
|
||||
@ -699,7 +699,7 @@ KSpace *Force::new_kspace(const std::string &style, int trysuffix, int &sflag)
|
||||
sflag = 0;
|
||||
if (style == "none") return NULL;
|
||||
if (kspace_map->find(style) != kspace_map->end()) {
|
||||
KSpaceCreator kspace_creator = (*kspace_map)[style];
|
||||
KSpaceCreator &kspace_creator = (*kspace_map)[style];
|
||||
return kspace_creator(lmp);
|
||||
}
|
||||
|
||||
|
||||
@ -853,7 +853,7 @@ int Input::execute_command()
|
||||
// invoke commands added via style_command.h
|
||||
|
||||
if (command_map->find(command) != command_map->end()) {
|
||||
CommandCreator command_creator = (*command_map)[command];
|
||||
CommandCreator &command_creator = (*command_map)[command];
|
||||
command_creator(lmp,narg,arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -872,7 +872,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
|
||||
if (lmp->suffix) {
|
||||
std::string estyle = arg[2] + std::string("/") + lmp->suffix;
|
||||
if (fix_map->find(estyle) != fix_map->end()) {
|
||||
FixCreator fix_creator = (*fix_map)[estyle];
|
||||
FixCreator &fix_creator = (*fix_map)[estyle];
|
||||
fix[ifix] = fix_creator(lmp,narg,arg);
|
||||
delete[] fix[ifix]->style;
|
||||
fix[ifix]->style = new char[estyle.size()+1];
|
||||
@ -882,7 +882,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
|
||||
if (fix[ifix] == NULL && lmp->suffix2) {
|
||||
std::string estyle = arg[2] + std::string("/") + lmp->suffix2;
|
||||
if (fix_map->find(estyle) != fix_map->end()) {
|
||||
FixCreator fix_creator = (*fix_map)[estyle];
|
||||
FixCreator &fix_creator = (*fix_map)[estyle];
|
||||
fix[ifix] = fix_creator(lmp,narg,arg);
|
||||
delete[] fix[ifix]->style;
|
||||
fix[ifix]->style = new char[estyle.size()+1];
|
||||
@ -892,7 +892,7 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
|
||||
}
|
||||
|
||||
if (fix[ifix] == NULL && fix_map->find(arg[2]) != fix_map->end()) {
|
||||
FixCreator fix_creator = (*fix_map)[arg[2]];
|
||||
FixCreator &fix_creator = (*fix_map)[arg[2]];
|
||||
fix[ifix] = fix_creator(lmp,narg,arg);
|
||||
}
|
||||
|
||||
@ -1212,7 +1212,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix)
|
||||
if (lmp->suffix) {
|
||||
std::string estyle = arg[2] + std::string("/") + lmp->suffix;
|
||||
if (compute_map->find(estyle) != compute_map->end()) {
|
||||
ComputeCreator compute_creator = (*compute_map)[estyle];
|
||||
ComputeCreator &compute_creator = (*compute_map)[estyle];
|
||||
compute[ncompute] = compute_creator(lmp,narg,arg);
|
||||
delete[] compute[ncompute]->style;
|
||||
compute[ncompute]->style = new char[estyle.size()+1];
|
||||
@ -1222,7 +1222,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix)
|
||||
if (compute[ncompute] == NULL && lmp->suffix2) {
|
||||
std::string estyle = arg[2] + std::string("/") + lmp->suffix2;
|
||||
if (compute_map->find(estyle) != compute_map->end()) {
|
||||
ComputeCreator compute_creator = (*compute_map)[estyle];
|
||||
ComputeCreator &compute_creator = (*compute_map)[estyle];
|
||||
compute[ncompute] = compute_creator(lmp,narg,arg);
|
||||
delete[] compute[ncompute]->style;
|
||||
compute[ncompute]->style = new char[estyle.size()+1];
|
||||
@ -1233,7 +1233,7 @@ void Modify::add_compute(int narg, char **arg, int trysuffix)
|
||||
|
||||
if (compute[ncompute] == NULL &&
|
||||
compute_map->find(arg[2]) != compute_map->end()) {
|
||||
ComputeCreator compute_creator = (*compute_map)[arg[2]];
|
||||
ComputeCreator &compute_creator = (*compute_map)[arg[2]];
|
||||
compute[ncompute] = compute_creator(lmp,narg,arg);
|
||||
}
|
||||
|
||||
|
||||
@ -782,7 +782,7 @@ int Neighbor::init_pair()
|
||||
continue;
|
||||
}
|
||||
|
||||
BinCreator bin_creator = binclass[flag-1];
|
||||
BinCreator &bin_creator = binclass[flag-1];
|
||||
neigh_bin[nbin] = bin_creator(lmp);
|
||||
neigh_bin[nbin]->post_constructor(requests[i]);
|
||||
neigh_bin[nbin]->istyle = flag;
|
||||
@ -803,7 +803,7 @@ int Neighbor::init_pair()
|
||||
continue;
|
||||
}
|
||||
|
||||
StencilCreator stencil_creator = stencilclass[flag-1];
|
||||
StencilCreator &stencil_creator = stencilclass[flag-1];
|
||||
neigh_stencil[nstencil] = stencil_creator(lmp);
|
||||
neigh_stencil[nstencil]->post_constructor(requests[i]);
|
||||
neigh_stencil[nstencil]->istyle = flag;
|
||||
@ -828,7 +828,7 @@ int Neighbor::init_pair()
|
||||
continue;
|
||||
}
|
||||
|
||||
PairCreator pair_creator = pairclass[flag-1];
|
||||
PairCreator &pair_creator = pairclass[flag-1];
|
||||
lists[i]->np = neigh_pair[i] = pair_creator(lmp);
|
||||
neigh_pair[i]->post_constructor(requests[i]);
|
||||
neigh_pair[i]->istyle = flag;
|
||||
|
||||
@ -568,7 +568,7 @@ void Output::add_dump(int narg, char **arg)
|
||||
// create the Dump
|
||||
|
||||
if (dump_map->find(arg[2]) != dump_map->end()) {
|
||||
DumpCreator dump_creator = (*dump_map)[arg[2]];
|
||||
DumpCreator &dump_creator = (*dump_map)[arg[2]];
|
||||
dump[ndump] = dump_creator(lmp, narg, arg);
|
||||
} else error->all(FLERR,utils::check_packages_for_style("dump",arg[2],lmp));
|
||||
|
||||
|
||||
@ -331,7 +331,7 @@ void Update::new_integrate(char *style, int narg, char **arg,
|
||||
sflag = 1;
|
||||
std::string estyle = style + std::string("/") + lmp->suffix;
|
||||
if (integrate_map->find(estyle) != integrate_map->end()) {
|
||||
IntegrateCreator integrate_creator = (*integrate_map)[estyle];
|
||||
IntegrateCreator &integrate_creator = (*integrate_map)[estyle];
|
||||
integrate = integrate_creator(lmp, narg, arg);
|
||||
return;
|
||||
}
|
||||
@ -341,7 +341,7 @@ void Update::new_integrate(char *style, int narg, char **arg,
|
||||
sflag = 2;
|
||||
std::string estyle = style + std::string("/") + lmp->suffix2;
|
||||
if (integrate_map->find(estyle) != integrate_map->end()) {
|
||||
IntegrateCreator integrate_creator = (*integrate_map)[estyle];
|
||||
IntegrateCreator &integrate_creator = (*integrate_map)[estyle];
|
||||
integrate = integrate_creator(lmp, narg, arg);
|
||||
return;
|
||||
}
|
||||
@ -350,7 +350,7 @@ void Update::new_integrate(char *style, int narg, char **arg,
|
||||
|
||||
sflag = 0;
|
||||
if (integrate_map->find(style) != integrate_map->end()) {
|
||||
IntegrateCreator integrate_creator = (*integrate_map)[style];
|
||||
IntegrateCreator &integrate_creator = (*integrate_map)[style];
|
||||
integrate = integrate_creator(lmp, narg, arg);
|
||||
return;
|
||||
}
|
||||
@ -402,7 +402,7 @@ void Update::new_minimize(char *style, int /* narg */, char ** /* arg */,
|
||||
sflag = 1;
|
||||
std::string estyle = style + std::string("/") + lmp->suffix;
|
||||
if (minimize_map->find(estyle) != minimize_map->end()) {
|
||||
MinimizeCreator minimize_creator = (*minimize_map)[estyle];
|
||||
MinimizeCreator &minimize_creator = (*minimize_map)[estyle];
|
||||
minimize = minimize_creator(lmp);
|
||||
return;
|
||||
}
|
||||
@ -412,7 +412,7 @@ void Update::new_minimize(char *style, int /* narg */, char ** /* arg */,
|
||||
sflag = 2;
|
||||
std::string estyle = style + std::string("/") + lmp->suffix2;
|
||||
if (minimize_map->find(estyle) != minimize_map->end()) {
|
||||
MinimizeCreator minimize_creator = (*minimize_map)[estyle];
|
||||
MinimizeCreator &minimize_creator = (*minimize_map)[estyle];
|
||||
minimize = minimize_creator(lmp);
|
||||
return;
|
||||
}
|
||||
@ -421,7 +421,7 @@ void Update::new_minimize(char *style, int /* narg */, char ** /* arg */,
|
||||
|
||||
sflag = 0;
|
||||
if (minimize_map->find(style) != minimize_map->end()) {
|
||||
MinimizeCreator minimize_creator = (*minimize_map)[style];
|
||||
MinimizeCreator &minimize_creator = (*minimize_map)[style];
|
||||
minimize = minimize_creator(lmp);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user