yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #09852
Re: bool MatchMaker
> Well, ((*includeMoment)(mat1->id,mat2->id) != 0) should work as well for the
> case if includeMoment is none
No, I guess it will crash (dereferencing null pointer). This would be ok:
if (includeMoment && (*includeMoment)(mat1->id,mat2->id) != 0))
> which corresponds to the default (false) at the
> moment. But includeMoment=True or False in the python script should give a
> problem
Ah, that is right. It will be a bit painfull to define a MatchMaker when
you just want it true everywhere...
> or at least a compiler warning in ((*includeMoment)(mat1->id,mat2->id)
> != 0), because conversion of bool with int. Don't you think so?
Warnings can be removed by explicit conversion :
if (includeMoment && bool((*includeMoment)(mat1->id,mat2->id)) != 0))
> Another option is to make MatchMakers for krot and ktwist and set them to 0 so
> the moment will be 0. It might be an easier solution but not the most efficient.
The best thing I can imagine is to add a MatchMaker that would not
replace includeMoment, let's call it momentMatch here.
if (includeMoment && (!momentMatch || (*momentMatch)(mat1,mat2)){
// ... the moment code
}
B
>
>
>
> _______________________________________________
> 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
>
>
>
--
_______________
Bruno Chareyre
Associate Professor
ENSE³ - Grenoble INP
Lab. 3SR
BP 53
38041 Grenoble cedex 9
Tél : +33 4 56 52 86 21
Fax : +33 4 76 82 70 43
________________
Follow ups
References