← Back to team overview

yade-dev team mailing list archive

static_cast in GSTS

 

Hi all,

just a couple of clarifications on the programming side and in particular on
one line I found in the GSTS code.
>From line 108 in the GSTS.cpp file we find

NormShearPhys*
phys=YADE_CAST<NormShearPhys*>(contact->interactionPhysics.get());
assert(phys);
// all we need for getting stiffness
Vector3r& normal=geom->normal; Real& kn=phys->kn; Real& ks=phys->ks; Real&
radius1=geom->refR1; Real& radius2=geom->refR2;
Real fn = (static_cast<NormShearPhys *>
(contact->interactionPhysics.get()))->normalForce.squaredNorm();
if (fn==0) continue;//Is it a problem with some laws? I still don't see why.

Two questions:
1) Why are we here casting to the class NormShearPhys instead of FrictPhys
class?
2) Why do we need to continue if fn==0?

Thanks a lot,
Chiara

Follow ups