]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Two minor improvements
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 27 May 2013 15:25:21 +0000 (15:25 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 27 May 2013 15:25:21 +0000 (15:25 +0000)
git-svn-id: https://svn.dealii.org/trunk@29649 0785d39b-7218-0410-832d-ea1e28bc413d

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

index d71c786ea6d21b70ecefa0695f7ff7647556ff06..f95d78697c98f058d115609753ba8fb2bea531e7 100644 (file)
@@ -561,8 +561,9 @@ namespace parallel
       // as there are processors and start writing
       // when it's our turn
 #ifdef DEAL_II_WITH_MPI
-      for (unsigned int i=0; i<partitioner->this_mpi_process(); i++)
-        MPI_Barrier (partitioner->get_communicator());
+      if (partitioner->n_mpi_processes() > 1)
+        for (unsigned int i=0; i<partitioner->this_mpi_process(); i++)
+          MPI_Barrier (partitioner->get_communicator());
 #endif
 
       out << "Process #" << partitioner->this_mpi_process() << std::endl
@@ -590,11 +591,14 @@ namespace parallel
       out << std::endl << std::flush;
 
 #ifdef DEAL_II_WITH_MPI
-      MPI_Barrier (partitioner->get_communicator());
+      if (partitioner->n_mpi_processes() > 1)
+        {
+          MPI_Barrier (partitioner->get_communicator());
 
-      for (unsigned int i=partitioner->this_mpi_process()+1;
-           i<partitioner->n_mpi_processes(); i++)
-        MPI_Barrier (partitioner->get_communicator());
+          for (unsigned int i=partitioner->this_mpi_process()+1;
+               i<partitioner->n_mpi_processes(); i++)
+            MPI_Barrier (partitioner->get_communicator());
+        }
 #endif
 
       AssertThrow (out, ExcIO());
index 9d34b5958a49f7c074a151697485b1e3ee8bfcbb..c0c2cf9ac74c779b1e1fd8c15d2343dca50b4f72 100644 (file)
@@ -1793,14 +1793,19 @@ PreconditionChebyshev<MATRIX,VECTOR>::initialize (const MATRIX &matrix,
       // read the log stream: grab the first and last eigenvalue
       std::string cg_message = log_msg.str();
       const std::size_t pos = cg_message.find("cg:: ");
-      Assert(pos < std::string::npos, ExcInternalError());
-      cg_message.erase(0, pos+5);
-      std::istringstream os1(cg_message);
-      os1 >> min_eigenvalue;
-      for (unsigned int i=0; i<control.last_step()-1; ++i)
-        cg_message.erase(0, cg_message.find_first_of(" ")+1);
-      std::istringstream os2(cg_message);
-      os2 >> max_eigenvalue;
+      if (pos != std::string::npos)
+        {
+          cg_message.erase(0, pos+5);
+          std::string first = cg_message;
+
+          first.erase(cg_message.find_first_of(" "), std::string::npos);
+          std::istringstream(first)      >> min_eigenvalue;
+
+          cg_message.erase(0, cg_message.find_last_of(" ")+1);
+          std::istringstream(cg_message) >> max_eigenvalue;
+        }
+      else
+        min_eigenvalue = max_eigenvalue = 1;
 
       // reset deal.II stream
       deallog.detach();

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.