1 /** D bindings for GSL. 2 Authors: Chibisi Chima-Okereke 3 Copyright: Copyright (c) 2016, Chibisi Chima-Okereke. All rights reserved. 4 License: Boost License 1.0 5 */ 6 7 module gsl.odeiv; 8 import core.stdc.config : c_ulong; 9 10 extern (C): 11 12 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rk2; 13 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rk4; 14 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rkf45; 15 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rkck; 16 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rk8pd; 17 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rk2imp; 18 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rk2simp; 19 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_rk4imp; 20 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_bsimp; 21 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_gear1; 22 extern __gshared const(gsl_odeiv_step_type)* gsl_odeiv_step_gear2; 23 24 struct gsl_odeiv_system 25 { 26 int function (double, const(double)*, double*, void*) function_; 27 int function (double, const(double)*, double*, double*, void*) jacobian; 28 size_t dimension; 29 void* params; 30 } 31 32 struct gsl_odeiv_step_type 33 { 34 const(char)* name; 35 int can_use_dydt_in; 36 int gives_exact_dydt_out; 37 void* function (size_t) alloc; 38 int function (void*, size_t, double, double, double*, double*, const(double)*, double*, const(gsl_odeiv_system)*) apply; 39 int function (void*, size_t) reset; 40 uint function (void*) order; 41 void function (void*) free; 42 } 43 44 struct gsl_odeiv_step 45 { 46 const(gsl_odeiv_step_type)* type; 47 size_t dimension; 48 void* state; 49 } 50 51 struct gsl_odeiv_control_type 52 { 53 const(char)* name; 54 void* function () alloc; 55 int function (void*, double, double, double, double) init; 56 int function (void*, size_t, uint, const(double)*, const(double)*, const(double)*, double*) hadjust; 57 void function (void*) free; 58 } 59 60 struct gsl_odeiv_control 61 { 62 const(gsl_odeiv_control_type)* type; 63 void* state; 64 } 65 66 struct gsl_odeiv_evolve 67 { 68 size_t dimension; 69 double* y0; 70 double* yerr; 71 double* dydt_in; 72 double* dydt_out; 73 double last_step; 74 c_ulong count; 75 c_ulong failed_steps; 76 } 77 78 gsl_odeiv_step* gsl_odeiv_step_alloc (const(gsl_odeiv_step_type)* T, size_t dim); 79 int gsl_odeiv_step_reset (gsl_odeiv_step* s); 80 void gsl_odeiv_step_free (gsl_odeiv_step* s); 81 const(char)* gsl_odeiv_step_name (const(gsl_odeiv_step)* s); 82 uint gsl_odeiv_step_order (const(gsl_odeiv_step)* s); 83 int gsl_odeiv_step_apply (gsl_odeiv_step* s, double t, double h, double* y, double* yerr, const(double)* dydt_in, double* dydt_out, const(gsl_odeiv_system)* dydt); 84 gsl_odeiv_control* gsl_odeiv_control_alloc (const(gsl_odeiv_control_type)* T); 85 int gsl_odeiv_control_init (gsl_odeiv_control* c, double eps_abs, double eps_rel, double a_y, double a_dydt); 86 void gsl_odeiv_control_free (gsl_odeiv_control* c); 87 int gsl_odeiv_control_hadjust (gsl_odeiv_control* c, gsl_odeiv_step* s, const(double)* y, const(double)* yerr, const(double)* dydt, double* h); 88 const(char)* gsl_odeiv_control_name (const(gsl_odeiv_control)* c); 89 gsl_odeiv_control* gsl_odeiv_control_standard_new (double eps_abs, double eps_rel, double a_y, double a_dydt); 90 gsl_odeiv_control* gsl_odeiv_control_y_new (double eps_abs, double eps_rel); 91 gsl_odeiv_control* gsl_odeiv_control_yp_new (double eps_abs, double eps_rel); 92 gsl_odeiv_control* gsl_odeiv_control_scaled_new (double eps_abs, double eps_rel, double a_y, double a_dydt, const(double)* scale_abs, size_t dim); 93 gsl_odeiv_evolve* gsl_odeiv_evolve_alloc (size_t dim); 94 int gsl_odeiv_evolve_apply (gsl_odeiv_evolve* e, gsl_odeiv_control* con, gsl_odeiv_step* step, const(gsl_odeiv_system)* dydt, double* t, double t1, double* h, double* y); 95 int gsl_odeiv_evolve_reset (gsl_odeiv_evolve* e); 96 void gsl_odeiv_evolve_free (gsl_odeiv_evolve* e);