Skip to content

Commit

Permalink
Add an assertion.
Browse files Browse the repository at this point in the history
  • Loading branch information
bangerth committed Sep 27, 2023
1 parent f87a670 commit 4d1ba2e
Showing 1 changed file with 7 additions and 0 deletions.
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 4d1ba2e

Please sign in to comment.