DIY  3.0
data-parallel out-of-core C++ library
 All Classes Namespaces Functions Typedefs Groups Pages
status.hpp
1 namespace diy
2 {
3 namespace mpi
4 {
5  struct status
6  {
7  int source() const { return s.MPI_SOURCE; }
8  int tag() const { return s.MPI_TAG; }
9  int error() const { return s.MPI_ERROR; }
10 
11  inline
12  bool cancelled() const;
13 
14  template<class T>
15  int count() const;
16 
17  operator MPI_Status&() { return s; }
18  operator const MPI_Status&() const { return s; }
19 
20  MPI_Status s;
21  };
22 }
23 }
24 
25 
26 bool
27 diy::mpi::status::cancelled() const
28 {
29 #ifndef DIY_NO_MPI
30  int flag;
31  MPI_Test_cancelled(const_cast<MPI_Status*>(&s), &flag);
32  return flag;
33 #else
34  DIY_UNSUPPORTED_MPI_CALL(diy::mpi::status::cancelled);
35 #endif
36 }
37 
38 template<class T>
39 int
40 diy::mpi::status::count() const
41 {
42 #ifndef DIY_NO_MPI
43  int c;
44  MPI_Get_count(const_cast<MPI_Status*>(&s), detail::get_mpi_datatype<T>(), &c);
45  return c;
46 #else
47  DIY_UNSUPPORTED_MPI_CALL(diy::mpi::status::count);
48 #endif
49 }
Definition: no-mpi.hpp:39
Definition: status.hpp:5