← Back to team overview

yade-dev team mailing list archive

Re: bool MatchMaker

 

> > I completely forgot about it but changing this should not be a problem.
> > The
> > definition just needs to be changed to:
> > (shared_ptr<MatchMaker>,includeMoment,,,"bool to consider rolling
> > resistance")
> Yes.
> 
> > I could use 0 and 1 instead of False and True in the python script:
> > includeMoment=MatchMaker(matches=((mat1,mat1,1), (mat1,mat2,0))))
> > 
> > In the code we can use something like this to convert the Real to a
> > Boolean:
> > 
> > ((*includeMoment)(mat1->id,mat2->id) != 0)
> > 
> > but this probably brakes the conventional way:
> > includeMoment=True
> > 
> > What do you think?
> 
> I don't see what it would break. Remember to keep the behavior unchanged
> in case includeMoment is none (in c++ the pointer will be null).

Well, ((*includeMoment)(mat1->id,mat2->id) != 0) should work as well for the 
case if includeMoment is none which corresponds to the default (false) at the 
moment. But includeMoment=True or False in the python script should give a 
problem or at least a compiler warning in ((*includeMoment)(mat1->id,mat2->id) 
!= 0), because conversion of bool with int. Don't you think so?

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.




Follow ups

References