From 5eb427b698605c71c2d847d178a4b5d4684e7621 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 24 Jul 2023 16:11:58 -0600 Subject: [PATCH] Add an assertion. --- include/deal.II/lac/affine_constraints.templates.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 3ff0add653..55e2d3e0a6 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -2560,6 +2560,18 @@ AffineConstraints::distribute(VectorType &vec) const if (dealii::is_serial_vector::value == false) { + // Check that the set of indices we will import is a superset of + // the locally-owned ones. This *should* be the case if, as one + // would expect, the AffineConstraint object was initialized + // with a locally-relevant index set that is indeed a superset + // of the locally-owned indices. But you never know what people + // pass as arguments... +#ifdef DEBUG + for (const auto i : vec_owned_elements) + Assert(needed_elements_for_distribute.is_element(i), + ExcInternalError()); +#endif + VectorType ghosted_vector; internal::import_vector_with_ghost_elements( vec, -- 2.39.5