From: Wolfgang Bangerth Date: Wed, 27 Sep 2023 15:50:51 +0000 (-0600) Subject: Add an assertion. X-Git-Tag: relicensing~463^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1ba2ec65b933582604e71749921bc00de3e486;p=dealii.git Add an assertion. --- 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;