From: David Wells Date: Sun, 11 Aug 2024 21:24:31 +0000 (-0600) Subject: PETScWrappers::MatrixBase: fix an assertion. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2efb45bb7378dda18562170d5d0ce6bcc1ddba1;p=dealii.git PETScWrappers::MatrixBase: fix an assertion. --- 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