Passing a Class Member Function to dodesol

Passing a Class Member Function to dodesol

Hi,How can I pass a class member function to the ODE solver. I need to do this because my rhs function is dependent on data from the class.class Foo { void rhs(...) { rhs[0] = classdata * y[0] .... ... } void updat_class_data() { classdata = ....... } void solve_ode_system() { ... dodesol(..........., rhs, .......); } double classdata;}Many thanksGennadiy

publicaciones de 9 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi,It's seems that you could find example of such code here: best regards,Alexander Kalinkin

Hi Alexander,Thanks for the link.I knew this already. 'But', I guess what I meant to ask was how can I successfully pass user data to the 'rhs' function.My scenario is this:I have a set of N (C++) objects, each of which need to solve the same system of stiff ODEs with their own data. The data in turn depends on the state of variables in each object.Ideally, I'd make the 'rhs' function a member function, thus making the class data visible to it. 'But', since the 'rhs' function doesn't have a *userdata parameter, doing this is turning out to be a bit of a beast.The good thing is 'dodesol' seems to be the only stiff integrator that's been able to solve my system of ODEs but I'm unable to make use of it beyond a single object. So, HELP, please :)Gennadiy


Maybe I
didnt understand you, but subroutine rhs must describe in next way:

(n, t, y, f)

integer n

precision t, y(n), f(n)

f(i) =



With best


I think this thread asks for something similar to what I had asked for in a previous thread: a mechanism to pass user defined data to the rhs function. Perhaps something that would look like:subroutine(n, t, y, f, userdata)integer n,double t, double y[n], double *f(), *void userdataOr maybe something similar to the mechanism utilized at the Intel MKL (Trust Region Methods) for passing user data.I hope Intel is working on such a mechanism for future versions of this library.regards,Jorge

Jorge is correct. I also hope that the developers consider this for the next release.

Gentelmen,Now I see what you want and we will try to implement it in some next releases. By the way to continue support this library we really need to collect some feedbacks about this library from you. Could you post it on main ode page ( send it me directy?With best regards,Alexander Kalinkin

I would also appreciate if this would be possible. At the moment I avoid the problem by using global variables for sharing data with my main program. This may not be elegant, but it works...


HiSren,As you can see we have huge number of requests on such functionality in ODE solver so now we investigate it. Nevertheless if you use ODE solver could you provide some feedback on it? You can send it to me directy or answer here in private mode.With best regards,Alexander Kalinkin

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya