Skip to content

Commit

Permalink
Simulation support: reinitialise our solver, if needed, at the beginn…
Browse files Browse the repository at this point in the history
…ing of our forever loop.

Not sure why it used to be at the end of our forever loop since it
clearly ought to be at the beginning (to ensure that our call to
OdeSolver::solve() is right).
  • Loading branch information
agarny committed Mar 2, 2018
1 parent 0c6f407 commit 11d48a0
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/plugins/support/SimulationSupport/src/simulationworker.cpp
Expand Up @@ -285,6 +285,17 @@ void SimulationWorker::started()
QMutex pausedMutex;

forever {
// Reinitialise our solver, if we have an NLA solver or if the model
// got reset
// Note: indeed, with a solver such as CVODE, we need to update our
// internals...

if (nlaSolver || mReset) {
odeSolver->reinitialize(mCurrentPoint);

mReset = false;
}

// Determine our next point and compute our model up to it

++pointCounter;
Expand Down Expand Up @@ -348,17 +359,6 @@ void SimulationWorker::started()
timer.start();

}

// Reinitialise our solver, if we have an NLA solver or if the
// model got reset
// Note: indeed, with a solver such as CVODE, to solve an NLA
// system requires updating its internals...

if (nlaSolver || mReset) {
odeSolver->reinitialize(mCurrentPoint);

mReset = false;
}
}
}

Expand Down

0 comments on commit 11d48a0

Please sign in to comment.