lundi 24 octobre 2016

Importing C++ function with vectors as arguments in Python

I am trying to import a C++ function in python. I know there are already some post about this. However, I haven't found anything about functions which take vectors as arguments. My C++ function is something like this:

 double many_body_pot(std::vector< std::vector<double> > &par, std::vector< std::vector<double> > &geometry, double x, double y, double z) 
 {
 ...
 }

As you can see It takes 2 vectors and 3 doubles as arguments and returns a double as result. I have also read this post about extending Python with C++:

http://ift.tt/2e3KpLy

But I am still completely lost, the only thing I got clear is that I have to include:

  #include <Python.h>

In my C++ code. So want I want is to import this function in pyhon and use lists or arrays as arguments for the C++ vectors. How can this be done?

Thank you

Aucun commentaire:

Enregistrer un commentaire