#if defined(DEAL_II_COMPILER_SUPPORTS_MPI) || defined(DEAL_II_USE_PETSC)
#include <mpi.h>
#else
-typedef int MPI_Comm;
+//typedef int MPI_Comm;
+#include <mpi.h>
#endif
#ifdef DEAL_II_USE_TRILINOS
*/
std::string get_time ();
+ /**
+ * Return whether (i) deal.II has
+ * been compiled to support MPI
+ * (for example by compiling with
+ * <code>CXX=mpiCC</code>) and if
+ * so whether (ii)
+ * <code>MPI_Init()</code> has
+ * been called (for example using
+ * the
+ * Utilities::System::MPI_InitFinalize
+ * class). In other words, the
+ * result indicates whether the
+ * current job is running under
+ * MPI.
+ */
+ bool job_supports_mpi ();
+
/**
* Return the number of MPI processes
* there exist in the given communicator
#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+
+ bool job_supports_mpi ()
+ {
+ int MPI_has_been_started = 0;
+ MPI_Initialized(&MPI_has_been_started);
+
+ return (MPI_has_been_started > 0);
+ }
+
// Unfortunately, we have to work
// around an oddity in the way PETSc
// and some gcc versions interact. If
#else
+ bool job_supports_mpi ()
+ {
+ return false;
+ }
+
+
+
unsigned int get_n_mpi_processes (const MPI_Comm &)
{
return 1;
<h3>base</h3>
<ol>
+ <li>
+ <p>
+ New: The Utilities::System::job_supports_mpi() can be used to query whether
+ the current job runs under MPI or not.
+ <br>
+ (WB 2009/08/14)
+ </p>
+ </li>
+
<li>
<p>
New: The Utilities::Trilinos::comm_self function return an MPI