From 4d1ba2ec65b933582604e71749921bc00de3e486 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 27 Sep 2023 09:50:51 -0600 Subject: [PATCH] Add an assertion. --- source/base/index_set.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 168e1ecaa0..d9174be6b9 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -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; -- 2.39.5