use dynamic cast instead of c-style cast when casting from base type to derived class
This commit is contained in:
@ -74,7 +74,7 @@ void ComputeInertiaChunk::init()
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Chunk/atom compute does not exist for "
|
||||
"compute inertia/chunk");
|
||||
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
|
||||
cchunk = dynamic_cast<ComputeChunkAtom *>( modify->compute[icompute]);
|
||||
if (strcmp(cchunk->style,"chunk/atom") != 0)
|
||||
error->all(FLERR,"Compute inertia/chunk does not use chunk/atom compute");
|
||||
}
|
||||
@ -189,7 +189,7 @@ void ComputeInertiaChunk::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--;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user