diff --git a/documentation/index.html b/documentation/index.html index 66f27416a82bc1d4e48dcca4823db2792fdb81fd..324e8740b768d29389b450939e9c42d3a455fac5 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -311,6 +311,7 @@ random-number-generator quasi-random-number-generator discrete-random polynomial-complex-workspace integration-workspace eigen-symm eigen-symmv eigen-herm eigen-hermv monte-carlo-plain monte-carlo-miser monte-carlo-vegas +ode-stepper ode-evolution </pre> <p> An instance may be created with a function whose name is "make-" @@ -357,7 +358,7 @@ and arrays used internally or for function return. <!-- Created: Feb 25 2005 --> <!-- hhmts start --> <small> -Time-stamp: <2009-01-16 09:22:35EST index.html> +Time-stamp: <2009-01-20 22:50:29EST index.html> </small> <!-- hhmts end --> </div> diff --git a/ordinary-differential-equations/control.lisp b/ordinary-differential-equations/control.lisp index 3eabd9c6989e8e5b5da3f65cce428c2a94bc0fb2..95c316663f6b76c395b0eca343b2323d4d0b551a 100644 --- a/ordinary-differential-equations/control.lisp +++ b/ordinary-differential-equations/control.lisp @@ -1,20 +1,20 @@ ;; Adaptive step-size control ;; Liam Healy 2008-02-17 17:30:04EST control.lisp -;; Time-stamp: <2008-08-21 22:08:55EDT control.lisp> +;; Time-stamp: <2009-01-20 19:39:08EST control.lisp> ;; $Id$ (in-package :gsl) -(defmfun new-standard-control (absolute-error relative-error y dydt) +(defmfun new-standard-control (absolute-error relative-error y-scaling dydt-scaling) "gsl_odeiv_control_standard_new" ((absolute-error :double) (relative-error :double) - (ay :double) (adydt :double)) + (y-scaling :double) (dydt-scaling :double)) :c-return (ptr :pointer) :return (ptr) :documentation ; FDL "The standard control object is a four parameter heuristic based on absolute and relative errors absolute-error and relative-error, and - scaling factors ay and adydt for the system state y(t) and derivatives + scaling factors y-scaling and dydt-scaling for the system state y(t) and derivatives y'(t) respectively. The step-size adjustment procedure for this method begins by computing @@ -47,8 +47,8 @@ "Create a new control object which will keep the local error on each step within an absolute error of absolute-error and relative error of relative-error with respect to the solution y_i(t). - This is equivalent to the standard control object with ay=1 and - adydt=0.") + This is equivalent to the standard control object with y-scaling=1 and + dydt-scaling=0.") (defmfun new-yp-control (absolute-error relative-error) "gsl_odeiv_control_yp_new" @@ -60,12 +60,13 @@ error on each step within an absolute error of absolute-error and relative error of relative-error with respect to the derivatives of the solution y'_i(t). This is equivalent to the standard control - object with ay=0 and adydt=1.") + object with y-scaling=0 and dydt-scaling=1.") (defmfun new-scaled-control - (absolute-error relative-error y dydt absolute-scale dimension) + (absolute-error relative-error y-scaling dydt-scaling absolute-scale dimension) "gsl_odeiv_control_scaled_new" - ((absolute-error :double) (relative-error :double) (y :double) (dydt :double) + ((absolute-error :double) (relative-error :double) + (y-scaling :double) (dydt-scaling :double) (absolute-scale :pointer) (dimension sizet)) :c-return (ptr :pointer) :return (ptr) diff --git a/ordinary-differential-equations/evolution.lisp b/ordinary-differential-equations/evolution.lisp index b5577d1b9b917abba05274199f014eda46bb97fe..5f74af8832591121ab834285b12f1e73c1f37e74 100644 --- a/ordinary-differential-equations/evolution.lisp +++ b/ordinary-differential-equations/evolution.lisp @@ -1,22 +1,20 @@ ;; Evolution functions for ODE integration. ;; Liam Healy, Sun Sep 30 2007 - 14:31 -;; Time-stamp: <2008-08-21 22:07:27EDT evolution.lisp> +;; Time-stamp: <2009-01-20 22:42:27EST evolution.lisp> ;; $Id$ (in-package :gsl) -(defmfun allocate-evolution (dimension) - "gsl_odeiv_evolve_alloc" - ((dimension sizet)) - :c-return :pointer - :documentation ; FDL - "Allocate a new instance of an evolution function - for a system of dimension dimensions and return the pointer.") +(defmobject ode-evolution "gsl_odeiv_evolve" + ((dimensions sizet)) + "evolution for ordinary differential equations" + "Make an object to advance the ODE solution." + "reset" nil) (defmfun apply-evolution (evolve control step dydt time max-time step-size y) "gsl_odeiv_evolve_apply" - ((evolve :pointer) (control :pointer) (step :pointer) + (((mpointer evolve) :pointer) (control :pointer) ((mpointer step) :pointer) (dydt :pointer) (time :pointer) (max-time :double) (step-size :pointer) (y :pointer)) :documentation ; FDL @@ -31,17 +29,3 @@ time max-time is guaranteed not to be exceeded by the time-step. On the final time-step the value of time will be set to t1 exactly.") -(defmfun reset-evolution (evolve) - "gsl_odeiv_evolve_reset" - ((evolve :pointer)) - :documentation - "Reset the evolution function evolve. It should be used - whenever the next use of evolve will not be a continuation of a - previous step.") - -(defmfun free-evolution (evolve) - "gsl_odeiv_evolve_free" - ((evolve :pointer)) - :c-return :void - :documentation - "Frees all the memory associated with the evolution function.") diff --git a/ordinary-differential-equations/ode-system.lisp b/ordinary-differential-equations/ode-system.lisp index dafbbd3076c8d24fea51e21ae565847f9e4b7592..4bb39fe3677a032d6d48306e55bd69b05e55e2e6 100644 --- a/ordinary-differential-equations/ode-system.lisp +++ b/ordinary-differential-equations/ode-system.lisp @@ -1,6 +1,6 @@ ;; ODE system setup ;; Liam Healy, Sun Apr 15 2007 - 14:19 -;; Time-stamp: <2009-01-18 18:23:07EST ode-system.lisp> +;; Time-stamp: <2009-01-20 22:47:16EST ode-system.lisp> ;; $Id$ (in-package :gsl) @@ -51,23 +51,20 @@ with-c-double." (let ((ctime (make-symbol "CTIME")) (cstep (make-symbol "CSTEP"))) - `(let ((stepper (step-allocate ,stepper ,dimensions)) + `(let ((stepper (make-ode-stepper ,stepper ,dimensions)) (control (new-y-control ,absolute-error ,relative-error)) - (evolve (allocate-evolution ,dimensions))) - (unwind-protect - (cffi:with-foreign-objects - ((,(if (listp dependent) (first dependent) dependent) - :double ,dimensions) (,ctime :double) (,cstep :double)) - (setf - (dcref ,cstep) ,step-size - (dcref ,ctime) ,time) - ,(if (listp dependent) - `(with-c-double ,dependent - (symbol-macrolet ((,time ,ctime) (,step-size ,cstep)) - ,@body)) - `(symbol-macrolet ((,time ,ctime) (,step-size ,cstep)) - ,@body))) - (free-evolution evolve) - (free-control control) - (step-free stepper))))) - + (evolve (make-ode-evolution ,dimensions))) + (unwind-protect + (cffi:with-foreign-objects + ((,(if (listp dependent) (first dependent) dependent) + :double ,dimensions) (,ctime :double) (,cstep :double)) + (setf + (dcref ,cstep) ,step-size + (dcref ,ctime) ,time) + ,(if (listp dependent) + `(with-c-double ,dependent + (symbol-macrolet ((,time ,ctime) (,step-size ,cstep)) + ,@body)) + `(symbol-macrolet ((,time ,ctime) (,step-size ,cstep)) + ,@body))) + (free-control control))))) diff --git a/ordinary-differential-equations/stepping.lisp b/ordinary-differential-equations/stepping.lisp index c2c190ea6b102a35448c01bad706de92c5127baa..5353798175c71bed779fb131db4f021fa2ce4e32 100644 --- a/ordinary-differential-equations/stepping.lisp +++ b/ordinary-differential-equations/stepping.lisp @@ -1,44 +1,31 @@ ;; Stepping functions for ODE systems. ;; Liam Healy, Mon Sep 24 2007 - 21:33 -;; Time-stamp: <2008-08-21 22:05:20EDT stepping.lisp> +;; Time-stamp: <2009-01-20 19:09:55EST stepping.lisp> ;; $Id$ (in-package :gsl) -(defmfun step-allocate (step-type dim) - "gsl_odeiv_step_alloc" - ((step-type :pointer) (dim sizet)) - :c-return :pointer - :documentation ; FDL - "Allocate a new instance of a stepping function of - type step-type for a system of dim dimensions, - returning the pointer.") - -(defmfun step-reset (stepper) - "gsl_odeiv_step_reset" - ((stepper :pointer)) - :documentation ; FDL - "Reset the stepping function. It should be used whenever - the next use of it will not be a continuation of a previous - step.") - -(defmfun step-free (stepper) - "gsl_odeiv_step_free" - ((stepper :pointer)) - :c-return :void - :documentation ; FDL - "Free all the memory associated with the stepping function.") - -(defmfun step-name (stepper) +(defmobject ode-stepper "gsl_odeiv_step" + ((type :pointer) (dimensions sizet)) + "stepper for ordinary differential equations" + "Make a stepper for ordinary differential equations. The type is + one of the GSL-supplied types defined in stepping.lisp, and + dimensions is the number of dependent variables. This instance + should be reinitialized whenever the next use of it will not be a + continuation of a previous step." + "reset" nil) + +(defmfun name ((object ode-stepper)) "gsl_odeiv_step_name" - ((stepper :pointer)) + (((mpointer object) :pointer)) + :definition :method :c-return :string :documentation ; FDL "The name of the stepping function.") (defmfun step-order (stepper) "gsl_odeiv_step_order" - ((stepper :pointer)) + (((mpointer stepper) :pointer)) :c-return :uint :documentation ; FDL "The order of the stepping function on the previous @@ -47,7 +34,7 @@ (defmfun step-apply (stepper time step-size y yerr dydt-in dydt-out dydt) "gsl_odeiv_step_apply" - ((stepper :pointer) + (((mpointer stepper) :pointer) (time :double) (step-size :double) (y :pointer)