From ce75b69cd648603ce459c8c702e6dc3d76474434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Sch=C3=B6berl?= Date: Tue, 12 Feb 2019 01:21:56 +0100 Subject: [PATCH] copy assignment --- libsrc/core/mpi_wrapper.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libsrc/core/mpi_wrapper.hpp b/libsrc/core/mpi_wrapper.hpp index d6d03d58..f7f06542 100644 --- a/libsrc/core/mpi_wrapper.hpp +++ b/libsrc/core/mpi_wrapper.hpp @@ -78,6 +78,21 @@ namespace ngcore if (--(*refcount) == 0) MPI_Comm_free(&comm); } + + NgMPI_Comm & operator= (const NgMPI_Comm & c) + { + if (refcount) + if (--(*refcount) == 0) + MPI_Comm_free(&comm); + + refcount = c.refcount; + if (refcount) (*refcount)++; + size = c.size; + rank = c.rank; + return *this; + } + + operator MPI_Comm() const { return comm; }