floating point computations on cygwin systems. */
#undef DEAL_II_BROKEN_SOCKETS
-/* Defined if the compiler we use supports the upcoming C++1x standard. */
+/* Defined if the compiler we use supports the C++2011 standard well enough to
+ allow using the standard library classes instead of the corresponding BOOST
+ classes. */
#undef DEAL_II_CAN_USE_CXX1X
/* Backward compatibility support for functions and classes that do not take
void sum (const std::vector<T> &values,
const MPI_Comm &mpi_communicator,
std::vector<T> &sums);
-
+
/**
* Return the maximum over all processors of the value @p t. This function
* is collective over all processors given in the communicator. If
const MPI_Comm &mpi_communicator,
T (&maxima)[N]);
+ /**
+ * Like the previous function,
+ * but take the maximum over the
+ * elements of a std::vector. In other words,
+ * the i-th element of the
+ * results array is the maximum over
+ * the i-th entries of the input
+ * arrays from each processor.
+ */
+ template <typename T>
+ inline
+ void max (const std::vector<T> &values,
+ const MPI_Comm &mpi_communicator,
+ std::vector<T> &maxima);
+
/**
* Data structure to store the result of
* min_max_avg().
#endif
}
-
+
template <typename T>
inline
void sum (const std::vector<T> &values,
#endif
}
-
+
template <typename T>
inline
T max (const T &t,
maxima[i] = values[i];
#endif
}
+
+
+ template <typename T>
+ inline
+ void max (const std::vector<T> &values,
+ const MPI_Comm &mpi_communicator,
+ std::vector<T> &maxima)
+ {
+#ifdef DEAL_II_COMPILER_SUPPORTS_MPI
+ maxima.resize (values.size());
+ MPI_Allreduce (const_cast<void*>(static_cast<const void*>(&values[0])),
+ &maxima[0], values.size(), internal::mpi_type_id((T*)0), MPI_MAX,
+ mpi_communicator);
+#else
+ (void)mpi_communicator;
+ maxima = values;
+#endif
+ }
} // end of namespace MPI
} // end of namespace Utilities