Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add another assertion. #16102

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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