← Back to team overview

yade-dev team mailing list archive

Re: goReverse

 

Václav Šmilauer said:     (by the date of Thu, 02 Oct 2008 12:31:55 +0200)

> Hi (Janek),
> 
> do you think it would be possible for the 2d metaengines to not accept
> both combinations of types, but only one? To put it straight: facet
> (/box etc) and sphere can create two interactions, with
> 
>  1. id1=Facet, id2=Sphere
>  2. id1=Sphere, id2=Facet
> 
> For the case 1., IFacet2IS4SCG::go is called, which is just fine.
> However, for the second case, we call goReverse, which in turn calls
> ::go and then swaps a some variables. The swapping happens at _every
> iteration_.
> 
> My point, therefore, would be to mandate type order for 2d metaengines
> -- the collider could, when creating new the interaction, swap ids
> easily, so that they would be always in the order expected by the
> metaengine. Or - perhaps better, since collider knows nothing about
> types, swap them in the MetaEngine
> 
> I am currently experimenting with swapping the order in the
> EngineUnit::goReverse, I will see what the results are.

It is possible of course. But I don't think it will be useful.
Swapping is just swapping - it doesn't matter where you do it -
inside ::goReverse() or inside MetaEngine, it's just the same number
of computer assembly instructions.

That will reduce the amount of swapping, because it will be
done only when interaction is created. I feel that the speed
improvement will be < 0.01% and that you are wasting your time with
that. Remember that it's swapping only pointers, so it's roughly
equivalent of std::swap(void*,void*).

If you will achieve any better speed improvement I will be really
surprised.

-- 
Janek Kozicki                                                         |



Follow ups

References