Commit a9a78383 authored by Sebastien Timmermans's avatar Sebastien Timmermans 🎹

[Update] move user_dd_loop call in integrators

parent 3013809e
Pipeline #4445 failed with stage
in 10 minutes
......@@ -74,12 +74,11 @@ void loop_bader(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FILE
while (t < tf)
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
for (i = 0; i < mbs_dd->nState; i++) {
yscal[i] = (1.0 > mbs_dd->y[i]) ? 1.0 : mbs_dd->y[i];
......@@ -87,7 +86,8 @@ void loop_bader(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FILE
bader(mbs_dd->y, mbs_dd->yd, mbs_dd->nState, &t, h_cur, mbs_dd->options->toler, yscal, &hdid, &hnext, h_max, mbs_fct_dirdyn, mbs_data, mbs_dd);
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
h_cur = (hnext < tf - t) ? hnext : tf - t;
h_max = (mbs_dd->options->dt_max < tf - t) ? mbs_dd->options->dt_max : tf - t;
......
......@@ -50,12 +50,11 @@ void loop_custom(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FIL
while (t < tf)
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
// ###### start of custom unknown integrator #########
// Here we take ThetaSC which is not working
......@@ -69,7 +68,8 @@ void loop_custom(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FIL
mbs_dd->y[i] = mbs_dd->yout[i];
}
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
// save results if always asked or if waypoint reached
if ((!mbs_dd->options->flag_solout_wp) || (mbs_dd->options->flag_solout_wp && t == tf)) {
......
......@@ -52,19 +52,20 @@ void loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FI
while (mbs_dd->tsim <= tf)
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
// calls the correct euler implementation
((MbsDirdynEulerEx *)mbs_dd->integrator_struct)->choice_of_euler(h, mbs_data, mbs_dd);
mbs_dd->tsim += h;
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
// save results if always asked or if waypoint reached
if ((!mbs_dd->options->flag_solout_wp) || (mbs_dd->options->flag_solout_wp && mbs_dd->tsim == tf)) {
......
......@@ -60,18 +60,20 @@ void loop_euler_implicit(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs
while (mbs_dd->tsim < tf) {
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
// Call the Euler Implicit method
euler_implicit(mbs_dd->y, mbs_dd->yd, mbs_dd->nState, &t, h, mbs_dd->yout, mbs_fct_dirdyn, mbs_data, mbs_dd);
mbs_dd->tsim += h;
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
mbs_dd->tsim += h;
if (((!mbs_dd->options->flag_solout_wp) || (mbs_dd->options->flag_solout_wp && mbs_dd->tsim == tf))) {
save_realtime_update(mbs_dd, mbs_data);
......
......@@ -43,12 +43,11 @@ void loop_rk4(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FILE *
while (mbs_dd->tsim <= tf)
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
rk4(mbs_dd->y, mbs_dd->yd, mbs_dd->nState, mbs_dd->tsim, h, mbs_dd->yout, mbs_fct_dirdyn, mbs_data, mbs_dd);
......@@ -59,6 +58,7 @@ void loop_rk4(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd, FILE *
mbs_dd->y[i] = mbs_dd->yout[i];
}
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
// save results if always asked or if waypoint reached
......
......@@ -70,13 +70,13 @@ void loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd,
user_dirdyn_loop(mbs_data, mbs_dd);
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
while (t < tf) {
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
while (t < tf)
{
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
for (i = 0; i < mbs_dd->nState; i++) {
scaling[i] = (1.0 > mbs_dd->y[i]) ? 1.0 : mbs_dd->y[i];
......@@ -92,6 +92,7 @@ void loop_rosenbrock(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd,
h_cur = (hnext < tf - t) ? hnext : tf - t;
h_max = (mbs_dd->options->dt_max < tf - t) ? mbs_dd->options->dt_max : tf - t;
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(t, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
if (((!mbs_dd->options->flag_solout_wp) || (mbs_dd->options->flag_solout_wp && t == tf))) {
......
......@@ -59,18 +59,18 @@ void loop_w_methods(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd,
while (mbs_dd->tsim < tf) {
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
if (mbs_dd->options->flag_precise_dynamics) // Compute f' if asked
{
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd);
}
// Call the W Method function
w_methods(mbs_dd->y, mbs_dd->yd, mbs_dd->nState, mbs_dd->tsim, h, mbs_dd->yout, mbs_fct_dirdyn, mbs_data, mbs_dd);
mbs_dd->tsim += h;
user_dirdyn_loop(mbs_data, mbs_dd); ///user loop
mbs_fct_dirdyn(mbs_dd->tsim, mbs_dd->y, mbs_dd->yd, mbs_data, mbs_dd); // next f'
if (((!mbs_dd->options->flag_solout_wp) || (mbs_dd->options->flag_solout_wp && mbs_dd->tsim == tf))) {
......
Markdown is supported
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