Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / src / smpi / mpi / smpi_status.cpp
1 /* Copyright (c) 2007-2022. 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
10 namespace simgrid{
11 namespace smpi{
12
13 void Status::empty(MPI_Status * status)
14 {
15   if(status != MPI_STATUS_IGNORE) {
16     status->MPI_SOURCE = MPI_ANY_SOURCE;
17     status->MPI_TAG = MPI_ANY_TAG;
18     status->MPI_ERROR = MPI_SUCCESS;
19     status->count=0;
20     status->cancelled=0;
21   }
22 }
23
24 int Status::cancelled(const MPI_Status * status)
25 {
26   return status->cancelled!=0;
27 }
28
29 void Status::set_cancelled(MPI_Status * status, int flag)
30 {
31   status->cancelled=flag;
32 }
33
34 void Status::set_elements(MPI_Status* status, const Datatype*, int count)
35 {
36   status->count=count;
37 }
38
39 int Status::get_count(const MPI_Status* status, const Datatype* datatype)
40 {
41   return status->count / datatype->size();
42 }
43
44 }
45 }