McCode icon indicating copy to clipboard operation
McCode copied to clipboard

SASmodels - better solution for namespaces around the individual c-codes

Open willend opened this issue 5 years ago • 8 comments

In a recent discussion on mcstas-users (https://mailman2.mcstas.org/pipermail/mcstas-users/2019q3/001301.html) it looks relevant to be able to combine more than one sasmodel in the same instrument.

I propose that we make an alternative python-script based solution that generates one component from one model, directly embedding the (rewritten) model c-code with mode-specific names for these functions:

grep ^float sas_star_polymer.c

float form_volume(void);   ->   form_volume_star_polymer(void); 
float Iq(float q, float radius2, float arms);   ->   Iq_star_polymer(float q, float radius2, float arms);
float Iqxy(float qx, float qy, float radius2, float arms); -> ...
float form_volume(void) -> ...
float Iq(float q, float radius2, float arms) -> ...
float Iqxy(float qx, float qy, float radius2, float arms) -> ...

I.e. one "flat" component file generated pr. sasmodel c-snippet. Perhaps as a user-level script to generate only the ones you are yourself interested of.

@trnielsen, @ebknudsen, @climbcat what do you think?

willend avatar Jul 16 '19 13:07 willend