Skip to content

Commit

Permalink
Simulation solver: slight improvement to our simulation worker.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jan 11, 2018
1 parent 54954f7 commit 3dfb15a
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/plugins/support/SimulationSupport/src/simulationworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,17 @@ void SimulationWorker::started()
QMutex pausedMutex;

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

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

mReset = false;
}

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

++pointCounter;
Expand Down Expand Up @@ -355,14 +359,6 @@ void SimulationWorker::started()

timer.start();
}

// Reinitialise our solver, if (really) needed

if (mReset && !mStopped) {
odeSolver->reinitialize(mCurrentPoint);

mReset = false;
}
}

// Retrieve the total elapsed time, should no error have occurred
Expand Down

0 comments on commit 3dfb15a

Please sign in to comment.