00001
00009
00010 #include "oGL_graphics/graphics_relative.h"
00011 #include "oGL_graphics/solid_objects.h"
00012
00013
00014
00015 #include "math.h"
00016 #include "mex.h"
00017
00018
00019 #include "string.h"
00020
00021
00022 #include "hydro_source/hydro_includes.h"
00023
00024
00025
00026
00027 #include "CVODEincludes.h"
00028
00029
00030
00031 #include "timing/timing.h"
00032
00033
00034 #include "f.h"
00035
00036
00037 #define MAXFLAGLEN 100
00038
00039 #ifndef PI_DEF
00040 #define pi 3.141592653589793
00041 #define PI 3.141592653589793
00042 #endif
00043
00044
00045
00046
00048
00056 void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
00057 {
00059 parameters Par;
00060 parameters *P = &Par;
00061 joy_parameters jPar;
00062 joy_parameters *jP = &jPar;
00063 datas dat;
00064 datas *d = &dat;
00065 ODE_data f_dats;
00066 ODE_data *f_dat = &f_dats;
00067
00068
00069 int kk;
00070
00071 double *state;
00072 char* flag;
00073 char def_flag[] = "";
00074 char output_flag[] = "output";
00075 long tLength;
00076
00077 float Time;
00078 bool go=1;
00079
00080 state = get_state(nlhs, plhs, nrhs, prhs);
00081
00082 f_dat->d = d;
00083 f_dat->P = P;
00084
00085
00086
00087
00088 f_dat->state = state;
00089
00090
00091 initParameters(P);
00092 get_Parameters(nlhs, plhs, nrhs, prhs, P);
00093
00094 get_time(nlhs, plhs, nrhs, prhs, f_dat);
00095
00096 get_joystick_parameters(nlhs, plhs, nrhs, prhs, jP);
00097 pass_joy_parameters(jP);
00098
00099
00100
00101
00102 data_init(d);
00103 data_update_state(d, state);
00104 data_update_param(d, P);
00105
00106
00107
00108 solver_init(f_dat);
00109
00110 kk = draw_graphics_init(d);
00111
00112
00113 wave_init();
00114
00115 Boat_create(d);
00116
00117
00118 tic();
00119 while (go)
00120 {
00121 Time = toc();
00122 solve_ODE(f_dat, Time);
00123 go = draw_graphics(d);
00124 if ((f_dat->time_param != 0.0) && (d->t > f_dat->time_param)) go=0;
00125 }
00126
00127 free_wave_variables();
00128
00129 kk = draw_graphics_kill();
00130
00131 solver_free(f_dat);
00132
00133 return_args(nlhs, plhs, nrhs, prhs, f_dat);
00134
00135
00136 delete_state(f_dat->state);
00137 Boat_delete();
00138
00139
00140 return;
00141 }
00142