cluster_toolkit
cluster_toolkit copied to clipboard
Consistent ffi
This PR makes two main changes for consistent interfacing with C code, and error handling:
- Passing arrays to C routines is now handled with the
_ArrayWrapper
class, which always ensures arrays are the right type, and contiguous in memory (to avoid memory corruption). It also consistently handles passing single values to C routines. - C routines using GSL functions now return the GSL error code to the Python wrapper. If
retcode != GSL_SUCCESS
, an error is thrown in Python. This ensures that errors are always detected, and makes it possible to handle them explicitly in Python.
Seems like the first bullet above addresses #9 as well