1 /* Copyright (c) 2009-2021. The SimGrid Team.
2 * All rights reserved. */
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. */
10 #include "smpi_info.hpp"
15 class Op : public F2C{
16 MPI_User_function* func_;
18 bool is_fortran_op_ = false;
21 int types_; //bitmask of the allowed datatypes flags
24 Op(MPI_User_function* function, bool commutative, bool predefined=false, int types=0) : func_(function), is_commutative_(commutative), is_predefined_(predefined), types_(types) {if(not predefined) this->add_f();}
25 bool is_commutative() const { return is_commutative_; }
26 bool is_predefined() const { return is_predefined_; }
27 bool is_fortran_op() const { return is_fortran_op_; }
28 int allowed_types() const { return types_; }
29 std::string name() const override {return std::string("MPI_Op");}
30 // tell that we were created from fortran, so we need to translate the type to fortran when called
31 void set_fortran_op() { is_fortran_op_ = true; }
32 void apply(const void* invec, void* inoutvec, const int* len, MPI_Datatype datatype) const;
33 static Op* f2c(int id);
35 static void unref(MPI_Op* op);