← Back to team overview

yade-users team mailing list archive

[Question #703098]: Trying to pass on property from python to shape

 

New question #703098 on Yade:
https://answers.launchpad.net/yade/+question/703098

Hi all,

I wasn't sure if it was best to ask this here or on the yade-dev launchpad. Anyway, the problem is the following:

I have given my  level set particles two additional properties by modifying LevelSet.hpp. I found a way to use these properties to speed up the calculations for the LS-DEM method I'm working on. I now want to be able to define these properties in the input python scripts for YADE.

I would like to do this by, for example, saying the following when defining a new level set body:
levelSetBody(""superellipsoid",
                         extents=(rMaxVal,rMinVal,rMinVal),
                         epsilons=(0.2,0.2),
                         spacing=0.01,
                         useProperty=True,
                         property=(1,3,3))


Within YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY, I have added:

((bool, useProperty, false,,"Flag whether to use property to speed up calculations."))
((Vector3r,property,,,"The property to use to speed up calculations."))

Within the file utils.py the function levelSetBody:

I added the arguments
`useProperty=False,property=Vector3.Zero` to the function
Inside the function, I added near the end:
b.shape.hasProperty = hasProperty
if hasProperty:
     b.shape.property = property

This compiles successfully and runs without any error messages. However, the property turns out not to be defined when I run a simulation. How do I adjust my code such that the properties are correctly forwarded from Python to C++ level?

I already looked whether I had to add something in _utils.cpp, but can't find the problem.

Kind regards,
Danny 


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