Done in r2962. Tested ok for GSTimeStepper, many tests can be removed
when the fix is confirmed.
B.
> ok, so if deleting is not possible, then increment iterator until
> there is something, or there is end.
>
--
___
Bruno Chareyre
Associate Professor
ENSEĀ³ - Grenoble INP
11, rue des
Bruno Chareyre said: (by the date of Tue, 22 Nov 2011 10:34:51 +0100)
> >
> > In fact iterator should not only jump null bodies, but also remove
> > them from container.
> >
> > By doing that, it would break the rule b=bodies[b.id], then it would need
> a redirection that is painful to maintai
>
> In fact iterator should not only jump null bodies, but also remove
> them from container.
>
> By doing that, it would break the rule b=bodies[b.id], then it would need
a redirection that is painful to maintain.
> It is the correct way, because even by C++ ISO specification an
> iterator must
Bruno Chareyre said: (by the date of Mon, 21 Nov 2011 23:21:59 +0100)
>for( ; bi!=biEnd ; ++bi )
>
> >{
> > + if (!*bi) continue;
> >shared_ptr b = *bi;
> >
> > I it not possible that iterator will return empty pointer. If it
> > does, then it's
for( ; bi!=biEnd ; ++bi )
>{
> + if (!*bi) continue;
>shared_ptr b = *bi;
>
> I it not possible that iterator will return empty pointer. If it
> does, then it's a bug in the iterator.
>
>
The iterator is not empty, but the pointer it points to can be.
BodyContainer::iterator biEnd = bodies->end();
for( ; bi!=biEnd ; ++bi )
{
+ if (!*bi) continue;
shared_ptr b = *bi;
I it not possible that iterator will return empty pointer. If it
does, then it's a bug in the iterator.
It doesn't matter if
There are so many places where this should be added that we should find
another way.
For instance, the ++ operator of body's itarators could include the check.
It would automaticaly make future code removal safe.
Very few developers would imagine that iterating on bodies can return no
body.
B
p.s
There are so many places where this should be added that we should find
another way.
For instance, the ++ operator of body's itarators could include the check.
It would automaticaly make future code removal safe.
Very few developers would imagine that iterating on bodies can return no
body.
B
On
revno: 2961
fixes bug: https://launchpad.net/bugs/891540
committer: Anton Gladky
branch nick: yade
timestamp: Fri 2011-11-18 13:25:48 +0100
message:
Add check on body existance in GlobalStiffnessTimeStepper. Fixes LP:891540
modified:
9 matches
Mail list logo