Commit f2f1a9fd authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

correct f_prim_dopri5

parent 108f7d61
......@@ -433,6 +433,15 @@ void mbs_fct_dirdyn(double tsim, double y[], double dydt[], MbsData *s, MbsAux *
*/
void f_prim_dopri5(unsigned n, double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *dd)
{
// variables declaration
MbsDirdynOptions* opts;
#ifdef REAL_TIME
Simu_realtime *realtime;
#endif
opts = dd->options;
// user loop
user_loop(s, dd->mbs_aux);
......@@ -440,38 +449,31 @@ void f_prim_dopri5(unsigned n, double tsim, double y[], double dydt[], MbsData *
mbs_fct_dirdyn(tsim, y, dydt, s, dd->mbs_aux);
// save results to the buffer
if(dd->options->save2file && (dd->tsim - dd->adapt_last_t_save >= dd->options->adapt_dt_save))
if(opts->save2file && (tsim - dd->adapt_last_t_save >= opts->adapt_dt_save))
{
dd->savePeriodCounter++;
dd->adapt_last_t_save = dd->tsim;
dd->adapt_last_t_save = tsim;
if(dd->savePeriodCounter%dd->options->saveperiod == 0)
if(dd->savePeriodCounter%opts->saveperiod == 0)
{
mbs_dirdyn_save(dd, s->tsim);
mbs_dirdyn_save(dd, tsim);
}
}
// real-time modules
#ifdef REAL_TIME
if (dd->options->realtime && (dd->tsim - dd->adapt_last_t_rt >= dd->options->adapt_dt_rt))
if (opts->realtime && (tsim - dd->adapt_last_t_rt >= opts->adapt_dt_rt))
{
dd->adapt_last_t_rt = dd->tsim;
realtime = (Simu_realtime*) s->realtime;
dd->adapt_last_t_rt = tsim;
// update real-time buffers
mbs_realtime_update(realtime, mbs_data->tsim);
mbs_realtime_update(realtime, tsim);
// real-time loop iteration
mbs_realtime_loop(realtime, mbs_data->tsim);
// break loop
if (realtime->simu_quit)
{
break;
}
mbs_realtime_loop(realtime, tsim);
}
#endif
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment