Closed j-fu closed 2 months ago
I think the implementation of finalizers is the way to go. Unfortunately I don't know in the moment how the interaction with cxxwrap should look like. AMGCLWrap.jl wraps around C code and uses finalizers.
The idea for the finalizers can be found here. Basically, the CxxPtr is wrapped in a mutable struct, which gets a finalizer. The current idea would be to extend this for a combined struct of a Julia matrix and a C++ matrix since both are necessary: The C++ matrix is used to store and compute the result of the derivative from ADOL-C, and you do not want to re-allocated and destroy them every time; the Julia matrix is then used to do the computations with the result. An update of the C++ matrix would trigger an update of the Julia matrix. Something like that...
... sorry, habe master nicht gemerged, mache noch ein update...