← Back to team overview

yade-users team mailing list archive

Re: [Question #556997]: How to compute average contact radius

 

Question #556997 on Yade changed:
https://answers.launchpad.net/yade/+question/556997

    Status: Open => Answered

Jérôme Duriez proposed the following answer:
Hi,

I got somewhat confused in your question between the Python and the C++
parts, but it is clear your (Python ?) commands could be optimized. See
e.g. this more "Pythonic" way to compute the average of local
stiffnesses:

knList = [i.phys.kn for i in O.interactions] # note "for in in O.interactions" which is obviously the best manner to loop over interactions in YADE.. [*]
sum(knList)/len(knList) # returns the average stiffness

This takes an infinitesimal time on my PC, for 85519 interactions.


[*] https://yade-dem.org/doc/yade.wrapper.html#interactioncontainer

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.