Adds python-only backend
The python-only backend is used as a fallback when the compiled blond library (libblond.{so,dll}
) is not detected. This simplifies the installation and testing of the BLonD library, at the cost of performance. For large simulations, the compiled backend should be preferred.
The backend selection mechanism is simple:
- All calls to compute intensive functions (e.g. kick, drift, slice) go through the
blond.utils.bmath
module. - The
bmath
module maintains a correspondence (dict
) between function names and function implementations. - If
libblond.{so, dll}
is detected, the C++ function implementations are used. Otherwise, the python-only implementations are used. - One can override this mechanism and request for a specific backend with
bmath.use_py()
orbmath.use_cpp()
Edited by Konstantinos Iliakis