On Mon, May 2, 2011 at 6:07 PM, Matt Peddie <mpeddie@gmail.com> wrote:
Hi,

On Fri, 8 Apr 2011 at 15:44:08, Fedor Bezrukov <Fedor.Bezrukov@physik.uni-muenchen.de> wrote:
> Though one thing is definitely needed (I'll think of it when I have
> some time) -- ability to make the function for the ode to get and
> return the arguments as an array -- quite a common case if you want to
> solve a large system of differential equations (eg, inital value
> problem for an ODE)

I'd really, really like to use this array functionality.  I know nothing
about CFFI and am a gsll newbie, but I'm willing to help if I can.

Matt


Unless I'm misunderstanding this request, this is already possible, in fact I'd regard it as the basic usage.  Perhaps you are thrown off by the with-ode-integration macro and example.  I made up this macro in order to easily accommodate the case of non-array usage in the ODE solvers, because I wanted to show a simple example with scalars.   However if you look at how that macro expands, there is a symbol #:DEP that is bound to a foreign array with the appropriate dimensions:

(LET ((STEPPEROBJ
       (MAKE-ODE-STEPPER STEPPER 2 'VANDERPOL 'VANDERPOL-JACOBIAN T))
      (CONTROL (MAKE-Y-CONTROL 1.e-6 0.0))
      (EVOLVE (MAKE-ODE-EVOLUTION 2))
      (#:DEP (GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS 2))
      (#:CTIME (GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS 1))
      (#:CSTEP (GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :DIMENSIONS 1)))
  (SYMBOL-MACROLET ((TIME (GRID:GREF #:CTIME 0))
                    (STEP (GRID:GREF #:CSTEP 0))
                    (DEP0 (GRID:GREF #:DEP 0))
                    (DEP1 (GRID:GREF #:DEP 1)))
    (FLET ((NEXT-STEP ()
             (APPLY-EVOLUTION EVOLVE #:CTIME #:DEP #:CSTEP CONTROL STEPPEROBJ
                              MAX-TIME)))
      (SETF DEP0 1.0
            DEP1 0.0
            STEP STEP-SIZE
            TIME INITIAL-TIME)
      (LOOP
       (WHEN (OR (>= TIME MAX-TIME) (> ITER *MAX-ITER*))
         (RETURN (VALUES ITER TIME DEP0 DEP1)))
       (NEXT-STEP)
       (INCF ITER)
       (WHEN PRINT-STEPS
         (FORMAT T "~12,6f~10t~12,6f~24t~12,6f~&" TIME DEP0 DEP1))))))

So what you want to do is mimic this form, but instead define your foreign array directly.  Is this what you're asking about?
If it's an issue of CL array vs. foreign array, then you can use #'cl-array or just copy it over at the beginning and end.
 
Liam

P.S.  Please join the mailing list to post.  Thank you.