Open henrus opened 9 years ago
Check the pull request (modelModules) for a simple draft of this functionality (example in idealGas.py). Right now I am explicitly using "Input, output and parameter" provided by the user, but this can be changed.
This shows quite well what we are aiming for. We will certainly need more syntax and possibly ifs and loops. There may be some limits to what we should allow as we also want to generate derivatives. As far as I know, automatic differentiation will work across loops, but differentiating the syntax tree will not.
Guess the next step is to write down a proper specification of what the 'function' should be able to do. Then we can check for modules (e.g. parsers/lexers) to pull in. Heinz also mentioned a toy parser written in python which may be a route to go.
Create the surrogate function with an algebra parser. Both C-code and input/output/parameter spec can be generated automatically. This becomes are new class derived from CFunction