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

@ -89,7 +89,7 @@ void Hyper::command(int narg, char **arg)
} else {
int ifix = modify->find_fix(id_fix);
if (ifix < 0) error->all(FLERR,"Could not find fix ID for hyper");
fix_hyper = (FixHyper *) modify->fix[ifix];
fix_hyper = dynamic_cast<FixHyper *>( modify->fix[ifix]);
int dim;
int *hyperflag = (int *) fix_hyper->extract("hyperflag",dim);
if (hyperflag == nullptr || *hyperflag == 0)
@ -101,7 +101,7 @@ void Hyper::command(int narg, char **arg)
// create FixEventHyper class to store event and pre-quench states
fix_event = (FixEventHyper *) modify->add_fix("hyper_event all EVENT/HYPER");
fix_event = dynamic_cast<FixEventHyper *>( modify->add_fix("hyper_event all EVENT/HYPER"));
// create Finish for timing output
@ -112,7 +112,7 @@ void Hyper::command(int narg, char **arg)
int icompute = modify->find_compute(id_compute);
if (icompute < 0) error->all(FLERR,"Could not find compute ID for hyper");
compute_event = (ComputeEventDisplace *) modify->compute[icompute];
compute_event = dynamic_cast<ComputeEventDisplace *>( modify->compute[icompute]);
compute_event->reset_extra_compute_fix("hyper_event");
// reset reneighboring criteria since will perform minimizations