A draft pull request for a restructure of the C backend. #359
Changes:
We no longer include all headers and code in one file GenerateICs.c
Instead, each file includes only the headers it uses, and all #include "X.c" have been removed
build.cffi has been changed to make it clear which functions and definitions are available to the python wrapper.
CFFI requires all functions, global variables, and type definitions directly used in python to be present in cdef() calls as well as in the set_source() header files.
The cdef() code cannot contain compiler directives, as a result new header files were created labelled _something_wrapper.h to contain exposed definitions. these are also included in the relevant header files for the backend so we only have to edit one file to expose a function properly.
C files UsefulFunctions.c and ps.c have been split up into functions grouped together by their themes e.g cosmology.cthermochem.chmf.c etc...
Some unused functions have been removed
Todos:
Make directories for different categories of files, perhaps one for the output structures and one for lower-level functions?
Remove the many unused variables declared throughout the code
Stricter typing:
Indices for the entire box should already be unsigned long long, but single axis indices are sometimes int or unsigned long long.
Many lower-level functions still use float, most of these should be double unless they are a grid which takes up significant memory/disk space #361
Think about splitting up heating_helper_progs.c as well
A draft pull request for a restructure of the C backend. #359
Changes:
GenerateICs.c
#include "X.c"
have been removedbuild.cffi
has been changed to make it clear which functions and definitions are available to the python wrapper.cdef()
calls as well as in theset_source()
header files.cdef()
code cannot contain compiler directives, as a result new header files were created labelled_something_wrapper.h
to contain exposed definitions. these are also included in the relevant header files for the backend so we only have to edit one file to expose a function properly.UsefulFunctions.c
andps.c
have been split up into functions grouped together by their themes e.gcosmology.c
thermochem.c
hmf.c
etc...Todos:
unsigned long long
, but single axis indices are sometimesint
orunsigned long long
.float
, most of these should bedouble
unless they are a grid which takes up significant memory/disk space #361heating_helper_progs.c
as well