]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Improve an error message in IndexSet::get_view(). 16118/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Sun, 10 Sep 2023 16:20:03 +0000 (10:20 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 10 Oct 2023 16:53:56 +0000 (10:53 -0600)
source/base/index_set.cc

index 383799cd9c334d93eb39f246dd54ef6e76c3ce43..64c8b524d8868c93096acdff538c5a1f07013ff0 100644 (file)
@@ -235,7 +235,13 @@ IndexSet::get_view(const size_type begin, const size_type end) const
 {
   Assert(begin <= end,
          ExcMessage("End index needs to be larger or equal to begin index!"));
-  Assert(end <= size(), ExcMessage("Given range exceeds index set dimension"));
+  Assert(end <= size(),
+         ExcMessage("You are asking for a view into an IndexSet object "
+                    "that would cover the sub-range [" +
+                    std::to_string(begin) + ',' + std::to_string(end) +
+                    "). But this is not a subset of the range "
+                    "of the current object, which is [0," +
+                    std::to_string(size()) + ")."));
 
   IndexSet                           result(end - begin);
   std::vector<Range>::const_iterator r1 = ranges.begin();

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.