]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix bug in AffineConstraints::make_sorted_row_list 15431/head
authorMartin Kronbichler <martin.kronbichler@uni-a.de>
Thu, 22 Jun 2023 11:45:04 +0000 (13:45 +0200)
committerMartin Kronbichler <martin.kronbichler@uni-a.de>
Thu, 22 Jun 2023 11:45:04 +0000 (13:45 +0200)
include/deal.II/lac/affine_constraints.templates.h

index f385c042842b2b5f68cb9bbec7c6b0af090e9cd5..8df61f8e87fdb4d45839df87917f485ea53ec5dc 100644 (file)
@@ -3844,7 +3844,11 @@ AffineConstraints<number>::make_sorted_row_list(
       for (size_type q = 0; q < position.entries.size(); ++q)
         {
           const size_type new_index = position.entries[q].first;
-          if (active_dofs[active_dofs.size() - i] < new_index)
+          // in case all dofs are constrained, we might insert at
+          // active_dofs.begin(), but we should never insert before that
+          AssertIndexRange(i - 1, active_dofs.size() + 1);
+          if (i > active_dofs.size() ||
+              active_dofs[active_dofs.size() - i] < new_index)
             active_dofs.insert(active_dofs.end() - i + 1, new_index);
 
           // make binary search to find where to put the new index in order to

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.