]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prohibit calling compress() on vectors with ghost elements.
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 21 Dec 2023 22:42:18 +0000 (15:42 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 21 Dec 2023 22:42:18 +0000 (15:42 -0700)
source/lac/petsc_vector_base.cc
source/lac/trilinos_vector.cc

index d3db0022dd7eaa7119c0198b7e8790b2fd884d8d..052af43735e470193a7d127af81eee9e78afc8f7 100644 (file)
@@ -540,6 +540,13 @@ namespace PETScWrappers
   void
   VectorBase::compress(const VectorOperation::values operation)
   {
+    Assert(has_ghost_elements() == false,
+           ExcMessage("Calling compress() is only useful if a vector "
+                      "has been written into, but this is a vector with ghost "
+                      "elements and consequently is read-only. It does "
+                      "not make sense to call compress() for such "
+                      "vectors."));
+
     {
 #  ifdef DEBUG
       // Check that all processors agree that last_action is the same (or none!)
index 0431f266b93afbc4aba133f2a382c5458b05f9f5..8d26487152f4645a83aa3be018e0999834e98fe9 100644 (file)
@@ -599,6 +599,14 @@ namespace TrilinosWrappers
     void
     Vector::compress(VectorOperation::values given_last_action)
     {
+      Assert(has_ghost_elements() == false,
+             ExcMessage(
+               "Calling compress() is only useful if a vector "
+               "has been written into, but this is a vector with ghost "
+               "elements and consequently is read-only. It does "
+               "not make sense to call compress() for such "
+               "vectors."));
+
       // Select which mode to send to Trilinos. Note that we use last_action if
       // available and ignore what the user tells us to detect wrongly mixed
       // operations. Typically given_last_action is only used on machines that

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.