]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add assert 15055/head
authorPeter Munch <peterrmuench@gmail.com>
Sat, 8 Apr 2023 16:32:05 +0000 (18:32 +0200)
committerPeter Munch <peterrmuench@gmail.com>
Sat, 8 Apr 2023 16:50:38 +0000 (18:50 +0200)
include/deal.II/matrix_free/matrix_free.h

index d9690891575cca964164b2bf03447264f2c6071c..78fb2426bb0541960162113cb174e7ce4be0f3ae 100644 (file)
@@ -3401,7 +3401,7 @@ namespace internal
                               const VectorType & vec)
     {
       (void)component_in_block_vector;
-      bool ghosts_set = vec.has_ghost_elements();
+      const bool ghosts_set = vec.has_ghost_elements();
 
       Assert(matrix_free.get_task_info().allow_ghosted_vectors_in_loops ||
                ghosts_set == false,
@@ -3429,7 +3429,7 @@ namespace internal
                               const VectorType & vec)
     {
       (void)component_in_block_vector;
-      bool ghosts_set = vec.has_ghost_elements();
+      const bool ghosts_set = vec.has_ghost_elements();
 
       Assert(matrix_free.get_task_info().allow_ghosted_vectors_in_loops ||
                ghosts_set == false,
@@ -3461,7 +3461,7 @@ namespace internal
         std::is_same<Number, typename VectorType::value_type>::value,
         "Type mismatch between VectorType and VectorDataExchange");
       (void)component_in_block_vector;
-      bool ghosts_set = vec.has_ghost_elements();
+      const bool ghosts_set = vec.has_ghost_elements();
 
       Assert(matrix_free.get_task_info().allow_ghosted_vectors_in_loops ||
                ghosts_set == false,
@@ -4078,9 +4078,16 @@ namespace internal
   {
     if (get_communication_block_size(vec) < vec.n_blocks())
       {
-        // don't forget to set ghosts_were_set, that otherwise happens
-        // inside VectorDataExchange::update_ghost_values_start()
-        exchanger.ghosts_were_set = vec.has_ghost_elements();
+        const bool ghosts_set = vec.has_ghost_elements();
+
+        Assert(exchanger.matrix_free.get_task_info()
+                   .allow_ghosted_vectors_in_loops ||
+                 ghosts_set == false,
+               ExcNotImplemented());
+
+        if (ghosts_set)
+          exchanger.ghosts_were_set = true;
+
         vec.update_ghost_values();
       }
     else

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.