|
From: Xavier G. <gn...@ob...> - 2006-12-19 13:16:32
|
Christopher Barker wrote: > yardbird wrote: > =20 >> On Saturday 16 December 2006 19:42, Xavier Gnata wrote: >> =20 > > =20 >>> Each time I'm working on C++ codes using vector or valarray, I would >>> like to be able to plot them. >>> =20 > > =20 >> you should really check out the Boost::Python libraries. They allow yo= u, among=20 >> other things, to expose your C++ container classes as python objects. = I'm=20 >> using them heavily in my project and I'm very satisfied. >> =20 > > What this means is that you'd be using python to drive your C++ code,=20 > rather than using C++ code to drive a python/mpl code. In addition to=20 > Boost::Python, there are some other options to consider: > > pyrex, Cxx, SWIG. > > The other option is to use your C++ code to drive Python. This can be=20 > done by embedding a python interpreter in your C++ app. See the=20 > odfficial pyhton docs, and lots of other stuff online. > > You also might want to check out Elmer: > > http://elmer.sourceforge.net/ > > I've never used it, but it looks pretty cool. It's a tool that provides= =20 > the infrastructure for calling python from C/C++. > > Honestly, though, I'd go with the first approach -- drive your C++ code= =20 > from Python -- I think that in addition to making it easy to plot=20 > results, etc, you'll be able to write unit tests, etc in python, and=20 > even get a full scripting engine, which could turn out to be very usefu= l.. > > -Chris > =20 Hi, I do agree that driving C++ from python looks easier thant driving python from C++. However, I really would like to inclue python code into my C++ code and not the opposite (I have special needs so I really have to do that). I'm going to have a look at embedding python. Has anyone experience with that? =20 Xavier --=20 ############################################ Xavier Gnata CRAL - Observatoire de Lyon 9, avenue Charles Andr=E9 69561 Saint Genis Laval cedex Phone: +33 4 78 86 85 28 Fax: +33 4 78 86 83 86 E-mail: gn...@ob... ############################################=20 |