Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Concatenate nested namespaces (sonar).
[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::smpi {
11
12 void Status::empty(MPI_Status * status)
13 {
14   if(status != MPI_STATUS_IGNORE) {
15     status->MPI_SOURCE = MPI_ANY_SOURCE;
16     status->MPI_TAG = MPI_ANY_TAG;
17     status->MPI_ERROR = MPI_SUCCESS;
18     status->count=0;
19     status->cancelled=0;
20   }
21 }
22
23 int Status::cancelled(const MPI_Status * status)
24 {
25   return status->cancelled!=0;
26 }
27
28 void Status::set_cancelled(MPI_Status * status, int flag)
29 {
30   status->cancelled=flag;
31 }
32
33 void Status::set_elements(MPI_Status* status, const Datatype*, int count)
34 {
35   status->count=count;
36 }
37
38 int Status::get_count(const MPI_Status* status, const Datatype* datatype)
39 {
40   return status->count / datatype->size();
41 }
42
43 } // namespace simgrid::smpi