← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2344: - miniEigen : memory leak source suspected (FIXME added)

 


   - CohFrictLaw : Eigen is returning nan quaternions after trivial operations, it is workarounded in the law.
Raising attention on this fix, as other functors could have the same problem.

Take quaternions q1init,q1, q2init,q2, with q1 (resp. q2) close to q1init (resp. q2init). In that case, AngleAxisr(q1*q1init.conjugate*q2init*q2.conjugate) will sometimes return nan rotation while it should be null.

The fix in cohesiveFrictionalContactLaw.cpp:133 is :
if (isnan(aa.angle())) aa.angle()=0;

Bruno

p.s. This is the sort a jokes I was expecting from eigen move, when I was asking for strong testing... It took me 2 hours to find the problem. Who knows if there are other surprises left?

p.s.2 : There is I think a potential memory leak with functions below, are they used?

+//FIXME : risk of memory leak with these "new"?
 static Quaternionr* Quaternionr_fromAxisAngle(const Vector3r&  axis, const Real angle){ return new Quaternionr(AngleAxisr(angle,axis)); }
 static Quaternionr* Quaternionr_fromAngleAxis(const Real angle, const Vector3r&  axis){ return new Quaternionr(AngleAxisr(angle,axis)); }




Follow ups

References