← Back to team overview

yade-dev team mailing list archive

Re: static_cast in GSTS

 

> 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? 
That is to make code more generic. Only normal and shear
forces/stiffnesses are needed in the computation and that is already
provided by NormShearPhys. FrictPhys is derived from NormShearPhys, but
data added in FrictPhys are not needed.

In this case, e.g. CpmPhys will work with GSTS (although I don't use
it), since it also derives from NormShearPhys, but not from FrictPhys.

> 2) Why do we need to continue if fn==0?
IIRC Bruno told me that was to avoid contacts that transmit no force,
even if they have non-zero nominal stiffness. Exact zero will be there
for interactions that really had no force at all.

I am not completely persuaded on that, since most likely contacts with
exactly zero force will be already erased. Perhaps now it has only
historical interest now?

HTH, Vaclav







Follow ups

References