std::vector<unsigned int>
invert_permutation (const std::vector<unsigned int> &permutation);
+ /**
+ * A namespace for utility functions that
+ * abstract certain operations using the
+ * Message Passing Interface (MPI) or
+ * provide fallback operations in
+ * case deal.II is configured not to use
+ * MPI at all.
+ *
+ * @ingroup utilities
+ */
+ namespace MPI
+ {
+ /**
+ * Return the sum over all processors of the value @p t. This function
+ * is collective over all processors given in the communicator. If
+ * deal.II is not configured for use of MPI, this function simply
+ * returns the value of @p t. This function corresponds to the
+ * <code>MPI_Allreduce</code> function, i.e. all processors receive
+ * the result of this operation.
+ *
+ * @note This function is only implemented for certain template
+ * arguments <code>T</code>, namely <code>float, double, int,
+ * unsigned int</code>.
+ */
+ template <typename T>
+ T sum (const T &t,
+ const MPI_Comm &mpi_communicator);
+ }
/**
* A namespace for utility functions that
* probe system properties.
*/
MPI_Comm duplicate_communicator (const MPI_Comm &mpi_communicator);
-
- /**
- * Return the sum over all processors of the value @p t. This function
- * is collective over all processors given in the communicator. If
- * deal.II is not configured for use of MPI, this function simply
- * returns the value of @p t. This function corresponds to the
- * <code>MPI_Allreduce</code> function, i.e. all processors receive
- * the result of this operation.
- *
- * @note This function is only implemented for certain template
- * arguments <code>T</code>, namely <code>float, double, int,
- * unsigned int</code>.
- */
- template <typename T>
- T calculate_collective_mpi_sum (const T &t,
- const MPI_Comm &mpi_communicator);
-
/**
* Data structure to store the result of
* calculate_collective_mpi_min_max_avg.
}
- namespace System
+ namespace MPI
{
namespace internal
{
template <typename T>
inline
- T calculate_collective_mpi_sum (const T &t,
- const MPI_Comm &mpi_communicator)
+ T sum (const T &t,
+ const MPI_Comm &mpi_communicator)
{
#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
T sum;
int int_sum, uint_sum, double_sum, float_sum;
int_sum
=
- Utilities::System::calculate_collective_mpi_sum<int>(myid+1,
- MPI_COMM_WORLD);
+ Utilities::MPI::sum<int>(myid+1,
+ MPI_COMM_WORLD);
uint_sum
=
- Utilities::System::calculate_collective_mpi_sum<unsigned int>(myid+1,
- MPI_COMM_WORLD);
+ Utilities::MPI::sum<unsigned int>(myid+1,
+ MPI_COMM_WORLD);
float_sum
=
- Utilities::System::calculate_collective_mpi_sum<float>(myid+1,
- MPI_COMM_WORLD);
+ Utilities::MPI::sum<float>(myid+1,
+ MPI_COMM_WORLD);
double_sum
=
- Utilities::System::calculate_collective_mpi_sum<double>(myid+1,
- MPI_COMM_WORLD);
+ Utilities::MPI::sum<double>(myid+1,
+ MPI_COMM_WORLD);
if (myid==0)
deallog << int_sum << ' ' << uint_sum << ' ' << double_sum << ' ' << float_sum << std::endl;