From: Martin Kronbichler Date: Thu, 22 Jun 2023 11:45:04 +0000 (+0200) Subject: Fix bug in AffineConstraints::make_sorted_row_list X-Git-Tag: v9.5.0-rc1~57^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15431%2Fhead;p=dealii.git Fix bug in AffineConstraints::make_sorted_row_list --- diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index f385c04284..8df61f8e87 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -3844,7 +3844,11 @@ AffineConstraints::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