diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 274ae764c..6f3728858 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1952,6 +1952,17 @@ std::size_t packSize(const GuideRateConfig::GroupTarget& data, packSize(data.target, comm); } +std::size_t packSize(const MULTREGTRecord& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.src_value, comm) + + packSize(data.target_value, comm) + + packSize(data.trans_mult, comm) + + packSize(data.directions, comm) + + packSize(data.nnc_behaviour, comm) + + packSize(data.region_name, comm); +} + ////// pack routines template @@ -3807,6 +3818,18 @@ void pack(const GuideRateConfig::GroupTarget& data, pack(data.target, buffer, position, comm); } +void pack(const MULTREGTRecord& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.src_value, buffer, position, comm); + pack(data.target_value, buffer, position, comm); + pack(data.trans_mult, buffer, position, comm); + pack(data.directions, buffer, position, comm); + pack(data.nnc_behaviour, buffer, position, comm); + pack(data.region_name, buffer, position, comm); +} + /// unpack routines template @@ -6460,6 +6483,18 @@ void unpack(GuideRateConfig::GroupTarget& data, unpack(data.target, buffer, position, comm); } +void unpack(MULTREGTRecord& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.src_value, buffer, position, comm); + unpack(data.target_value, buffer, position, comm); + unpack(data.trans_mult, buffer, position, comm); + unpack(data.directions, buffer, position, comm); + unpack(data.nnc_behaviour, buffer, position, comm); + unpack(data.region_name, buffer, position, comm); +} + #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 0c05f4850..8188e9209 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -99,6 +99,7 @@ class JFunc; class Location; class MessageLimits; class MLimits; +class MULTREGTRecord; class NNC; struct NNCdata; class OilVaporizationProperties; @@ -679,6 +680,7 @@ ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(Location) ADD_PACK_PROTOTYPES(MessageLimits) ADD_PACK_PROTOTYPES(MLimits) +ADD_PACK_PROTOTYPES(MULTREGTRecord) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(OilVaporizationProperties) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 79d28be64..8c66c46ad 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -2415,6 +2415,17 @@ BOOST_AUTO_TEST_CASE(WellBrineProperties) } +BOOST_AUTO_TEST_CASE(MULTREGTRecord) +{ +#ifdef HAVE_MPI + Opm::MULTREGTRecord val1{1, 2, 3.0, 4, Opm::MULTREGT::ALL, "test"}; + 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;