From fcfbc94dbee895af0055315441714b869a44a813 Mon Sep 17 00:00:00 2001 From: Martin Kronbichler Date: Thu, 22 Jun 2023 13:45:04 +0200 Subject: [PATCH] Fix bug in AffineConstraints::make_sorted_row_list --- include/deal.II/lac/affine_constraints.templates.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.5