41 #include "Teuchos_Comm.hpp" 
   65            const Teuchos::Comm<int>& comm2)
 
   70   using Teuchos::rcpFromRef;
 
   71   using Teuchos::MpiComm;
 
   72   using Teuchos::rcp_dynamic_cast;
 
   74   RCP<const MpiComm<int> > mpiComm1 =
 
   75     rcp_dynamic_cast<
const MpiComm<int> > (rcpFromRef (comm1));
 
   76   RCP<const MpiComm<int> > mpiComm2 =
 
   77     rcp_dynamic_cast<
const MpiComm<int> > (rcpFromRef (comm2));
 
   79   if (mpiComm1.is_null ()) { 
 
   80     return comm1.getSize () == comm2.getSize (); 
 
   82     if (mpiComm2.is_null ()) { 
 
   83       return comm1.getSize () == comm2.getSize (); 
 
   85       MPI_Comm rawMpiComm1 = * (mpiComm1->getRawMpiComm ());
 
   86       MPI_Comm rawMpiComm2 = * (mpiComm2->getRawMpiComm ());
 
   88       int result = MPI_UNEQUAL;
 
   89       const int err = MPI_Comm_compare (rawMpiComm1, rawMpiComm2, &result);
 
   90       TEUCHOS_TEST_FOR_EXCEPTION(err != MPI_SUCCESS, std::runtime_error,
 
   91                                  "congruent: MPI_Comm_compare failed");
 
   92       return result == MPI_IDENT || result == MPI_CONGRUENT;
 
   96   return comm1.getSize () == comm2.getSize (); 
 
  100 std::unique_ptr<std::string>
 
  104   std::ostringstream os;
 
  105   os << 
"Proc " << myRank << 
": " << prefix << 
": ";
 
  106   return std::unique_ptr<std::string>(
new std::string(os.str()));
 
  109 std::unique_ptr<std::string>
 
  111              const char functionName[])
 
  113   const int myRank = comm == 
nullptr ? -1 : comm->getRank();
 
  114   const std::string prefix = std::string(
"Tpetra::") + functionName;
 
  118 std::unique_ptr<std::string>
 
  120              const char className[],
 
  121              const char methodName[])
 
  123   const int myRank = comm == 
nullptr ? -1 : comm->getRank();
 
  124   const std::string prefix = std::string(
"Tpetra::") +
 
  125     className + std::string(
"::") + methodName;
 
bool congruent(const Teuchos::Comm< int > &comm1, const Teuchos::Comm< int > &comm2)
Whether the two communicators are congruent. 
Stand-alone utility functions and macros. 
std::unique_ptr< std::string > createPrefix(const int myRank, const char prefix[])
Create string prefix for each line of verbose output.