Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Better with the new files
authordegomme <augustin.degomme@unibas.ch>
Sun, 19 Mar 2017 00:31:43 +0000 (01:31 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Sun, 19 Mar 2017 00:31:43 +0000 (01:31 +0100)
src/smpi/smpi_status.cpp [new file with mode: 0644]
src/smpi/smpi_status.hpp [new file with mode: 0644]

diff --git a/src/smpi/smpi_status.cpp b/src/smpi/smpi_status.cpp
new file mode 100644 (file)
index 0000000..2d6caf9
--- /dev/null
@@ -0,0 +1,23 @@
+/* Copyright (c) 2007-2015. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "private.h"
+#include "src/simix/smx_private.h"
+
+void Status::empty(MPI_Status * status)
+{
+  if(status != MPI_STATUS_IGNORE) {
+    status->MPI_SOURCE = MPI_ANY_SOURCE;
+    status->MPI_TAG = MPI_ANY_TAG;
+    status->MPI_ERROR = MPI_SUCCESS;
+    status->count=0;
+  }
+}
+
+int Status::get_count(MPI_Status * status, MPI_Datatype datatype)
+{
+  return status->count / datatype->size();
+}
diff --git a/src/smpi/smpi_status.hpp b/src/smpi/smpi_status.hpp
new file mode 100644 (file)
index 0000000..7172194
--- /dev/null
@@ -0,0 +1,26 @@
+/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SMPI_STATUS_HPP
+#define SMPI_STATUS_HPP
+
+#include "private.h"
+
+namespace simgrid{
+namespace smpi{
+
+//Status has to stay in C, as its fields are public.
+//So status class only defines static methods to handle the C struct.
+class Status{
+public:
+static void empty(MPI_Status * status);
+static int get_count(MPI_Status * status, MPI_Datatype datatype);
+};
+
+
+}
+}
+#endif