Back to index

extremetuxracer  0.5beta
Classes | Defines | Typedefs | Functions
nmrcl.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ode_solver_t
struct  ode23_data_t
struct  ode45_data_t
struct  euler_data_t

Defines

#define EULER   0
#define ODE23   1
#define ODE45   2

Typedefs

typedef char ode_data_t
typedef ode_data_t *(* new_ode_data_ptr )()
typedef int(* num_estimates_ptr )()
typedef void(* init_ode_data_ptr )(ode_data_t *, double init_val, double h)
typedef double(* next_time_ptr )(ode_data_t *, int step)
typedef double(* next_val_ptr )(ode_data_t *, int step)
typedef void(* update_estimate_ptr )(ode_data_t *, int step, double val)
typedef double(* final_estimate_ptr )(ode_data_t *)
typedef double(* estimate_error_ptr )(ode_data_t *)
typedef double(* time_step_exponent_ptr )()

Functions

ode_solver_t new_ode23_solver ()
ode_solver_t new_ode45_solver ()
ode_solver_t new_euler_solver ()
double lin_interp (const double x[], const double y[], double val, int n)

Class Documentation

struct ode_solver_t

Definition at line 40 of file nmrcl.h.

Class Members
estimate_error_ptr estimate_error
final_estimate_ptr final_estimate
init_ode_data_ptr init_ode_data
new_ode_data_ptr new_ode_data
next_time_ptr next_time
next_val_ptr next_val
num_estimates_ptr num_estimates
time_step_exponent_ptr time_step_exponent
update_estimate_ptr update_estimate
struct ode23_data_t

Definition at line 52 of file nmrcl.h.

Class Members
double h
double init_val
double k
struct ode45_data_t

Definition at line 60 of file nmrcl.h.

Class Members
double h
double init_val
double k
struct euler_data_t

Definition at line 68 of file nmrcl.h.

Class Members
double h
double init_val
double k

Define Documentation

#define EULER   0

Definition at line 25 of file nmrcl.h.

#define ODE23   1

Definition at line 26 of file nmrcl.h.

#define ODE45   2

Definition at line 27 of file nmrcl.h.


Typedef Documentation

typedef double(* estimate_error_ptr)(ode_data_t *)

Definition at line 37 of file nmrcl.h.

typedef double(* final_estimate_ptr)(ode_data_t *)

Definition at line 36 of file nmrcl.h.

typedef void(* init_ode_data_ptr)(ode_data_t *, double init_val, double h)

Definition at line 32 of file nmrcl.h.

Definition at line 30 of file nmrcl.h.

typedef double(* next_time_ptr)(ode_data_t *, int step)

Definition at line 33 of file nmrcl.h.

typedef double(* next_val_ptr)(ode_data_t *, int step)

Definition at line 34 of file nmrcl.h.

typedef int(* num_estimates_ptr)()

Definition at line 31 of file nmrcl.h.

typedef char ode_data_t

Definition at line 29 of file nmrcl.h.

typedef double(* time_step_exponent_ptr)()

Definition at line 38 of file nmrcl.h.

typedef void(* update_estimate_ptr)(ode_data_t *, int step, double val)

Definition at line 35 of file nmrcl.h.


Function Documentation

double lin_interp ( const double  x[],
const double  y[],
double  val,
int  n 
)

Definition at line 296 of file nmrcl.cpp.

{
    int i;
    double m, b;

    check_assertion( 
       n>=2, "linear interpolation requires at least two data points" );

    if ( val < x[0] ) {
       i = 0;
    } else if ( val >= x[n-1] ) {
       i = n-2;
    } else {
       /* should replace with binary search if we ever use large tables */
       for ( i=0; i<n-1; i++ ) {
           if ( val < x[i+1] ) break;
       }
    }

    m = ( y[i+1] - y[i] ) / ( x[i+1] - x[i] );
    b =  y[i] - m * x[i];

    return m * val + b;
}

Here is the caller graph for this function:

Definition at line 104 of file nmrcl.cpp.

Here is the call graph for this function:

Here is the caller graph for this function: