{
CHECK_NULL(1, MPI_ERR_ARG, op)
CHECK_MPI_NULL(1, MPI_OP_NULL, MPI_ERR_OP, *op)
+ if((*op)->is_predefined())
+ return MPI_ERR_OP;
simgrid::smpi::Op::unref(op);
*op = MPI_OP_NULL;
return MPI_SUCCESS;
bool is_commutative_;
bool is_fortran_op_ = false;
int refcount_ = 1;
- bool predefined_;
+ bool is_predefined_;
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) : func_(function), is_commutative_(commutative), is_predefined_(predefined) {}
bool is_commutative() const { return is_commutative_; }
+ bool is_predefined() const { return is_predefined_; }
bool is_fortran_op() const { 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 Op::unref(MPI_Op* op){
if((*op)!=MPI_OP_NULL){
(*op)->refcount_--;
- if ((*op)->refcount_ == 0 && not (*op)->predefined_)
+ if ((*op)->refcount_ == 0 && not (*op)->is_predefined_)
delete(*op);
}
}