> I've got an other question about boost::python and dynamic libraries
> widely used in yade.
> I would like to expose the class SpherePadder (and maybe TetraMesh) to
> python.
> I think that it could be possible (?) to add something like:
>
> class_<SpherePadder>()
> .def("pad5",&SpherePadder::pad5)
> ...
> ;
>
> in the BOOST_PYTHON_MODULE(_utils). But, what about the compilation
> of SpherePadder in this case?
> Must I create a libSpherePadder.so with REGISTER_CLASS_AND_BASE?
1. You should just add python interface to SpherePadder itself, instead
of putting that to _utils: (a) utils has already way too much things
inside, (b) SpherePadder depends on CGAL and yade must compile without
CGAL as well (for legal reasons).
2. No need to use REGISTER_CLASS_AND_BASE, unless you want yade to know
about inheritance of your class etc. That is needed for serialization,
for instance, but in this case I don't see the point.
3. SpherePadder should be added to scons (as an optional part), since it
will also install the python module tothe appropriate place.
For yade classes I (ab)use the serialization system to get access to
attributes via the ['attribute'] operator, but in your case you can just
wrap the variables inside SpherePadder by hand.
sp=SpherePadder()
sp.zmin=-10
sp.gap_max=.01
sp.pack5()
Then you need to think how to pass the result back to python. For
pack5(), you could for example return list of (x,y,z,r) tuples or
something similar, which could be used in turn to create spheres.
HTH, Vaclav
_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help : https://help.launchpad.net/ListHelp
_______________________________________________
yade-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yade-dev