From: Wolfgang Bangerth Date: Fri, 7 Aug 2009 19:01:42 +0000 (+0000) Subject: Utilities::Trilinos::comm_self. X-Git-Tag: v8.0.0~7361 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c70c48385d5f892674d26ccffe1ce8d02f50282c;p=dealii.git Utilities::Trilinos::comm_self. git-svn-id: https://svn.dealii.org/trunk@19207 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/utilities.h b/deal.II/base/include/base/utilities.h index 195e4eb79d..211feb61d3 100644 --- a/deal.II/base/include/base/utilities.h +++ b/deal.II/base/include/base/utilities.h @@ -366,6 +366,22 @@ namespace Utilities */ const Epetra_Comm& comm_world(); + /** + * Returns a Trilinos Epetra_Comm + * object needed for creation of + * Epetra_Maps. + * + * If deal.II has been configured to use + * a compiler that does not support MPI + * then the resulting communicator will + * be a serial one. Otherwise, the + * communicator will correspond to + * MPI_COMM_SELF, i.e. a communicator + * that comprises only this one + * processor. + */ + const Epetra_Comm& comm_self(); + /** * Given a communicator, duplicate it. If * the given communicator is serial, that diff --git a/deal.II/base/source/utilities.cc b/deal.II/base/source/utilities.cc index 1c0b7108b1..c4e6a4d867 100644 --- a/deal.II/base/source/utilities.cc +++ b/deal.II/base/source/utilities.cc @@ -609,6 +609,22 @@ namespace Utilities + const Epetra_Comm& + comm_self() + { +#ifdef DEAL_II_COMPILER_SUPPORTS_MPI + static Teuchos::RCP + communicator = Teuchos::rcp (new Epetra_MpiComm (MPI_COMM_SELF), true); +#else + static Teuchos::RCP + communicator = Teuchos::rcp (new Epetra_SerialComm (), true); +#endif + + return *communicator; + } + + + Epetra_Comm * duplicate_communicator (const Epetra_Comm &communicator) {