use dynamic cast instead of c-style cast when casting from base type to derived class

This commit is contained in:
Axel Kohlmeyer
2022-04-10 18:18:06 -04:00
parent 39b316729b
commit 200b4f13c7
262 changed files with 669 additions and 676 deletions

View File

@ -355,7 +355,7 @@ void Balance::command(int narg, char **arg)
// set disable = 0, so weights migrate with atoms for imbfinal calculation
if (domain->triclinic) domain->x2lamda(atom->nlocal);
Irregular *irregular = new Irregular(lmp);
auto irregular = new Irregular(lmp);
if (wtflag) fixstore->disable = 0;
if (style == BISECTION) irregular->migrate_atoms(1,1,rcb->sendproc);
else irregular->migrate_atoms(1);
@ -496,8 +496,8 @@ void Balance::weight_storage(char *prefix)
if (prefix) cmd = prefix;
cmd += "IMBALANCE_WEIGHTS";
fixstore = (FixStore *) modify->get_fix_by_id(cmd);
if (!fixstore) fixstore = (FixStore *) modify->add_fix(cmd + " all STORE peratom 0 1");
fixstore = dynamic_cast<FixStore *>( modify->get_fix_by_id(cmd));
if (!fixstore) fixstore = dynamic_cast<FixStore *>( modify->add_fix(cmd + " all STORE peratom 0 1"));
// do not carry weights with atoms during normal atom migration