]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add an assertion. 16053/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 27 Sep 2023 15:50:51 +0000 (09:50 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 27 Sep 2023 22:02:36 +0000 (16:02 -0600)
source/base/index_set.cc

index 168e1ecaa09b69e49b0b49b7659b34769f821d9f..d9174be6b9008e64fb4a1740eace35da0215917d 100644 (file)
@@ -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;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.