]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Improve error message when accessing vector elements in parallel. 11513/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 13 Jan 2021 17:28:14 +0000 (10:28 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 13 Jan 2021 17:28:14 +0000 (10:28 -0700)
include/deal.II/lac/la_parallel_vector.h
include/deal.II/lac/petsc_vector_base.h
include/deal.II/lac/trilinos_vector.h

index 09d25ee2189f9e96928b85ddc1ec38ea33efd4ed..0b23cc11dddbb64c8613e205eaf8eff748fd9259 100644 (file)
@@ -1209,17 +1209,26 @@ namespace LinearAlgebra
       /**
        * Exception
        */
-      DeclException4(ExcAccessToNonLocalElement,
-                     size_type,
-                     size_type,
-                     size_type,
-                     size_type,
-                     << "You tried to access element " << arg1
-                     << " of a distributed vector, but this element is not "
-                     << "stored on the current processor. Note: The range of "
-                     << "locally owned elements is " << arg2 << " to " << arg3
-                     << ", and there are " << arg4 << " ghost elements "
-                     << "that this vector can access.");
+      DeclException4(
+        ExcAccessToNonLocalElement,
+        size_type,
+        size_type,
+        size_type,
+        size_type,
+        << "You tried to access element " << arg1
+        << " of a distributed vector, but this element is not "
+        << "stored on the current processor. Note: The range of "
+        << "locally owned elements is " << arg2 << " to " << arg3
+        << ", and there are " << arg4 << " ghost elements "
+        << "that this vector can access."
+        << "\n\n"
+        << "A common source for this kind of problem is that you "
+        << "are passing a 'fully distributed' vector into a function "
+        << "that needs read access to vector elements that correspond "
+        << "to degrees of freedom on ghost cells (or at least to "
+        << "'locally active' degrees of freedom that are not also "
+        << "'locally owned'). You need to pass a vector that has these "
+        << "elements as ghost entries.");
 
     private:
       /**
index 296e757ce9ecf15e62e0f5c93d08eacf70221e8e..f9fa79f0129376c7e37f432162cd9d8f5f20c448 100644 (file)
@@ -173,14 +173,22 @@ namespace PETScWrappers
       /**
        * Exception
        */
-      DeclException3(ExcAccessToNonlocalElement,
-                     int,
-                     int,
-                     int,
-                     << "You tried to access element " << arg1
-                     << " of a distributed vector, but only elements " << arg2
-                     << " through " << arg3
-                     << " are stored locally and can be accessed.");
+      DeclException3(
+        ExcAccessToNonlocalElement,
+        int,
+        int,
+        int,
+        << "You tried to access element " << arg1
+        << " of a distributed vector, but only elements " << arg2 << " through "
+        << arg3 << " are stored locally and can be accessed."
+        << "\n\n"
+        << "A common source for this kind of problem is that you "
+        << "are passing a 'fully distributed' vector into a function "
+        << "that needs read access to vector elements that correspond "
+        << "to degrees of freedom on ghost cells (or at least to "
+        << "'locally active' degrees of freedom that are not also "
+        << "'locally owned'). You need to pass a vector that has these "
+        << "elements as ghost entries.");
       /**
        * Exception.
        */
index c5871b32e2e58240fe9a8670f194efb9b8525e1b..dfb0eeb925f341131d54b0c216c18707b32ee637 100644 (file)
@@ -1274,7 +1274,7 @@ namespace TrilinosWrappers
         size_type,
         size_type,
         size_type,
-        << "You tried to access element " << arg1
+        << "You are trying to access element " << arg1
         << " of a distributed vector, but this element is not stored "
         << "on the current processor. Note: There are " << arg2
         << " elements stored "
@@ -1282,7 +1282,15 @@ namespace TrilinosWrappers
         << " through " << arg4
         << " but Trilinos vectors need not store contiguous "
         << "ranges on each processor, and not every element in "
-        << "this range may in fact be stored locally.");
+        << "this range may in fact be stored locally."
+        << "\n\n"
+        << "A common source for this kind of problem is that you "
+        << "are passing a 'fully distributed' vector into a function "
+        << "that needs read access to vector elements that correspond "
+        << "to degrees of freedom on ghost cells (or at least to "
+        << "'locally active' degrees of freedom that are not also "
+        << "'locally owned'). You need to pass a vector that has these "
+        << "elements as ghost entries.");
 
     private:
       /**

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.