Python calling C++ calling Fortran

I got it working a while ago, but I haven’t had a chance to update my eager audience.  I built a simple simple simulation tool using this crazy combination of languages.  It’s a library written in C++ that uses the finite volume method to simulate diffusion in one dimenstion. What’s cool is that it’s designed to be called from Python using Boost.  Furthermore, it then uses Boost Bindings (not officially part of Boost) to call LAPACK (a Fortran library) to solve linear equations (as shown in a previous post).  It’s pretty cool that all this stuff actually works together.  Why did I do this?  Python is my favorite very-high-level language for doing scientific programming.  Compared to C++ or Fortran, it’s just so easy to do things in Python, like making plots or reading in an xml file.  I chose C++ for the numerical codes because it’s faster than Python and the Boost library connects the two.  I could have used Fortran, but the Python interfaces doesn’t seem to be as clean, probably because Fortran isn’t object-oriented.  Finally, since the reference implementation of LAPACK is still in Fortran, I just used the Boost bindings to call it.  I might switch to a native C++ linear algebra library if a clear leader emerges from the confusing alternatives that are available today.  More complaints on that later…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s