From: kronbichler Date: Mon, 27 May 2013 15:25:21 +0000 (+0000) Subject: Two minor improvements X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56402350b7bc136d035594cb0e2be04449444a72;p=dealii-svn.git Two minor improvements git-svn-id: https://svn.dealii.org/trunk@29649 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/parallel_vector.templates.h b/deal.II/include/deal.II/lac/parallel_vector.templates.h index d71c786ea6..f95d78697c 100644 --- a/deal.II/include/deal.II/lac/parallel_vector.templates.h +++ b/deal.II/include/deal.II/lac/parallel_vector.templates.h @@ -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; ithis_mpi_process(); i++) - MPI_Barrier (partitioner->get_communicator()); + if (partitioner->n_mpi_processes() > 1) + for (unsigned int i=0; ithis_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; - in_mpi_processes(); i++) - MPI_Barrier (partitioner->get_communicator()); + for (unsigned int i=partitioner->this_mpi_process()+1; + in_mpi_processes(); i++) + MPI_Barrier (partitioner->get_communicator()); + } #endif AssertThrow (out, ExcIO()); diff --git a/deal.II/include/deal.II/lac/precondition.h b/deal.II/include/deal.II/lac/precondition.h index 9d34b5958a..c0c2cf9ac7 100644 --- a/deal.II/include/deal.II/lac/precondition.h +++ b/deal.II/include/deal.II/lac/precondition.h @@ -1793,14 +1793,19 @@ PreconditionChebyshev::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> 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();