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 an assertion. #16053

Merged
merged 2 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion include/deal.II/multigrid/mg_constrained_dofs.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,8 @@ MGConstrainedDoFs::merge_constraints(AffineConstraints<Number> &constraints,
index_set.add_indices(
this->get_user_constraint_matrix(level).get_local_lines());

constraints.reinit(constraints.get_locally_owned_indices(), index_set);
constraints.reinit(level_constraints[level].get_locally_owned_indices(),
index_set);

// merge constraints
if (add_boundary_indices && this->have_boundary_indices())
Expand Down
7 changes: 7 additions & 0 deletions source/base/index_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@ IndexSet::add_indices(const IndexSet &other, const size_type offset)
bool
IndexSet::is_subset_of(const IndexSet &other) const
{
Assert(size() == other.size(),
ExcMessage("One index set can only be a subset of another if they "
"describe index spaces of the same size. The ones in "
"question here have sizes " +
std::to_string(size()) + " and " +
std::to_string(other.size()) + "."));

// See whether there are indices in the current set that are not in 'other'.
// If so, then this is clearly not a subset of 'other'.
IndexSet A_minus_B = *this;
Expand Down