X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4d140762b2b9c8746cdd3b0680a7167867ba0ad9..2df88396d94796a341f1dbaa1d41f3162745d927:/src/smpi/include/smpi_op.hpp diff --git a/src/smpi/include/smpi_op.hpp b/src/smpi/include/smpi_op.hpp index f884189ebf..bae3055430 100644 --- a/src/smpi/include/smpi_op.hpp +++ b/src/smpi/include/smpi_op.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2010, 2012-2017. The SimGrid Team. +/* Copyright (c) 2009-2019. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -13,18 +13,22 @@ namespace simgrid{ namespace smpi{ class Op : public F2C{ - private: - MPI_User_function *func_; - bool is_commutative_; - bool is_fortran_op_; - public: - - Op(MPI_User_function * function, bool commutative); - bool is_commutative(); - bool is_fortran_op(); - void set_fortran_op(); - void apply(void *invec, void *inoutvec, int *len, MPI_Datatype datatype); - static Op* f2c(int id); + MPI_User_function* func_; + bool is_commutative_; + bool is_fortran_op_ = false; + int refcount_ = 1; + bool predefined_; + +public: + Op(MPI_User_function* function, bool commutative, bool predefined=false) : func_(function), is_commutative_(commutative), predefined_(predefined) {} + bool is_commutative() { return is_commutative_; } + bool is_fortran_op() { return is_fortran_op_; } + // 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); + static Op* f2c(int id); + void ref(); + static void unref(MPI_Op* op); }; }