yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #08618
Re: [Yade-users] [Question #197438]: No interactions after erasing body
On 21/05/12 22:20, Anton Gladky wrote:
> 2012/5/21 Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>:
>> It will, because the collider calls boundDispatcher in action().
>>
>> Bruno
>>
> I understand, that new bounds are creating only, when the size of
> bodyContainer is changed, right?
>
Well, it depends what you call bound. ;)
body->bound is created here:
https://github.com/yade/trunk/blob/master/pkg/common/Dispatching.cpp#L41
ISCollider holds a copy of it in a different form. This copy is updated
here:
https://github.com/yade/trunk/blob/master/pkg/common/InsertionSortCollider.cpp#L193
The line you mention is only updating the size of copy containers.
If body ID is deleted then replaced by a new one, the bound dispatcher
will create a new bound, but the collider will still have a copy of
values from the old one.
Fortunately it is harmless, since the collider will update the values
based on current body->bound before doing the sort.
It will be seen by the collider as if body ID was not deleted but,
instead, moved to a different place.
The only reason why it didn't work in LP:1001194 (if I don't miss
something) is that bounds were not immediatly updated (Verlet condition).
I still see a possible bug if we use this property: if a new body is
created in the same place (approximately) as the old one, then the
collider will not detect any move in the sort phase and no interactions
will be created. It can be fixed, but I have to think a bit more...
Btw, it seems to me there is a problem here:
https://github.com/yade/trunk/blob/master/pkg/common/InsertionSortCollider.cpp#L125
If 2*nBodies-BBsize is more than 0 (i.e. precisely what happens if size
is incremented by 1), then we are pushing to a a vector that has not
been cleared. I wonder how this apparently work.
I must have missed something... Did you try your last change in debug
build (then this problem, if real, would be detected by a few asserts)?
Bruno
References