From 35498f024189eecaccabf76e3d69cd621e1cb14a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:13:33 +0100 Subject: [PATCH 01/11] add mpi serialization for JFunc --- opm/simulators/utils/ParallelRestart.cpp | 3 ++- opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 13 +++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index dce381e22..b4d65844a 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -209,6 +210,7 @@ HANDLE_AS_POD(data::Segment) HANDLE_AS_POD(EclHysterConfig) HANDLE_AS_POD(EquilRecord) HANDLE_AS_POD(FoamData) +HANDLE_AS_POD(JFunc) HANDLE_AS_POD(RestartSchedule) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeMap::StepData) @@ -1421,7 +1423,6 @@ void unpack(PvtoTable& data, std::vector& buffer, int& position, unpack_pvt(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 33487df8f..8ae89d3bb 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -50,6 +50,7 @@ class FoamConfig; class FoamData; class InitConfig; class IOConfig; +class JFunc; class NNC; struct NNCdata; class Phases; @@ -263,6 +264,7 @@ ADD_PACK_PROTOTYPES(FoamData) ADD_PACK_PROTOTYPES(EclHysterConfig) ADD_PACK_PROTOTYPES(InitConfig) ADD_PACK_PROTOTYPES(IOConfig) +ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(Phases) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index aec990d1e..3b3abed83 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -703,6 +704,18 @@ BOOST_AUTO_TEST_CASE(PvtoTable) } +BOOST_AUTO_TEST_CASE(JFunc) +{ +#if HAVE_MPI + Opm::JFunc val1(Opm::JFunc::Flag::BOTH, 1.0, 2.0, + 3.0, 4.0, Opm::JFunc::Direction::XY); + 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; From e6321cfe87852fbc368e30e85ae662ece63f843b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:30:15 +0100 Subject: [PATCH 02/11] add mpi serialization for PVTWRecord --- opm/simulators/utils/ParallelRestart.cpp | 2 ++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index b4d65844a..0af178d23 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -212,6 +213,7 @@ HANDLE_AS_POD(EquilRecord) HANDLE_AS_POD(FoamData) HANDLE_AS_POD(JFunc) HANDLE_AS_POD(RestartSchedule) +HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeMap::StepData) HANDLE_AS_POD(Welldims) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 8ae89d3bb..fd39bd973 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -56,6 +56,7 @@ struct NNCdata; class Phases; class PvtgTable; class PvtoTable; +class PVTWRecord; class RestartConfig; class RestartSchedule; class Rock2dTable; @@ -270,6 +271,7 @@ ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(Phases) ADD_PACK_PROTOTYPES(PvtgTable) ADD_PACK_PROTOTYPES(PvtoTable) +ADD_PACK_PROTOTYPES(PVTWRecord) ADD_PACK_PROTOTYPES(RestartConfig) ADD_PACK_PROTOTYPES(RestartKey) ADD_PACK_PROTOTYPES(RestartSchedule) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 3b3abed83..469ce1629 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -716,6 +717,17 @@ BOOST_AUTO_TEST_CASE(JFunc) } +BOOST_AUTO_TEST_CASE(PVTWRecord) +{ +#if HAVE_MPI + Opm::PVTWRecord val1{1.0, 2.0, 3.0, 4.0, 5.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; From 0e93df61ad211c26921195eac1ab0e6909f1246b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:39:50 +0100 Subject: [PATCH 03/11] add mpi serialization of PvtwTable --- opm/simulators/utils/ParallelRestart.cpp | 19 +++++++++++++++++++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 0af178d23..1622d5178 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -448,6 +448,11 @@ std::size_t packSize(const PvtoTable& data, Dune::MPIHelper::MPICommunicator com return packSize(static_cast(data), comm); } +std::size_t packSize(const PvtwTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -881,6 +886,12 @@ void pack(const PvtoTable& data, std::vector& buffer, int& position, pack(static_cast(data), buffer, position, comm); } +void pack(const PvtwTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -1425,6 +1436,14 @@ void unpack(PvtoTable& data, std::vector& buffer, int& position, unpack_pvt(data, buffer, position, comm); } +void unpack(PvtwTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = PvtwTable(pdata); +} + } // 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 fd39bd973..4c9649f94 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -57,6 +57,7 @@ class Phases; class PvtgTable; class PvtoTable; class PVTWRecord; +class PvtwTable; class RestartConfig; class RestartSchedule; class Rock2dTable; @@ -272,6 +273,7 @@ ADD_PACK_PROTOTYPES(Phases) ADD_PACK_PROTOTYPES(PvtgTable) ADD_PACK_PROTOTYPES(PvtoTable) ADD_PACK_PROTOTYPES(PVTWRecord) +ADD_PACK_PROTOTYPES(PvtwTable) ADD_PACK_PROTOTYPES(RestartConfig) ADD_PACK_PROTOTYPES(RestartKey) ADD_PACK_PROTOTYPES(RestartSchedule) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 469ce1629..3b62304bc 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -728,6 +728,17 @@ BOOST_AUTO_TEST_CASE(PVTWRecord) } +BOOST_AUTO_TEST_CASE(PvtwTable) +{ +#if HAVE_MPI + Opm::PvtwTable val1({Opm::PVTWRecord{1.0, 2.0, 3.0, 4.0, 5.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; From 8f541db989747362a486d385cb79c7186bde2f79 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:30:15 +0100 Subject: [PATCH 04/11] add mpi serialization for PVCDORecord --- opm/simulators/utils/ParallelRestart.cpp | 1 + opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 1622d5178..2692a3b8d 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -214,6 +214,7 @@ HANDLE_AS_POD(FoamData) HANDLE_AS_POD(JFunc) HANDLE_AS_POD(RestartSchedule) HANDLE_AS_POD(PVTWRecord) +HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeMap::StepData) HANDLE_AS_POD(Welldims) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 4c9649f94..b1f84d38a 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -54,6 +54,7 @@ class JFunc; class NNC; struct NNCdata; class Phases; +class PVCDORecord; class PvtgTable; class PvtoTable; class PVTWRecord; @@ -270,6 +271,7 @@ ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(Phases) +ADD_PACK_PROTOTYPES(PVCDORecord) ADD_PACK_PROTOTYPES(PvtgTable) ADD_PACK_PROTOTYPES(PvtoTable) ADD_PACK_PROTOTYPES(PVTWRecord) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 3b62304bc..593796bbc 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -739,6 +739,17 @@ BOOST_AUTO_TEST_CASE(PvtwTable) } +BOOST_AUTO_TEST_CASE(PVCDORecord) +{ +#if HAVE_MPI + Opm::PVTWRecord val1{1.0, 2.0, 3.0, 4.0, 5.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; From ba647bac5bb827a95693a03b4e9e7b10db290e3b Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:39:50 +0100 Subject: [PATCH 05/11] add mpi serialization of PvcdoTable --- opm/simulators/utils/ParallelRestart.cpp | 19 +++++++++++++++++++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 2692a3b8d..3abf9783c 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -454,6 +454,11 @@ std::size_t packSize(const PvtwTable& data, Dune::MPIHelper::MPICommunicator com return packSize(static_cast&>(data), comm); } +std::size_t packSize(const PvcdoTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -893,6 +898,12 @@ void pack(const PvtwTable& data, std::vector& buffer, int& position, pack(static_cast&>(data), buffer, position, comm); } +void pack(const PvcdoTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -1445,6 +1456,14 @@ void unpack(PvtwTable& data, std::vector& buffer, int& position, data = PvtwTable(pdata); } +void unpack(PvcdoTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = PvcdoTable(pdata); +} + } // 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 b1f84d38a..3c1172dcb 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -55,6 +55,7 @@ class NNC; struct NNCdata; class Phases; class PVCDORecord; +class PvcdoTable; class PvtgTable; class PvtoTable; class PVTWRecord; @@ -272,6 +273,7 @@ ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(Phases) ADD_PACK_PROTOTYPES(PVCDORecord) +ADD_PACK_PROTOTYPES(PvcdoTable) ADD_PACK_PROTOTYPES(PvtgTable) ADD_PACK_PROTOTYPES(PvtoTable) ADD_PACK_PROTOTYPES(PVTWRecord) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 593796bbc..5f135b036 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -750,6 +750,17 @@ BOOST_AUTO_TEST_CASE(PVCDORecord) } +BOOST_AUTO_TEST_CASE(PvcdoTable) +{ +#if HAVE_MPI + Opm::PvcdoTable val1({Opm::PVCDORecord{1.0, 2.0, 3.0, 4.0, 5.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; From e5b1b48bcba3bd1ad97b6fb359dad5b08b3b6164 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:52:39 +0100 Subject: [PATCH 06/11] add mpi serialization for DENSITYRecord --- opm/simulators/utils/ParallelRestart.cpp | 1 + opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 3abf9783c..76aaf7b97 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -208,6 +208,7 @@ HANDLE_AS_POD(Actdims) HANDLE_AS_POD(data::Connection) HANDLE_AS_POD(data::Rates) HANDLE_AS_POD(data::Segment) +HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(EclHysterConfig) HANDLE_AS_POD(EquilRecord) HANDLE_AS_POD(FoamData) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 3c1172dcb..e8b76b4f7 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -41,6 +41,7 @@ namespace Opm class Actdims; class ColumnSchema; +class DENSITYRecord; class EclHysterConfig; class EDITNNC; class EndpointScaling; @@ -259,6 +260,7 @@ ADD_PACK_PROTOTYPES(data::Segment) ADD_PACK_PROTOTYPES(data::Solution) ADD_PACK_PROTOTYPES(data::Well) ADD_PACK_PROTOTYPES(data::WellRates) +ADD_PACK_PROTOTYPES(DENSITYRecord) ADD_PACK_PROTOTYPES(EDITNNC) ADD_PACK_PROTOTYPES(EndpointScaling) ADD_PACK_PROTOTYPES(Equil) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 5f135b036..1c7e42fbc 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -761,6 +761,17 @@ BOOST_AUTO_TEST_CASE(PvcdoTable) } +BOOST_AUTO_TEST_CASE(DENSITYRecord) +{ +#if HAVE_MPI + Opm::DENSITYRecord val1{1.0, 2.0, 3.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; From 0adbdc1d0557a0c0274b0f6be62ddbafec73e8a1 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:52:39 +0100 Subject: [PATCH 07/11] add mpi serialization for DensityTable --- opm/simulators/utils/ParallelRestart.cpp | 19 +++++++++++++++++++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 76aaf7b97..ffc3a8ec9 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -460,6 +460,11 @@ std::size_t packSize(const PvcdoTable& data, Dune::MPIHelper::MPICommunicator co return packSize(static_cast&>(data), comm); } +std::size_t packSize(const DensityTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -905,6 +910,12 @@ void pack(const PvcdoTable& data, std::vector& buffer, int& position, pack(static_cast&>(data), buffer, position, comm); } +void pack(const DensityTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -1465,6 +1476,14 @@ void unpack(PvcdoTable& data, std::vector& buffer, int& position, data = PvcdoTable(pdata); } +void unpack(DensityTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = DensityTable(pdata); +} + } // 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 e8b76b4f7..05b95ac97 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -42,6 +42,7 @@ namespace Opm class Actdims; class ColumnSchema; class DENSITYRecord; +class DensityTable; class EclHysterConfig; class EDITNNC; class EndpointScaling; @@ -261,6 +262,7 @@ ADD_PACK_PROTOTYPES(data::Solution) ADD_PACK_PROTOTYPES(data::Well) ADD_PACK_PROTOTYPES(data::WellRates) ADD_PACK_PROTOTYPES(DENSITYRecord) +ADD_PACK_PROTOTYPES(DensityTable) ADD_PACK_PROTOTYPES(EDITNNC) ADD_PACK_PROTOTYPES(EndpointScaling) ADD_PACK_PROTOTYPES(Equil) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 1c7e42fbc..15e982fa8 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -772,6 +772,17 @@ BOOST_AUTO_TEST_CASE(DENSITYRecord) } +BOOST_AUTO_TEST_CASE(DensityTable) +{ +#if HAVE_MPI + Opm::DensityTable val1({Opm::DENSITYRecord{1.0, 2.0, 3.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; From b0d6e34799457a570d0c6d00387b600953dc95bb Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:52:39 +0100 Subject: [PATCH 08/11] add mpi serialization for VISCREFRecord --- opm/simulators/utils/ParallelRestart.cpp | 1 + opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index ffc3a8ec9..8ce888a8b 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -218,6 +218,7 @@ HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeMap::StepData) +HANDLE_AS_POD(VISCREFRecord) HANDLE_AS_POD(Welldims) HANDLE_AS_POD(WellSegmentDims) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 05b95ac97..6b880a089 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -75,6 +75,7 @@ class TableContainer; class TableSchema; class ThresholdPressure; class UDQParams; +class VISCREFRecord; class Welldims; class WellSegmentDims; @@ -300,6 +301,7 @@ ADD_PACK_PROTOTYPES(ThresholdPressure) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeMap::StepData) ADD_PACK_PROTOTYPES(UDQParams) +ADD_PACK_PROTOTYPES(VISCREFRecord) ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(WellSegmentDims) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 15e982fa8..c69428f8a 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -783,6 +783,17 @@ BOOST_AUTO_TEST_CASE(DensityTable) } +BOOST_AUTO_TEST_CASE(VISCREFRecord) +{ +#if HAVE_MPI + Opm::VISCREFRecord val1{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; From c7d661bfc84f8ccd42929ccf0fbba0cdd72061ff Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:52:39 +0100 Subject: [PATCH 09/11] add mpi serialization for ViscrefTable --- opm/simulators/utils/ParallelRestart.cpp | 19 +++++++++++++++++++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 8ce888a8b..6a49eb92a 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -466,6 +466,11 @@ std::size_t packSize(const DensityTable& data, Dune::MPIHelper::MPICommunicator return packSize(static_cast&>(data), comm); } +std::size_t packSize(const ViscrefTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -917,6 +922,12 @@ void pack(const DensityTable& data, std::vector& buffer, int& position, pack(static_cast&>(data), buffer, position, comm); } +void pack(const ViscrefTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -1485,6 +1496,14 @@ void unpack(DensityTable& data, std::vector& buffer, int& position, data = DensityTable(pdata); } +void unpack(ViscrefTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = ViscrefTable(pdata); +} + } // 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 6b880a089..dcda0ac50 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -76,6 +76,7 @@ class TableSchema; class ThresholdPressure; class UDQParams; class VISCREFRecord; +class ViscrefTable; class Welldims; class WellSegmentDims; @@ -302,6 +303,7 @@ ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeMap::StepData) ADD_PACK_PROTOTYPES(UDQParams) ADD_PACK_PROTOTYPES(VISCREFRecord) +ADD_PACK_PROTOTYPES(ViscrefTable) ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(WellSegmentDims) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index c69428f8a..d6311e633 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -794,6 +794,17 @@ BOOST_AUTO_TEST_CASE(VISCREFRecord) } +BOOST_AUTO_TEST_CASE(ViscrefTable) +{ +#if HAVE_MPI + Opm::ViscrefTable val1({Opm::VISCREFRecord{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; From a8a30cbd4ccc117577f4f91fe415bf73959b784d Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:52:39 +0100 Subject: [PATCH 10/11] add mpi serialization for WATDENTRecord --- opm/simulators/utils/ParallelRestart.cpp | 1 + opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 14 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 6a49eb92a..86cae2ccb 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -219,6 +219,7 @@ HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeMap::StepData) HANDLE_AS_POD(VISCREFRecord) +HANDLE_AS_POD(WATDENTRecord) HANDLE_AS_POD(Welldims) HANDLE_AS_POD(WellSegmentDims) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index dcda0ac50..2797b4594 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -77,6 +77,7 @@ class ThresholdPressure; class UDQParams; class VISCREFRecord; class ViscrefTable; +class WATDENTRecord; class Welldims; class WellSegmentDims; @@ -304,6 +305,7 @@ ADD_PACK_PROTOTYPES(TimeMap::StepData) ADD_PACK_PROTOTYPES(UDQParams) ADD_PACK_PROTOTYPES(VISCREFRecord) ADD_PACK_PROTOTYPES(ViscrefTable) +ADD_PACK_PROTOTYPES(WATDENTRecord) ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(WellSegmentDims) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index d6311e633..d67a02f51 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -805,6 +805,17 @@ BOOST_AUTO_TEST_CASE(ViscrefTable) } +BOOST_AUTO_TEST_CASE(WATDENTRecord) +{ +#if HAVE_MPI + Opm::WATDENTRecord val1{1.0, 2.0, 3.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; From fc8a4fdae1775894e9a2451bc0a31779e5d92610 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 2 Dec 2019 15:52:39 +0100 Subject: [PATCH 11/11] add mpi serialization for WatdentTable --- opm/simulators/utils/ParallelRestart.cpp | 19 +++++++++++++++++++ opm/simulators/utils/ParallelRestart.hpp | 2 ++ tests/test_ParallelRestart.cpp | 11 +++++++++++ 3 files changed, 32 insertions(+) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 86cae2ccb..8ec6d7817 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -472,6 +472,11 @@ std::size_t packSize(const ViscrefTable& data, Dune::MPIHelper::MPICommunicator return packSize(static_cast&>(data), comm); } +std::size_t packSize(const WatdentTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -929,6 +934,12 @@ void pack(const ViscrefTable& data, std::vector& buffer, int& position, pack(static_cast&>(data), buffer, position, comm); } +void pack(const WatdentTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -1505,6 +1516,14 @@ void unpack(ViscrefTable& data, std::vector& buffer, int& position, data = ViscrefTable(pdata); } +void unpack(WatdentTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = WatdentTable(pdata); +} + } // 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 2797b4594..267024e31 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -78,6 +78,7 @@ class UDQParams; class VISCREFRecord; class ViscrefTable; class WATDENTRecord; +class WatdentTable; class Welldims; class WellSegmentDims; @@ -306,6 +307,7 @@ ADD_PACK_PROTOTYPES(UDQParams) ADD_PACK_PROTOTYPES(VISCREFRecord) ADD_PACK_PROTOTYPES(ViscrefTable) ADD_PACK_PROTOTYPES(WATDENTRecord) +ADD_PACK_PROTOTYPES(WatdentTable) ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(WellSegmentDims) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index d67a02f51..f9339cc2e 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -816,6 +816,17 @@ BOOST_AUTO_TEST_CASE(WATDENTRecord) } +BOOST_AUTO_TEST_CASE(WatdentTable) +{ +#if HAVE_MPI + Opm::WatdentTable val1({Opm::WATDENTRecord{1.0, 2.0, 3.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;