use references when looping over fixes from list
This commit is contained in:
@ -481,12 +481,12 @@ void PairGranHookeHistory::init_style()
|
||||
int itype;
|
||||
for (i = 1; i <= atom->ntypes; i++) {
|
||||
onerad_dynamic[i] = onerad_frozen[i] = 0.0;
|
||||
for (auto ipour : pours) {
|
||||
for (auto &ipour : pours) {
|
||||
itype = i;
|
||||
double maxrad = *((double *) ipour->extract("radius", itype));
|
||||
if (maxrad > 0.0) onerad_dynamic[i] = maxrad;
|
||||
}
|
||||
for (auto idep : deps) {
|
||||
for (auto &idep : deps) {
|
||||
itype = i;
|
||||
double maxrad = *((double *) idep->extract("radius", itype));
|
||||
if (maxrad > 0.0) onerad_dynamic[i] = maxrad;
|
||||
|
||||
@ -1160,12 +1160,12 @@ void PairGranular::init_style()
|
||||
int itype;
|
||||
for (i = 1; i <= atom->ntypes; i++) {
|
||||
onerad_dynamic[i] = onerad_frozen[i] = 0.0;
|
||||
for (auto ipour : pours) {
|
||||
for (auto &ipour : pours) {
|
||||
itype = i;
|
||||
double maxrad = *((double *) ipour->extract("radius", itype));
|
||||
if (maxrad > 0.0) onerad_dynamic[i] = maxrad;
|
||||
}
|
||||
for (auto idep : deps) {
|
||||
for (auto &idep : deps) {
|
||||
itype = i;
|
||||
double maxrad = *((double *) idep->extract("radius", itype));
|
||||
if (maxrad > 0.0) onerad_dynamic[i] = maxrad;
|
||||
|
||||
@ -202,7 +202,7 @@ void Comm::init()
|
||||
if (ghost_velocity) size_border += atom->avec->size_velocity;
|
||||
|
||||
const auto &fix_list = modify->get_fix_list();
|
||||
for (auto fix : fix_list)
|
||||
for (const auto &fix : fix_list)
|
||||
size_border += fix->comm_border;
|
||||
|
||||
// per-atom limits for communication
|
||||
@ -218,7 +218,7 @@ void Comm::init()
|
||||
if (force->pair) maxforward = MAX(maxforward,force->pair->comm_forward);
|
||||
if (force->pair) maxreverse = MAX(maxreverse,force->pair->comm_reverse);
|
||||
|
||||
for (auto fix : fix_list) {
|
||||
for (const auto &fix : fix_list) {
|
||||
maxforward = MAX(maxforward,fix->comm_forward);
|
||||
maxreverse = MAX(maxreverse,fix->comm_reverse);
|
||||
}
|
||||
@ -243,7 +243,7 @@ void Comm::init()
|
||||
maxexchange_atom = atom->avec->maxexchange;
|
||||
|
||||
maxexchange_fix_dynamic = 0;
|
||||
for (auto fix : fix_list)
|
||||
for (const auto &fix : fix_list)
|
||||
if (fix->maxexchange_dynamic) maxexchange_fix_dynamic = 1;
|
||||
|
||||
if ((mode == Comm::MULTI) && (neighbor->style != Neighbor::MULTI))
|
||||
@ -266,7 +266,7 @@ void Comm::init()
|
||||
void Comm::init_exchange()
|
||||
{
|
||||
maxexchange_fix = 0;
|
||||
for (auto fix : modify->get_fix_list())
|
||||
for (const auto &fix : modify->get_fix_list())
|
||||
maxexchange_fix += fix->maxexchange;
|
||||
|
||||
maxexchange = maxexchange_atom + maxexchange_fix;
|
||||
|
||||
@ -105,7 +105,7 @@ void Group::assign(int narg, char **arg)
|
||||
int igroup = find(arg[0]);
|
||||
if (igroup == -1) error->all(FLERR,"Could not find group delete group ID");
|
||||
if (igroup == 0) error->all(FLERR,"Cannot delete group all");
|
||||
for (auto fix : modify->get_fix_list())
|
||||
for (const auto &fix : modify->get_fix_list())
|
||||
if (fix->igroup == igroup)
|
||||
error->all(FLERR,"Cannot delete group currently used by a fix");
|
||||
for (i = 0; i < modify->ncompute; i++)
|
||||
|
||||
@ -569,7 +569,7 @@ void Info::command(int narg, char **arg)
|
||||
int i = 0;
|
||||
char **names = group->names;
|
||||
fputs("\nCompute information:\n",out);
|
||||
for (auto compute : modify->get_compute_list())
|
||||
for (const auto &compute : modify->get_compute_list())
|
||||
fmt::print(out,"Compute[{:3d}]: {:16} style = {:16} group = {}\n", i++,
|
||||
std::string(compute->id)+',',std::string(compute->style)+',',
|
||||
names[compute->igroup]);
|
||||
@ -598,7 +598,7 @@ void Info::command(int narg, char **arg)
|
||||
int i = 0;
|
||||
char **names = group->names;
|
||||
fputs("\nFix information:\n",out);
|
||||
for (auto fix : modify->get_fix_list())
|
||||
for (const auto &fix : modify->get_fix_list())
|
||||
fmt::print(out, "Fix[{:3d}]: {:16} style = {:16} group = {}\n",i++,
|
||||
std::string(fix->id)+',',std::string(fix->style)+',',names[fix->igroup]);
|
||||
}
|
||||
@ -906,7 +906,7 @@ bool Info::is_defined(const char *category, const char *name)
|
||||
return true;
|
||||
}
|
||||
} else if (strcmp(category,"fix") == 0) {
|
||||
for (auto fix : modify->get_fix_list()) {
|
||||
for (const auto &fix : modify->get_fix_list()) {
|
||||
if (strcmp(fix->id,name) == 0)
|
||||
return true;
|
||||
}
|
||||
@ -1011,7 +1011,7 @@ static std::vector<std::string> get_style_names(std::map<std::string, ValueType>
|
||||
std::vector<std::string> names;
|
||||
|
||||
names.reserve(styles->size());
|
||||
for (auto const& kv : *styles) {
|
||||
for (auto const &kv : *styles) {
|
||||
// skip "secret" styles
|
||||
if (isupper(kv.first[0])) continue;
|
||||
names.push_back(kv.first);
|
||||
|
||||
@ -53,7 +53,7 @@ void Verlet::init()
|
||||
// warn if no fixes doing time integration
|
||||
|
||||
bool do_time_integrate = false;
|
||||
for (auto fix : modify->get_fix_list())
|
||||
for (const auto &fix : modify->get_fix_list())
|
||||
if (fix->time_integrate) do_time_integrate;
|
||||
|
||||
if (!do_time_integrate && (comm->me == 0))
|
||||
|
||||
@ -213,7 +213,7 @@ void WriteData::write(const std::string &file)
|
||||
// extra sections managed by fixes
|
||||
|
||||
if (fixflag)
|
||||
for (auto ifix : modify->get_fix_list())
|
||||
for (auto &ifix : modify->get_fix_list())
|
||||
if (ifix->wd_section)
|
||||
for (int m = 0; m < ifix->wd_section; m++) fix(ifix,m);
|
||||
|
||||
@ -267,7 +267,7 @@ void WriteData::header()
|
||||
// fix info
|
||||
|
||||
if (fixflag)
|
||||
for (auto ifix : modify->get_fix_list())
|
||||
for (auto &ifix : modify->get_fix_list())
|
||||
if (ifix->wd_header)
|
||||
for (int m = 0; m < ifix->wd_header; m++)
|
||||
ifix->write_data_header(fp,m);
|
||||
|
||||
@ -413,7 +413,7 @@ void WriteRestart::write(const std::string &file)
|
||||
|
||||
// invoke any fixes that write their own restart file
|
||||
|
||||
for (auto fix : modify->get_fix_list())
|
||||
for (auto &fix : modify->get_fix_list())
|
||||
if (fix->restart_file)
|
||||
fix->write_restart_file(file.c_str());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user