Back to index

extremetuxracer  0.5beta
nmrcl.h
Go to the documentation of this file.
00001 /* 
00002  * PPRacer 
00003  * Copyright (C) 2004-2005 Volker Stroebel <volker@planetpenguin.de>
00004  * 
00005  * Copyright (C) 1999-2001 Jasmin F. Patry
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00021 
00022 #ifndef _NMRCL_H_
00023 #define _NMRCL_H_
00024 
00025 #define EULER 0
00026 #define ODE23 1
00027 #define ODE45 2
00028 
00029 typedef char ode_data_t;
00030 typedef ode_data_t* (*new_ode_data_ptr)();
00031 typedef int (*num_estimates_ptr)();
00032 typedef void (*init_ode_data_ptr)(ode_data_t *, double init_val, double h );
00033 typedef double (*next_time_ptr)(ode_data_t *, int step);
00034 typedef double (*next_val_ptr)(ode_data_t *, int step);
00035 typedef void (*update_estimate_ptr)(ode_data_t *, int step, double val );
00036 typedef double (*final_estimate_ptr)(ode_data_t *);
00037 typedef double (*estimate_error_ptr)(ode_data_t *);
00038 typedef double (*time_step_exponent_ptr)();
00039 
00040 typedef struct {
00041     new_ode_data_ptr new_ode_data;
00042     num_estimates_ptr num_estimates;
00043     init_ode_data_ptr init_ode_data;
00044     next_time_ptr next_time;
00045     next_val_ptr next_val;
00046     update_estimate_ptr update_estimate;
00047     final_estimate_ptr final_estimate;
00048     estimate_error_ptr estimate_error;
00049     time_step_exponent_ptr time_step_exponent;
00050 } ode_solver_t;
00051 
00052 typedef struct {
00053     double k[4];
00054     double init_val;
00055     double h;
00056 } ode23_data_t;
00057 
00058 ode_solver_t new_ode23_solver();
00059 
00060 typedef struct {
00061     double k[7];
00062     double init_val;
00063     double h;
00064 } ode45_data_t;
00065 
00066 ode_solver_t new_ode45_solver();
00067 
00068 typedef struct {
00069     double k[2];
00070     double init_val;
00071     double h;
00072 } euler_data_t;
00073 
00074 ode_solver_t new_euler_solver();
00075 
00076 double lin_interp( const double x[], const double y[], double val, int n );
00077 
00078 #endif /* _NMRCL_H_ */