From 767df6c6fe88570b89f53b443abacfa8299ea8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A5rd=20Skaflestad?= Date: Mon, 14 Jan 2019 18:10:53 +0100 Subject: [PATCH] Deferred Logger: Support Older MPI Implementations The MPI_Pack() function does not support pointers-to-const until MPI-3. --- opm/simulators/gatherDeferredLogger.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/opm/simulators/gatherDeferredLogger.cpp b/opm/simulators/gatherDeferredLogger.cpp index 01d1b165e..1f5f46954 100644 --- a/opm/simulators/gatherDeferredLogger.cpp +++ b/opm/simulators/gatherDeferredLogger.cpp @@ -25,6 +25,7 @@ #if HAVE_MPI #include +#include #include #include @@ -38,16 +39,16 @@ namespace MPI_Pack(&messagesize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); for (const auto lm : local_messages) { - MPI_Pack(&lm.flag, 1, MPI_INT64_T, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); + MPI_Pack(static_cast(const_cast(&lm.flag)), 1, MPI_INT64_T, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); int tagsize = lm.tag.size(); MPI_Pack(&tagsize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); if (tagsize>0) { - MPI_Pack(lm.tag.c_str(), lm.tag.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); + MPI_Pack(const_cast(lm.tag.c_str()), lm.tag.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); } int textsize = lm.text.size(); MPI_Pack(&textsize, 1, MPI_UNSIGNED, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); if (textsize>0) { - MPI_Pack(lm.text.c_str(), lm.text.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); + MPI_Pack(const_cast(lm.text.c_str()), lm.text.size(), MPI_CHAR, buf.data(), buf.size(), &offset, MPI_COMM_WORLD); } } }