← Back to team overview

yade-dev team mailing list archive

Re: twist plastic moment

 


can I use the MatchMaker to get the harm average of alphas parameter? I am not sure to understand how it works.
Cheers, Chiara
Hi, yes you can... You will turn (if we speak about Ip2_2xCohFrictMat_CohFrictPhys) alphaKr, alphaKts into MatchMaker objects, which will by default return constant value (so that older code behaves the same), something like (see also Ip2_FrictMat_FrictMat_FrictPhys):

((shared_ptr<MatchMaker>,alphaKr,new MatchMaker(2.0),,"docs"))

where the "new MatchMaker(2.0)" will construct new object always returning 2.0 [note: I will be adding this ctor, since you gave me the idea, now, so you will need to update]. In the code then, you will get the value as (*alphaKr)(mat1->id,mat2->id,mat1->alphaKr,mat2->alphaKr) (alphaKr is a pointer, so once needs the *). To use harmonic average between mat1->alphaKr and mat2->alphaKr (of which value are ignored the MatchMaker returns a const value), you do in the python script

Ip2_2xCohFrictMat_CohFrictPhys(...,alphaKr=MatchMaker(fallback='harmAvg'),...)

and that's it. One can still set the constant with

  Ip2_2xCohFrictMat_CohFrictPhys(...,alphaKr=2.0)

There is one margin case that you must handle in the c++ code, and that is if the shared_ptr<MatchMaker> is NULL pointer (is someone says in python alphaKr=None), then throw exception or something similar.

Cheers, v.



Follow ups

References