]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix assert message for empty vector 13340/head
authorPeter Munch <peterrmuench@gmail.com>
Sun, 6 Feb 2022 06:01:38 +0000 (07:01 +0100)
committerPeter Munch <peterrmuench@gmail.com>
Sun, 6 Feb 2022 06:01:38 +0000 (07:01 +0100)
include/deal.II/lac/la_parallel_vector.h

index 15988bdc09f13dcffe764593c0548656bd38f16b..a8be74856501f5f1f1210ea610ca41f5685f8518 100644 (file)
@@ -1640,7 +1640,9 @@ namespace LinearAlgebra
           partitioner->ghost_indices().is_element(global_index),
         ExcAccessToNonLocalElement(global_index,
                                    partitioner->local_range().first,
-                                   partitioner->local_range().second - 1,
+                                   partitioner->local_range().second == 0 ?
+                                     0 :
+                                     (partitioner->local_range().second - 1),
                                    partitioner->ghost_indices().n_elements()));
       // do not allow reading a vector which is not in ghost mode
       Assert(partitioner->in_local_range(global_index) ||
@@ -1664,7 +1666,9 @@ namespace LinearAlgebra
           partitioner->ghost_indices().is_element(global_index),
         ExcAccessToNonLocalElement(global_index,
                                    partitioner->local_range().first,
-                                   partitioner->local_range().second - 1,
+                                   partitioner->local_range().second == 0 ?
+                                     0 :
+                                     (partitioner->local_range().second - 1),
                                    partitioner->ghost_indices().n_elements()));
       // we would like to prevent reading ghosts from a vector that does not
       // have them imported, but this is not possible because we might be in a

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.