X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/b9625f82f86db0674e911887addce45dca31b57f..5ed37babb2fa9097abe82df299c0aa259ed84d5a:/src/smpi/include/smpi_op.hpp diff --git a/src/smpi/include/smpi_op.hpp b/src/smpi/include/smpi_op.hpp index 1b458848fe..2ec0c1c50a 100644 --- a/src/smpi/include/smpi_op.hpp +++ b/src/smpi/include/smpi_op.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2020. The SimGrid Team. +/* Copyright (c) 2009-2023. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,20 +9,29 @@ #include "smpi_info.hpp" -namespace simgrid{ -namespace smpi{ +namespace simgrid::smpi { class Op : public F2C{ MPI_User_function* func_; bool is_commutative_; bool is_fortran_op_ = false; int refcount_ = 1; - bool predefined_; + bool is_predefined_; + int types_; //bitmask of the allowed datatypes flags + std::string name_; public: - Op(MPI_User_function* function, bool commutative, bool predefined=false) : func_(function), is_commutative_(commutative), predefined_(predefined) {} + Op(MPI_User_function* function, bool commutative, bool predefined = false, int types = 0, std::string name = "MPI_Op") + : func_(function), is_commutative_(commutative), is_predefined_(predefined), types_(types), name_(std::move(name)) + { + if (not predefined) + this->add_f(); + } bool is_commutative() const { return is_commutative_; } + bool is_predefined() const { return is_predefined_; } bool is_fortran_op() const { return is_fortran_op_; } + int allowed_types() const { return types_; } + std::string name() const override {return name_;} // tell that we were created from fortran, so we need to translate the type to fortran when called void set_fortran_op() { is_fortran_op_ = true; } void apply(const void* invec, void* inoutvec, const int* len, MPI_Datatype datatype) const; @@ -31,7 +40,6 @@ public: static void unref(MPI_Op* op); }; -} -} +} // namespace simgrid::smpi #endif