Skip to content

Commit

Permalink
Merge pull request #16102 from bangerth/assert-2
Browse files Browse the repository at this point in the history
Add another assertion.
  • Loading branch information
marcfehling committed Oct 6, 2023
2 parents 1c94ef6 + d22bfd0 commit baff8c9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions include/deal.II/lac/affine_constraints.templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -2671,9 +2671,23 @@ AffineConstraints<number>::distribute(VectorType &vec) const
// pass as arguments...
#ifdef DEBUG
if (needed_elements_for_distribute != IndexSet())
for (const auto i : vec_owned_elements)
Assert(needed_elements_for_distribute.is_element(i),
ExcInternalError());
{
Assert(vec_owned_elements.size() ==
needed_elements_for_distribute.size(),
ExcMessage("You have previously initialized this "
"AffineConstraints object with an index set "
"that stated that vectors have size " +
std::to_string(locally_owned_dofs.size()) +
" entries, but you are now calling "
"AffineConstraints::distribute() with a vector "
"of size " +
std::to_string(vec_owned_elements.size()) +
"."));

for (const auto i : vec_owned_elements)
Assert(needed_elements_for_distribute.is_element(i),
ExcInternalError());
}
#endif

VectorType ghosted_vector;
Expand Down

0 comments on commit baff8c9

Please sign in to comment.