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

@ -75,7 +75,7 @@ void ComputeCOMChunk::init()
int icompute = modify->find_compute(idchunk);
if (icompute < 0)
error->all(FLERR,"Chunk/atom compute does not exist for compute com/chunk");
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
if (strcmp(cchunk->style,"chunk/atom") != 0)
error->all(FLERR,"Compute com/chunk does not use chunk/atom compute");
}
@ -180,7 +180,7 @@ void ComputeCOMChunk::lock_disable()
{
int icompute = modify->find_compute(idchunk);
if (icompute >= 0) {
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
cchunk->lockcount--;
}
}