From: Wolfgang Bangerth Date: Mon, 24 Jul 2023 22:11:58 +0000 (-0600) Subject: Add an assertion. X-Git-Tag: relicensing~496^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eb427b698605c71c2d847d178a4b5d4684e7621;p=dealii.git Add an assertion. --- 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,