Adding parameters to ContClass::loadAutoMod to enable use of custom C code

2014-06-23
2014-06-24
  • Florian Aspart
    Florian Aspart
    2014-06-23

    Hi everyone,

    I'm trying to use PyDSTool with custom C code as described in another thread on this forum ( Title: "C-integrators and specifying systems of eqs." ).

    This work fine as long as I do not use the PyCont Auto module interface.

    When using the Auto module, the C code for my Radau integrator is generated and compiled again in the ConClass::loadAutoMod function.
    As I understand it, this function initialize:
    - the Auto module
    - generate the Auto library source
    - compile the library
    - keep a reference of the auto library inside the ContClass.

    The problem is that this function does not have any "nobuild" parameter to modify the C code manually nor "libsources", "libdirs", "include" parameters that would be forwarded to "makeAutoLibSource" and "compileAutoLib" in order to use one's own library.

    I would suggest to add these parameters to the "loadAutoMod" function in order to facilitate the use of custom C code.

    By the way, inside "compileAutoLib" there is a call to "isUniqueSeq" (PyDsTool.common) which is not imported, this is a bug I guess.

    I could add the parameters in the Github repository and fix the bug but before I'd like to get feedback on that matter.
    Maybe I'm simpling missing the point and there is already a way to use one's own custom C code with the Auto module...

    Best,
    Florian

     
  • Rob Clewley
    Rob Clewley
    2014-06-23

    Hi Florian,

    Indeed, PyCont could benefit from the two-stage build process in order to allow custom C code. I think it can be done in exactly the same way it is done for Radau, using makeLibSource and compileLib. Please feel free to create a PR if you can.

    The bugfix, to import isUniqueSeq from common explicitly, will be uploaded to github soon.

    Thanks!
    Rob

     
  • Florian Aspart
    Florian Aspart
    2014-06-24

    Hi Rob,
    thank you for your answer.

    I created a PR.

    Best,
    Florian