diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 7011fb2fd..a5a15d682 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1973,6 +1973,14 @@ std::size_t packSize(const MULTREGTScanner& data, packSize(data.getDefaultRegion(), comm); } +std::size_t packSize(const EclipseConfig& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.init(), comm) + + packSize(data.io(), comm) + + packSize(data.restart(), comm); +} + ////// pack routines template @@ -3851,6 +3859,15 @@ void pack(const MULTREGTScanner& data, pack(data.getDefaultRegion(), buffer, position, comm); } +void pack(const EclipseConfig& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.init(), buffer, position, comm); + pack(data.io(), buffer, position, comm); + pack(data.restart(), buffer, position, comm); +} + /// unpack routines template @@ -6535,6 +6552,20 @@ void unpack(MULTREGTScanner& data, data = MULTREGTScanner(size, records, searchMap, regions, defaultRegion); } +void unpack(EclipseConfig& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + InitConfig init; + IOConfig io; + RestartConfig restart; + + unpack(init, buffer, position, comm); + unpack(io, buffer, position, comm); + unpack(restart, buffer, position, comm); + data = EclipseConfig(io, init, restart); +} + #define INSTANTIATE_PACK_VECTOR(...) \ template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \ Dune::MPIHelper::MPICommunicator comm); \ diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 5c816a310..4f1584464 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -84,6 +84,7 @@ class DENSITYRecord; class DensityTable; class Dimension; class EclHysterConfig; +class EclipseConfig; class Eqldims; class EDITNNC; class EndpointScaling; @@ -656,6 +657,7 @@ ADD_PACK_PROTOTYPES(DENSITYRecord) ADD_PACK_PROTOTYPES(DensityTable) ADD_PACK_PROTOTYPES(Dimension) ADD_PACK_PROTOTYPES(EclHysterConfig) +ADD_PACK_PROTOTYPES(EclipseConfig) 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 66a3193aa..feefe75f1 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -2446,6 +2446,26 @@ BOOST_AUTO_TEST_CASE(MULTREGTScanner) } +BOOST_AUTO_TEST_CASE(EclipseConfig) +{ +#ifdef HAVE_MPI + Opm::IOConfig io(true, false, true, false, false, true, 1, "test1", true, + "test2", true, "test3", false); + Opm::InitConfig init(Opm::Equil({getEquilRecord(), getEquilRecord()}), + Opm::FoamConfig({getFoamData(), getFoamData()}), + true, true, 20, "test1"); + Opm::DynamicState rsched({Opm::RestartSchedule(1, 2, 3)}, 2); + Opm::DynamicState> rkw({{{"test",3}}}, 3); + Opm::RestartConfig restart(getTimeMap(), 1, true, rsched, rkw, {false, true}); + Opm::EclipseConfig val1{io, init, restart}; + + 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;