← Back to team overview

yade-dev team mailing list archive

Re: ScGeom6D crasher

 

On 26 October 2010 16:40, Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx> wrote:

> Now the question is : why does it work?!!
>
Hi Bruno,
the problem arose because I was including the moment law in Hertz-Mindlin
but somehow I was getting segmentation fault and in debug mode I realized it
was not creating an ScGeom instance rather than an ScGeom6D one. Thank you
in advance for solving the problem.

Chiara


> Bruno
>
>
>
>
> On 26/10/10 17:26, Chiara + Václav wrote:
>
>> Hi Bruno,
>>
>> we were just reading the ScGeom6D code and there a serious bug. Suppose
>> a potential interaction of 2 spheres; Ig2_Sphere_Sphere_ScGeom6D::go
>> calls Ig2_Sphere_Sphere_ScGeom::go, which, if it succeeds, creates a new
>> ScGeom object and assigns it to I->geom. Then the execution goes back to
>> Ig2_Sphere_Sphere_ScGeom6D::go, which will cast I->geom to ScGeom6D!
>> This is not a valid operation and if you run in debug mode, the
>> YADE_PTR_CAST will return NULL pointer. (
>>
>> If you want to avoid code duplication, the common function must know
>> what IGeom object to create, via a function argument; and since one
>> cannot change the signature of ::go (otherwise the virtual call would
>> call a different function), the common functionality must be in a
>> separate function called from both ::go functors, but with different
>> parameters.
>>
>> You can have a look at Ig2_Sphere_Sphere_L3Geom and
>> Ig2_Sphere_Sphere_L6Geom for inspiration.
>>
>> Cheers, cv
>>
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
>> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>>
>
>
> --
> _______________
> Bruno Chareyre
> Associate Professor
> ENSE³ - Grenoble INP
> Lab. 3SR
> BP 53 - 38041, Grenoble cedex 9 - France
> Tél : +33 4 56 52 86 21
> Fax : +33 4 76 82 70 43
> ________________
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References