DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
operations.hpp
1 #include <functional>
2 
3 namespace diy
4 {
5 namespace mpi
6 {
9  template<class U>
10  struct maximum { const U& operator()(const U& x, const U& y) const { return std::max(x,y); } };
11  template<class U>
12  struct minimum { const U& operator()(const U& x, const U& y) const { return std::min(x,y); } };
14 
15 namespace detail
16 {
17  template<class T> struct mpi_op { static MPI_Op get(); };
18  template<class U> struct mpi_op< maximum<U> > { static MPI_Op get() { return MPI_MAX; } };
19  template<class U> struct mpi_op< minimum<U> > { static MPI_Op get() { return MPI_MIN; } };
20  template<class U> struct mpi_op< std::plus<U> > { static MPI_Op get() { return MPI_SUM; } };
21  template<class U> struct mpi_op< std::multiplies<U> > { static MPI_Op get() { return MPI_PROD; } };
22  template<class U> struct mpi_op< std::logical_and<U> > { static MPI_Op get() { return MPI_LAND; } };
23  template<class U> struct mpi_op< std::logical_or<U> > { static MPI_Op get() { return MPI_LOR; } };
24 }
25 }
26 }
Definition: operations.hpp:10
Definition: operations.hpp:12