Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
moved a line for comprehension
[simgrid.git] / src / smpi / mpi / smpi_status.cpp
1 /* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "smpi_status.hpp"
7 #include "private.hpp"
8 #include "smpi_datatype.hpp"
9 #include "src/simix/smx_private.hpp"
10
11 namespace simgrid{
12 namespace smpi{
13
14 void Status::empty(MPI_Status * status)
15 {
16   if(status != MPI_STATUS_IGNORE) {
17     status->MPI_SOURCE = MPI_ANY_SOURCE;
18     status->MPI_TAG = MPI_ANY_TAG;
19     status->MPI_ERROR = MPI_SUCCESS;
20     status->count=0;
21     status->cancelled=0;
22   }
23 }
24
25 int Status::cancelled(const MPI_Status * status)
26 {
27   return status->cancelled!=0;
28 }
29
30 void Status::set_cancelled(MPI_Status * status, int flag)
31 {
32   status->cancelled=flag;
33 }
34
35 void Status::set_elements(MPI_Status* status, const Datatype*, int count)
36 {
37   status->count=count;
38 }
39
40 int Status::get_count(const MPI_Status * status, MPI_Datatype datatype)
41 {
42   return status->count / datatype->size();
43 }
44
45 }
46 }