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

@ -62,11 +62,11 @@ void FixLineForce::setup(int vflag)
if (utils::strmatch(update->integrate_style,"^verlet"))
post_force(vflag);
else {
int nlevels_respa = ((Respa *) update->integrate)->nlevels;
int nlevels_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels;
for (int ilevel = 0; ilevel < nlevels_respa; ilevel++) {
((Respa *) update->integrate)->copy_flevel_f(ilevel);
(dynamic_cast<Respa *>( update->integrate))->copy_flevel_f(ilevel);
post_force_respa(vflag,ilevel,0);
((Respa *) update->integrate)->copy_f_flevel(ilevel);
(dynamic_cast<Respa *>( update->integrate))->copy_f_flevel(ilevel);
}
}
}