|
| 1 | +# User Extensions |
| 2 | + |
| 3 | +The user extensions directory is here to allow for |
| 4 | +the user to be able to straightforwardly run compiled |
| 5 | +code within Fidimag for performance reasons. We |
| 6 | +consider this an advanced feature and do not recommend |
| 7 | +trying this unless you have experience writing and |
| 8 | +building C/Cython programs. |
| 9 | + |
| 10 | +Some of the energy classes perform callbacks to |
| 11 | +user-supplied functions. Performance for this |
| 12 | +is generally poor, as there is an overhead to |
| 13 | +calling Python functions repeatedly. Hence, |
| 14 | +we place this folder here to allow you to expose |
| 15 | +functions written in Cython/C conveniently. |
| 16 | + |
| 17 | +An example has been supplied. We suggest copying |
| 18 | +the folder and modifying each of the files in |
| 19 | +this. Please note that we have automated the |
| 20 | +building of the extensions, but you can only |
| 21 | +have a single Cython .pyx file per directory, |
| 22 | +because a single Cython module is created in |
| 23 | +each folder. The module that is created will have |
| 24 | +the name of this file. |
| 25 | + |
| 26 | +You do not explicitly need to write an __init__.py file; |
| 27 | +your extension will be importable immediately from |
| 28 | +fidimag.extensions.user.$FOLDERNAME |
| 29 | + |
| 30 | +The __init__.py file lets you do the slightly shorter: |
| 31 | +from fidimag.user.$FOLDERNAME import * |
| 32 | + |
0 commit comments