yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #10460
Re: Why Ip2 functors must be symmetric?
Hi Klaus,
I think non-symmetric functors are rarely necessary since most
combinations can be dealt with via inheritance (e.g. Frict vs CohFrict
is interpreted as Frict vs. Frict since CohFrict inherits from Frict).
However, I am like you, I don't see the reason why it is asserted
symmetric. I suggest to try your idea after removing this constraint and
see if it works as accepted.
Bruno
On 16/02/14 02:19, Klaus Thoeni wrote:
> Hi guys
>
> is there I reason why we only have symmetric Ip2 functors? I recently committed a contact law with non-symmetric Ip2 functor (Ip2_FrictMat_FrictViscoMat_FrictViscoPhys) but at the moment it is not working as expected. It turns out that the reason is in InteractionLoop.cpp line 122 and following (and maybe somewhere else too):
>
> // IPhysDispatcher
> if(!I->functorCache.phys){
> I->functorCache.phys=physDispatcher->getFunctor2D(b1->material,b2->material,swap);
> assert(!swap); // InteractionPhysicsEngineUnits are symmetric
> }
>
> It assumes swap is always false. Is there a reason why we are not doing it the same way as for the Ig2 functors (see lines 90-104)? Well, if there is no reason I would like to change it to something like this:
>
> bool swap=false;
> // IPhysDispatcher
> if(!I->functorCache.phys){
> I->functorCache.phys=physDispatcher->getFunctor2D(b1->material,b2->material,swap);
> }
> if(swap){I->swapOrder();}
> // body pointers must be updated, in case we swapped
> const shared_ptr<Body>& bb1=swap?b2:b1;
> const shared_ptr<Body>& bb2=swap?b1:b2;
>
> What do you think? Would this change work or am I missing something?
>
> Further, I can see that in the Ig2 functors we have a goReverse. Is this ever called? A quick grep did not show any calls but only definitions. Not sure, but is this something we can get rid of?
>
> Cheers,
> Klaus
>
> _______________________________________________
> 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
>
>
>
Follow ups
References