On 01/08/2012 08:33 PM, Md. Golam Rashed wrote:
I want to write a paper themed on, doing simulation using scripting language with legacy code. As a civil engineer (structural), i find the tensile strength of concrete test presented in sfepy primer quite suitable to use in my writing. will this cause any copyright problem???
Unless Andre (the primary author of the primer) says differently, our documentation is, like the code, licensed under BSD license, so use what you need. Citing the docs would be nice, of course.
And secondly, can anybody detail the process of wrapping python around C in sfepy?? just to make sure my understanding is right. Thanks!
Recently we changed from swig to cython, so the situation is as follows:
The C code is in 'extmods' (as extension modules) subdirectories: sfepy/fem/extmods/ sfepy/physics/extmods/ sfepy/linalg/extmods/ sfepy/terms/extmods/
The Cython wrappers are there as well in .pyx (+ sometimes .pxd) files. Some extension modules are pure Cython (they do not use hand-written C), e.g. sfepy/fem/extmods/assemble.pyx
The Cython code uses numpy arrays as memory buffers. It (usually) works as follows:
- in Python, all input arrays are prepared and output arrays pre-allocated (using zeros() or empty()).
- the C/Cython function is called, filling the output arrays
This approach simplifies very much needs for manual memory management in C. Another simplification is that the C code requires the arrays to be C-contiguous.
If you want to know more, first check the cython documentation, especially the tutorials [1] and the chapter on interaction with numpy [2]. Then also look at the code in the directories mentioned above (disclaimer: I am cython newbie - any comments how to improve the wrappers are welcome!)
Also feel free to ask here, of course.
Cheers, r.
[1] http://docs.cython.org/src/tutorial/index.html [2] http://docs.cython.org/src/tutorial/numpy.html