Hi,
 Thanks, that worked :). Just had to review a bit of Pointers & structures
from textbook to understand what was goin on.

AR

On 2/19/06, Analabha Roy <[EMAIL PROTECTED]> wrote:
>
> Thanks, I'll give it a whirl.
>
> ---------- Forwarded message ----------
> From: Joakim Hove <[EMAIL PROTECTED]>
> Date: Feb 19, 2006 3:46 PM
> Subject: Re: [Help-gsl] passing multiple parameters to func() & jac()
> while integrating ODE's in gsl
> To: Analabha Roy <[EMAIL PROTECTED]>
>
> "Analabha Roy" < [EMAIL PROTECTED]> writes:
>
> > I assumed that, in order to do it for multiple parameters, I'd have
> > to put the parameters in an array and pass the base address to the
> > gsl_odeiv_system datatype, then use pointer arithmetic in the
>
>
> 1. I would strongly recommend defining a struct to contain your set of
>    parameters; that is considerably less error prone than an array:
>
> typedef struct {
>    double mass;
>    double w;
> } harmonic_type;
>
>
>
>
> int func(double t, const double y[], double dydt[], void *params) {
>    harmonic_type *p = (harmonic_type *) params;
>    double mass = p->mass;
>    double w    = w->w;
>    ...
>    ....
>
>          double mass,w;
>
>         mass=*(double *)params;
>
> 2. I guess this pointer arithimitc comes out wrong, becuse params is
>    *not* of type double.
>
>         params++;
>
>    Anyway, you do not have to worry about that when using a struct.
>
> HTH - Joakim
>
> --
> Joakim Hove
> hove AT ntnu.no                     /
> Tlf: +47 (55 5)8 27 13            /     Stabburveien 18
> Fax: +47 (55 5)8 94 40           /      N-5231 Paradis
> http://www.ift.uib.no/~hove/ <http://www.ift.uib.no/%7Ehove/>    /
> 55 91 28 18 / 92 68 57 04
>
>
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to