← Back to team overview

yade-dev team mailing list archive

Re: [Bug 1229783] Re: Loading clumps takes too much time

 

>
>
>> Thanks Christian for comments.
>> Is that possible to use the same method as before, where the inertia was
>> just the total inertia of members? We should really keep that option
>> even if the default is now to compute inertia automaticaly. Reasons are
>> that sometimes we want something fast and we don't care about physical
>> correctness, or someone may want to define inertia his own way.
>> It is not nice if appendClumped() is forcing a round of
>> updateProperties() when overlaps are present.
>
> it already would have been implemented this way, but c++ is not my
> language ...

Ok, let's solve the default argument passing through python wrapping
(below), then we can discuss this point more easily.

>
>
>
> 1.)
> .def("getRoundness",&pyBodyContainer::getRoundness,(python::arg("excludeList")=python::list),"Returns
> ...
>
> -> /home/me/YADE/trunk/py/wrapper/yadeWrapper.cpp:868: error: expected
> primary-expression before ')' token

The default argument should be an instance of the argument type. For
instance, this is ok:
python::arg("param")=double(2)
// or implicitely
python::arg("param")=2

This will not work however, and it corresponds to what you typed:
python::arg("param")=double

Adding empty brackets should call the default constructor and return an
empty list:
(python::arg("excludeList")=python::list())

For clumps it will be easier, anyway, since you only have a bool and a
int to pass.

>
> 2.)
> .def("getRoundness",&pyBodyContainer::getRoundness,(python::arg("excludeList")),"Returns
> ...
>
> -> compilation ok, but running replaceByClumps-example.py said:
>
> ArgumentError: Python argument types in
>     BodyContainer.getRoundness(BodyContainer)
> did not match C++ signature:
>     getRoundness(pyBodyContainer {lvalue}, boost::python::list
> excludeList)
>
> while using getRoundness() instead of getRoundness([])
>
Yes, this is because if you don't define a default value of an argument,
then the user has to define something. In fact, what you do here has the
same result as not declaring the argument. This will have the same result:
.def("getRoundness",&pyBodyContainer::getRoundness,"Returns ...

Bruno




Follow ups

References