From 1f313d6b043edd6e26dc3f1a1ffe018c64ab3b79 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 29 Nov 2019 13:37:35 +0100 Subject: [PATCH] add mpi serialization for FoamData --- opm/simulators/utils/ParallelRestart.cpp | 2 ++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index b40c976b0..bf4db5d80 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -24,6 +24,7 @@ #include "ParallelRestart.hpp" #include #include +#include #include #include #include @@ -192,6 +193,7 @@ HANDLE_AS_POD(data::Connection) HANDLE_AS_POD(data::Rates) HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(EquilRecord) +HANDLE_AS_POD(FoamData) 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 56ac6a3ed..ae2ebe4a3 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -41,6 +41,7 @@ class ColumnSchema; class EDITNNC; class Equil; class EquilRecord; +class FoamData; class NNC; struct NNCdata; class Rock2dTable; @@ -225,6 +226,7 @@ ADD_PACK_PROTOTYPES(data::WellRates) ADD_PACK_PROTOTYPES(EDITNNC) ADD_PACK_PROTOTYPES(Equil) ADD_PACK_PROTOTYPES(EquilRecord) +ADD_PACK_PROTOTYPES(FoamData) 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 3bcc41ce7..32824db32 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -114,7 +115,6 @@ Opm::data::Well getWell() well1.segments.insert({0, getSegment()}); return well1; } -#endif Opm::ThresholdPressure getThresholdPressure() @@ -156,6 +156,14 @@ Opm::EquilRecord getEquilRecord() } +Opm::FoamData getFoamData() +{ + return Opm::FoamData(1.0, 2.0, 3.0, true, 4.0); +} + +#endif + + } @@ -422,6 +430,17 @@ BOOST_AUTO_TEST_CASE(Equil) } +BOOST_AUTO_TEST_CASE(FoamData) +{ +#if HAVE_MPI + Opm::FoamData val1 = getFoamData(); + 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;