]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Make comparison of ghost values in compress(VectorOperation::insert) safer.
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 7 Jun 2013 13:32:23 +0000 (13:32 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 7 Jun 2013 13:32:23 +0000 (13:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@29795 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/parallel_vector.templates.h

index c78dee525980e2aa69dc6066b4d8caccca6310e1..f59100d4a8b65c298272965d93b8f4622b0da484 100644 (file)
@@ -204,7 +204,9 @@ namespace parallel
       // nothing to do for insert (only need to zero ghost entries in
       // compress_finish(). in debug mode we still want to check consistency
       // of the inserted data, therefore the communication is still
-      // initialized
+      // initialized. Having different code in debug and optimized mode is
+      // somewhat dangerous, but it really saves communication so it seems
+      // still worthwhile.
 #ifndef DEBUG
       if (operation == VectorOperation::insert)
         return;
@@ -295,6 +297,16 @@ namespace parallel
     {
 #ifdef DEAL_II_WITH_MPI
 
+      // in optimized mode, no communication was started, so leave the
+      // function directly (and only clear ghosts)
+#ifndef DEBUG
+      if (operation == VectorOperation::insert)
+        {
+          zero_out_ghosts();
+          return;
+        }
+#endif
+
       const Utilities::MPI::Partitioner &part = *partitioner;
 
       // nothing to do when we neither have import
@@ -338,7 +350,7 @@ namespace parallel
                    j++, read_position++)
                 Assert(*read_position == 0. ||
                        std::abs(local_element(j) - *read_position) <
-                       std::abs(local_element(j)) * 100. *
+                       std::abs(local_element(j)) * 1000. *
                        std::numeric_limits<Number>::epsilon(),
                        ExcMessage("Inserted elements do not match."));
           AssertDimension(read_position-import_data,part.n_import_indices());

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.