Cantera/Adding Python Class Via C++: Difference between revisions
From charlesreid1
| Line 16: | Line 16: | ||
4. Create a Cython object (this fourth step was added between Cantera 2.0 and Cantera 2.1) | 4. Create a Cython object (this fourth step was added between Cantera 2.0 and Cantera 2.1) | ||
[[Category:Cantera]] | |||
Revision as of 03:11, 13 August 2014
The following instructions describe how to implement a new C++ class in Cantera 2.1 and make it accessible via Python.
Hopefully this will save you the headaches and streams of expletives that navigating changes between 2.0 and 2.1 caused me.
(Note to Cantera developers: if you break backwards compatibility and change the way the API works, you need to increment the MAJOR version number, not the MINOR version number.)
Overview
To add a new C++ class in Cantera, you will need to follow a couple of steps:
1. Add the C++ code for the class
2. Wrap the new C++ code with the C API
3. Create a Python object that calls the C API code (is this even necessary?)
4. Create a Cython object (this fourth step was added between Cantera 2.0 and Cantera 2.1)