[1D] Fix accumulation of Jacobian stats

This commit is contained in:
Ray Speth 2025-01-03 15:17:40 -05:00 committed by Ingmar Schoegl
parent 2928a4e66d
commit 5a8cd8597f
2 changed files with 8 additions and 1 deletions

View File

@ -183,6 +183,12 @@ public:
m_age = age;
}
void clearStats() {
m_elapsed = 0.0;
m_nevals = 0;
m_age = 100000;
}
protected:
//! Factorize the system matrix. This method should be called at the end of
//! implementations of updatePreconditioner() and updateTransient().

View File

@ -107,6 +107,7 @@ void OneDim::setLinearSolver(shared_ptr<SystemJacobian> solver)
m_jac = solver;
m_jac->initialize(size());
m_jac->setBandwidth(bandwidth());
m_jac->clearStats();
m_jac_ok = false;
}
@ -217,12 +218,12 @@ void OneDim::resize()
m_newt->resize(size());
m_mask.resize(size());
// delete the current Jacobian evaluator and create a new one
if (!m_jac) {
m_jac = newSystemJacobian("banded-direct");
}
m_jac->initialize(size());
m_jac->setBandwidth(bandwidth());
m_jac->clearStats();
m_jac_ok = false;
}