Skip to content

Commit

Permalink
Merge pull request #16053 from bangerth/subset
Browse files Browse the repository at this point in the history
Add an assertion.
  • Loading branch information
peterrum committed Sep 28, 2023
2 parents 0b65fff + 4d1ba2e commit e8f5713
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit e8f5713

Please sign in to comment.