C Written by Simon Lacoste-Julien 02/7/29 C This is a test to implement Euler function with call-back C mechanism in Fortran, to extend Python... C C EULER(N, fun, x, t, dt, newx) C - N is size of array input (x) C - fun is the ODE function - it's really an array of function; but this will C be taken care of in the python code: it will be called as follows C fun(N,i,x,t, result) where i will be the index of which function to evaluate (i starts at 0 in Python) C x will be vector C t will be scalar C result will hold result C - x is state vector C - t is time (double) C - dt is time step (double) C SUBROUTINE EULER(N, fun, x, t, dt, newx) EXTERNAL fun INTEGER N DOUBLE PRECISION x(N), t, dt, newx(N) DOUBLE PRECISION res DO 10 i = 1, N CALL fun(N,i-1,x,t, res) newx(i) = x(i) + dt * res 10 CONTINUE END SUBROUTINE EULER