From f2efb45bb7378dda18562170d5d0ce6bcc1ddba1 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 11 Aug 2024 15:24:31 -0600 Subject: [PATCH] PETScWrappers::MatrixBase: fix an assertion. --- source/lac/petsc_matrix_base.cc | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/source/lac/petsc_matrix_base.cc b/source/lac/petsc_matrix_base.cc index 17ca8ae366..ada3a2220e 100644 --- a/source/lac/petsc_matrix_base.cc +++ b/source/lac/petsc_matrix_base.cc @@ -166,11 +166,8 @@ namespace PETScWrappers // now set all the entries of these rows to zero # ifdef DEBUG - for (size_type i = 0; i < rows.size(); ++i) - { - const auto row = static_cast(rows[i]); - AssertIntegerConversion(row, rows[i]); - } + for (const auto &row : rows) + AssertIntegerConversion(static_cast(row), row); # endif const std::vector petsc_rows(rows.begin(), rows.end()); @@ -201,11 +198,8 @@ namespace PETScWrappers // now set all the entries of these rows to zero # ifdef DEBUG - for (size_type i = 0; i < rows.size(); ++i) - { - const auto row = static_cast(rows[i]); - AssertIntegerConversion(row, rows[i]); - } + for (const auto &row : rows) + AssertIntegerConversion(static_cast(row), row); # endif const std::vector petsc_rows(rows.begin(), rows.end()); @@ -410,7 +404,7 @@ namespace PETScWrappers // something that is unreasonable. there should simply be a way in PETSc to // query the number of entries in a row bypassing the call to compress(), // but I can't find one - Assert(row < m(), ExcInternalError()); + AssertIndexRange(row, m()); // get a representation of the present // row -- 2.39.5