Commit 2381249f authored by René Heß's avatar René Heß
Browse files

Merge branch 'bugfix/newton-time-tracking' into 'master'

newton time tracking

See merge request !528
parents 08b9965e 0f388379
Pipeline #31317 passed with stage
in 31 minutes and 24 seconds
......@@ -227,9 +227,22 @@ namespace Dune::PDELab
// Prepare step
//=============
auto start = Clock::now();
prepareStep(solution);
try{
prepareStep(solution);
}
catch (...)
{
// Keep track of statistics when the method fails. We record
// independently the time spent in non-converging attempts.
// Check OneStepMethod to see how these data are propagated.
auto end = Clock::now();
assembler_time += end-start;
_result.assembler_time = to_seconds(assembler_time);
throw;
}
auto end = Clock::now();
assembler_time += end -start;
_result.assembler_time = to_seconds(assembler_time);
// Store defect
_previousDefect = _result.defect;
......@@ -243,11 +256,22 @@ namespace Dune::PDELab
if constexpr (linearSolverIsMatrixFree<LinearSolver>()){
_linearSolver.setLinearizationPoint(solution);
}
linearSolve();
try{
linearSolve();
}
catch (...)
{
// Separately catch statistics for linear solver failures.
end = Clock::now();
linear_solver_time += end-start;
_result.linear_solver_time = to_seconds(linear_solver_time);
_result.linear_solver_iterations = _linearSolver.result().iterations;
throw;
}
end = Clock::now();
linear_solver_time += end -start;
_result.linear_solver_time += to_seconds(linear_solver_time);
_result.linear_solver_iterations += _linearSolver.result().iterations;
_result.linear_solver_time = to_seconds(linear_solver_time);
_result.linear_solver_iterations = _linearSolver.result().iterations;
//===================================
// Do line search and update solution
......
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