]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add another assertion. 16102/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 Oct 2023 21:01:30 +0000 (15:01 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 5 Oct 2023 21:01:30 +0000 (15:01 -0600)
include/deal.II/lac/affine_constraints.templates.h

index c00d803f46c6008f4640d507de1e00a48e470c4c..00a912d874318575f5d2d78cd239dfe05f4daf68 100644 (file)
@@ -2671,9 +2671,23 @@ AffineConstraints<number>::distribute(VectorType &vec) const
             // pass as arguments...
 #ifdef DEBUG
           if (needed_elements_for_distribute != IndexSet())
-            for (const auto i : vec_owned_elements)
-              Assert(needed_elements_for_distribute.is_element(i),
-                     ExcInternalError());
+            {
+              Assert(vec_owned_elements.size() ==
+                       needed_elements_for_distribute.size(),
+                     ExcMessage("You have previously initialized this "
+                                "AffineConstraints object with an index set "
+                                "that stated that vectors have size " +
+                                std::to_string(locally_owned_dofs.size()) +
+                                " entries, but you are now calling "
+                                "AffineConstraints::distribute() with a vector "
+                                "of size " +
+                                std::to_string(vec_owned_elements.size()) +
+                                "."));
+
+              for (const auto i : vec_owned_elements)
+                Assert(needed_elements_for_distribute.is_element(i),
+                       ExcInternalError());
+            }
 #endif
 
           VectorType ghosted_vector;

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.