1 /* ode-initval/control.c
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 /* Author: G. Jungman */
24 #include <gsl/gsl_math.h>
25 #include <gsl/gsl_errno.h>
26 #include <gsl/gsl_odeiv.h>
29 gsl_odeiv_control_alloc(const gsl_odeiv_control_type * T)
31 gsl_odeiv_control * c =
32 (gsl_odeiv_control *) malloc(sizeof(gsl_odeiv_control));
36 GSL_ERROR_NULL ("failed to allocate space for control struct",
41 c->state = c->type->alloc();
45 free (c); /* exception in constructor, avoid memory leak */
47 GSL_ERROR_NULL ("failed to allocate space for control state",
55 gsl_odeiv_control_init(gsl_odeiv_control * c,
56 double eps_abs, double eps_rel,
57 double a_y, double a_dydt)
59 return c->type->init (c->state, eps_abs, eps_rel, a_y, a_dydt);
63 gsl_odeiv_control_free(gsl_odeiv_control * c)
65 c->type->free(c->state);
70 gsl_odeiv_control_name(const gsl_odeiv_control * c)
76 gsl_odeiv_control_hadjust (gsl_odeiv_control * c, gsl_odeiv_step * s, const double y[], const double yerr[], const double dydt[], double * h)
78 return c->type->hadjust(c->state, s->dimension, s->type->order(s->state),