From cda78cee94156e8c614bd69a4dcbf12f0ea682e1 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 23:01:00 +0100 Subject: [PATCH] add mpi serialization for PlymwinjTable --- opm/simulators/utils/ParallelRestart.cpp | 18 ++++++++++++++++++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 12 ++++++++++++ 3 files changed, 32 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 93ab53942..83fe16349 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -486,6 +487,11 @@ std::size_t packSize(const PolyInjTable& data, Dune::MPIHelper::MPICommunicator packSize(data.getTableData(), comm); } +std::size_t packSize(const PlymwinjTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast(data), comm); +} + ////// pack routines template @@ -958,6 +964,12 @@ void pack(const PolyInjTable& data, std::vector& buffer, int& position, pack(data.getTableData(), buffer, position, comm); } +void pack(const PlymwinjTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast(data), buffer, position, comm); +} + /// unpack routines template @@ -1555,6 +1567,12 @@ void unpack(PolyInjTable& data, std::vector& buffer, int& position, data = PolyInjTable(throughputs, velocities, tableNumber, tableData); } +void unpack(PlymwinjTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(static_cast(data), buffer, position, comm); +} + } // end namespace Mpi RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState, const std::vector& solutionKeys, diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 620d4bd38..3ba11ab08 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -56,6 +56,7 @@ class JFunc; class NNC; struct NNCdata; class Phases; +class PlymwinjTable; class PolyInjTable; class PVCDORecord; class PvcdoTable; @@ -281,6 +282,7 @@ ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(Phases) +ADD_PACK_PROTOTYPES(PlymwinjTable) ADD_PACK_PROTOTYPES(PolyInjTable) ADD_PACK_PROTOTYPES(PVCDORecord) ADD_PACK_PROTOTYPES(PvcdoTable) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index f9339cc2e..86fc36054 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -827,6 +828,17 @@ BOOST_AUTO_TEST_CASE(WatdentTable) } +BOOST_AUTO_TEST_CASE(PlymwinjTable) +{ +#if HAVE_MPI + Opm::PlymwinjTable val1({1.0}, {2.0}, 1, {{1.0}, {2.0}}); + auto val2 = PackUnpack(val1); + BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2)); + BOOST_CHECK(val1 == std::get<0>(val2)); +#endif +} + + bool init_unit_test_func() { return true;