From 21eab1aa6d7b421b2900d5ac0414b6e44c7c7291 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 29 Nov 2019 13:01:43 +0100 Subject: [PATCH] add mpi serialization for EquilRecord --- opm/simulators/utils/ParallelRestart.cpp | 2 ++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index ebd8d2b49..ca557f825 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -23,6 +23,7 @@ #include "ParallelRestart.hpp" #include +#include #include #include #include @@ -190,6 +191,7 @@ std::size_t packSize(const std::unordered_map& data, Dune::MPIHelpe HANDLE_AS_POD(data::Connection) HANDLE_AS_POD(data::Rates) HANDLE_AS_POD(data::Segment) +HANDLE_AS_POD(EquilRecord) std::size_t packSize(const data::Well& data, Dune::MPIHelper::MPICommunicator comm) { diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 69c32938b..0e00582a7 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -39,6 +39,7 @@ namespace Opm class ColumnSchema; class EDITNNC; +class EquilRecord; class NNC; struct NNCdata; class Rock2dTable; @@ -221,6 +222,7 @@ ADD_PACK_PROTOTYPES(data::Solution) ADD_PACK_PROTOTYPES(data::Well) ADD_PACK_PROTOTYPES(data::WellRates) ADD_PACK_PROTOTYPES(EDITNNC) +ADD_PACK_PROTOTYPES(EquilRecord) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(RestartKey) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 5f7c18af8..b241f312c 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -149,6 +150,12 @@ Opm::SimpleTable getSimpleTable() } +Opm::EquilRecord getEquilRecord() +{ + return Opm::EquilRecord(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, true, false, 1); +} + + } @@ -393,6 +400,17 @@ BOOST_AUTO_TEST_CASE(TableContainer) } +BOOST_AUTO_TEST_CASE(EquilRecord) +{ +#if HAVE_MPI + Opm::EquilRecord val1 = getEquilRecord(); + 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;