← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2962: - make body iterators jump empty slots, as suggested and discussed here: http://www.mail-archive....

 

FOREACH has to work with an iterator fix. Of course.

Anton, do you agree that we cannot fix a bug in hundred places in the
code, everywhere the container is used?

This implies that the container has a bug: it does not handle
deleted bodies correctly.

The simplest approach is to modify the iterator. If iterator is
working according to specification, (no matter how convoluted code it
has) it will never break FOREACH. I am not sure if Bruno's change
follows that. For start it seems to look good.

A more complicated approach is to make special handling in container
when a body is deleted. After all a C++ ISO container has method
erase() in it's specification. So It would be a matter of
implementing it correctly. As Bruno pointed that will need some more
thinking, to handle redirections.

Do you see some other solution?

best regards
Janek Kozicki

Anton Gladky said:     (by the date of Wed, 23 Nov 2011 14:53:18 +0100)

> Bruno, the bug #891540 is again here.
> Please, revert 2 last commits and we will think about better fix, if
> it is really necessary.
> 
> Anton
> 
> 
> 
> 
> On Wed, Nov 23, 2011 at 1:43 PM, Anton Gladky <gladky.anton@xxxxxxxxx> wrote:
> > Hi, Bruno,
> >
> > I am not quite agree with this commit. It looks like a hack, sorry.
> > Also we have FOREACH statement in a lot of places iterating . I am not
> > sure your fix will work correctly with them.
> >
> > Anton
> >
> >
> >
> >
> > On Wed, Nov 23, 2011 at 1:11 PM,  <noreply@xxxxxxxxxxxxx> wrote:
> >> ------------------------------------------------------------
> >> revno: 2962
> >> committer: Bruno Chareyre <bruno.chareyre@xxxxxxxxxxx>
> >> branch nick: trunk
> >> timestamp: Wed 2011-11-23 13:05:49 +0100
> >> message:
> >>  - make body iterators jump empty slots, as suggested and discussed here: http://www.mail-archive.com/yade-dev@xxxxxxxxxxxxxxxxxxx/msg07406.html
> >>  - revert the (now useless) fix of r2961, similar tests can be removed in many places after the change in pointer logic is well tested.
> >>  - remove a script, as agreed by Christian (https://answers.launchpad.net/yade/+question/178830)
> >> removed:
> >>  examples/generate-psd-with-poro-example.py
> >> modified:
> >>  core/BodyContainer.hpp
> >>  pkg/dem/GlobalStiffnessTimeStepper.cpp
> >
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp
> 


-- 
Janek Kozicki                               http://janek.kozicki.pl/  |


Follow ups

References