From 5f8d6c22b2044cdb8454e25700dd5448d531d122 Mon Sep 17 00:00:00 2001 From: Rene Gassmoeller Date: Fri, 28 Feb 2025 17:16:22 +0100 Subject: [PATCH] Do not report invalid_unsigned_int for valid output --- source/postprocess/global_statistics.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/postprocess/global_statistics.cc b/source/postprocess/global_statistics.cc index aae8dd2e811..5c0891d17b6 100644 --- a/source/postprocess/global_statistics.cc +++ b/source/postprocess/global_statistics.cc @@ -111,10 +111,19 @@ namespace aspect if (column_name == advection_iterations[i].first) column_position = i; + // If the solver was not called (e.g. the field + // was computed by the material model), then the solver control + // object stores an invalid number of iterations. However, it + // is equally true and more intuitive to say that in this case + // the solver did not need to do any iterations. + unsigned int n_iterations = solver_control.last_step(); + if (n_iterations == numbers::invalid_unsigned_int) + n_iterations = 0; + if (column_position == numbers::invalid_unsigned_int) - advection_iterations.emplace_back(column_name,std::vector(1,solver_control.last_step())); + advection_iterations.emplace_back(column_name,std::vector(n_iterations)); else - advection_iterations[column_position].second.push_back(solver_control.last_step()); + advection_iterations[column_position].second.push_back(n_iterations); }