]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fixed: TrilinosWrappers::Vector::all_zero() in parallel.
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 6 Mar 2012 23:17:06 +0000 (23:17 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 6 Mar 2012 23:17:06 +0000 (23:17 +0000)
git-svn-id: https://svn.dealii.org/trunk@25215 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/source/lac/trilinos_vector_base.cc

index 92fc9e9ffa0c1f4f008f38a037485694127df0e6..dca8d9240f3140da0b632fc06a6fc1a1c3961f33 100644 (file)
@@ -145,6 +145,10 @@ enabled due to a missing include file in file
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Fixed: TrilinosWrappers::Vector::all_zero() in parallel.
+<br>
+(Timo Heister, J&ouml;rg Frohne, 2012/03/06)
+
 <li> New: GridGenerator::quarter_hyper_shell() in 3d.
 <br>
 (Thomas Geenen, 2012/03/05)
index 2a535f881c094a4e7c51c982ee9397334472c0c7..8b6ec7a97ef2d3564ab9a92fbe1ceace73953c1f 100644 (file)
@@ -270,18 +270,28 @@ namespace TrilinosWrappers
     TrilinosScalar *start_ptr = (*vector)[0];
     const TrilinosScalar *ptr  = start_ptr,
                          *eptr = start_ptr + local_size();
-    bool flag = true;
+    unsigned int flag = 0;
     while (ptr != eptr)
       {
        if (*ptr != 0)
          {
-           flag = false;
+           flag = 1;
            break;
          }
        ++ptr;
       }
 
-    return flag;
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+                                    // in parallel, check that the vector
+                                    // is zero on _all_ processors.
+    const Epetra_MpiComm *mpi_comm
+      = dynamic_cast<const Epetra_MpiComm*>(&vector->Map().Comm());
+    unsigned int num_nonzero = Utilities::MPI::sum(flag, mpi_comm->Comm());
+    return num_nonzero == 0;
+#else
+    return flag == 0;
+#endif
+    
   }
 
 

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.