← Back to team overview

yade-dev team mailing list archive

Re: Another python software

 

> Although the FORTRAN code/software/library is my first choice, I am
> also planning to try this python opensource code:
> 
> http://abel.ee.ucla.edu/cvxopt/examples/other/embed_cvxopt.html
> 
> There are examples how to link python to C.  But how do I do it for
> YADE?

The simplest is to install python-cvxopt package and use it from your
python scripts.

Calling python code from c++ is (in yade's context) discouraged, as you
want to have only computationally demanding parts in c++, where calling
python would harm performance (except for various hooks, which are
called only rarely). There are still several options:

1. use PeriodicPythonRunner engine to call any python function you
define, which will do what you need in pure python.

2. use pure python/c API (whic his shown in the example you referenced)
or boost::python to run python code. Have a look at PeriodicPythonRunner
how it does that for simple case, where you don't need to pass c++
objects to the function called.

HTH, Vaclav





Follow ups

References