Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'tracemgrsplit' into 'master'
[simgrid.git] / src / smpi / include / smpi_op.hpp
1 /* Copyright (c) 2009-2019. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef SMPI_OP_HPP
8 #define SMPI_OP_HPP
9
10 #include "smpi_info.hpp"
11
12 namespace simgrid{
13 namespace smpi{
14
15 class Op : public F2C{
16   MPI_User_function* func_;
17   bool is_commutative_;
18   bool is_fortran_op_ = false;
19   int refcount_ = 1;
20   bool predefined_;
21
22 public:
23   Op(MPI_User_function* function, bool commutative, bool predefined=false) : func_(function), is_commutative_(commutative), predefined_(predefined) {}
24   bool is_commutative() { return is_commutative_; }
25   bool is_fortran_op() { return is_fortran_op_; }
26   // tell that we were created from fortran, so we need to translate the type to fortran when called
27   void set_fortran_op() { is_fortran_op_ = true; }
28   void apply(const void* invec, void* inoutvec, const int* len, MPI_Datatype datatype);
29   static Op* f2c(int id);
30   void ref();
31   static void unref(MPI_Op* op);
32 };
33
34 }
35 }
36
37 #endif