← Back to team overview

yade-users team mailing list archive

Re: [Question #676284]: avg Num Interactions

 

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

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

This error meant that your call to avgNumInteractions() triggered a call
to bodyNumInteractionsHistogram() [1] with a Python list as an argument,
whereas the latter bodyNumInteractionsHistogram() (a Python function
inherited from C++ world thanks to boost::python) wants Python tuples as
arguments [2]. And Python list and Python tuples are different things
(but do not ask me why ;-) )


In more details bodyNumInteractionsHistogram had actually been called with the output of aabbExtrema() as an argument [1]. And, because of recent changes in the C++ world [3] (and because of the exact manner the C++ and the Python worlds are connected), the return type of aabbExtrema() in the Python world is now a list, whereas it used to be a tuple.


Hence the error, as my 1st paragraph said.


I just committed changes [4] that solve the bug, as well as the other following example maybe closer to your needs:

#########
O.bodies.append(sphere((0,0,0),1,dynamic=False))
O.bodies.append(sphere((0,0,1.9),1,dynamic=False))
O.bodies.append(sphere((0.7,0,0.7),1,dynamic=False))
# 3 spheres example to avoid the "nan" case in avgNumInteractions(skipFree=True)

O.step()

print ''
print 'Avg Num Interactions', avgNumInteractions(cutoff=0.0,skipFree=True,considerClumps=False)
######### (This could have been your MWE ;-) )


When and how these changes will land in your computer depend on your use of YADE. Thanks for reporting anyway,


Jérôme


[1] See File "/usr/lib/x86_64-linux-gnu/yadedaily/py/yade/utils.py", line 438, in avgNumInteractions, the command "nums,counts=bodyNumInteractionsHistogram(aabbExtrema(cutoff)"
[2] https://github.com/yade/trunk/blob/c14fd94f6be04f24e45daff0eed6ae6b8e737d4f/py/_utils.hpp#L29
[3] https://github.com/yade/trunk/commit/1db13fb1183b9e294dc9761da76cfa4fc2791cc1
[4] https://github.com/yade/trunk/commit/7c60d78bd9badfa174fb79a82af7b119abf81d5d

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