Abstract
Python is a programming language that has gained a lot of popularity during the last 15 years, and as a very easy-to-learn and flexible scripting language it is very well suited for computa- tional science, both in mathematics and in physics. Diffpack is a PDE library written in C++, made for easier implementation of both smaller PDE solvers and for larger libraries of simu- lators. It contains large class hierarchies for different solvers, grids, arrays, parallel computing and almost everything needed to solve PDEs. Pulse, a Diffpack based PDE heart simulator, is made for simulating electrical and mechanical behavior in the heart. Making an interface to Pulse in Python will hopefully merge the positive qualities from both C++ and Python. Taking advantage of the fact that the original code is written in C++ and therefore effective, and the flexibility of Python, can make for both a highly effective solver, and one it is easy to test and debug. SWIG was used to wrap the original C++ code into Python, as it had been tested with suc- cess on Diffpack classes in an earlier thesis. This thesis consist of two parts. The first explains how to wrap the Heat1 class into a Python module, and how to implement the timeLoop and solveAtThisTimestep functions in Python, focusing on what problems may occur during the procedure. The second part explains the wrapping procedure used when wrapping Pulse, and how to implement Python versions of the Circulation::timeLoop, Heart::simpleTimeLoop, Heart::solveCellsAndDiffusion and Heart::initTimeLoop functions.