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

@ -767,11 +767,10 @@ void Set::set(int keyword)
// loop over selected atoms
AtomVecEllipsoid *avec_ellipsoid =
(AtomVecEllipsoid *) atom->style_match("ellipsoid");
AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line");
AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri");
AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body");
auto avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
auto avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
auto avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
auto avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
@ -1055,11 +1054,10 @@ void Set::setrandom(int keyword)
{
int i;
AtomVecEllipsoid *avec_ellipsoid =
(AtomVecEllipsoid *) atom->style_match("ellipsoid");
AtomVecLine *avec_line = (AtomVecLine *) atom->style_match("line");
AtomVecTri *avec_tri = (AtomVecTri *) atom->style_match("tri");
AtomVecBody *avec_body = (AtomVecBody *) atom->style_match("body");
auto avec_ellipsoid = dynamic_cast<AtomVecEllipsoid *>( atom->style_match("ellipsoid"));
auto avec_line = dynamic_cast<AtomVecLine *>( atom->style_match("line"));
auto avec_tri = dynamic_cast<AtomVecTri *>( atom->style_match("tri"));
auto avec_body = dynamic_cast<AtomVecBody *>( atom->style_match("body"));
double **x = atom->x;
int seed = ivalue;