diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 73e77cc7b..9ebac7680 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -1431,6 +1431,22 @@ std::size_t packSize(const GConSale& data, return packSize(data.getGroups(), comm); } +std::size_t packSize(const GConSump::GCONSUMPGroup& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.consumption_rate, comm) + + packSize(data.import_rate, comm) + + packSize(data.network_node, comm) + + packSize(data.udq_undefined, comm) + + packSize(data.unit_system, comm); +} + +std::size_t packSize(const GConSump& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.getGroups(), comm); +} + ////// pack routines template @@ -2886,6 +2902,24 @@ void pack(const GConSale& data, pack(data.getGroups(), buffer, position, comm); } +void pack(const GConSump::GCONSUMPGroup& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.consumption_rate, buffer, position, comm); + pack(data.import_rate, buffer, position, comm); + pack(data.network_node, buffer, position, comm); + pack(data.udq_undefined, buffer, position, comm); + pack(data.unit_system, buffer, position, comm); +} + +void pack(const GConSump& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.getGroups(), buffer, position, comm); +} + /// unpack routines template @@ -4928,6 +4962,26 @@ void unpack(GConSale& data, data = GConSale(groups); } +void unpack(GConSump::GCONSUMPGroup& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.consumption_rate, buffer, position, comm); + unpack(data.import_rate, buffer, position, comm); + unpack(data.network_node, buffer, position, comm); + unpack(data.udq_undefined, buffer, position, comm); + unpack(data.unit_system, buffer, position, comm); +} + +void unpack(GConSump& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::map groups; + unpack(groups, buffer, position, comm); + data = GConSump(groups); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 69731d427..1fd2c86f4 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -604,6 +605,8 @@ ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamData) ADD_PACK_PROTOTYPES(GConSale) ADD_PACK_PROTOTYPES(GConSale::GCONSALEGroup) +ADD_PACK_PROTOTYPES(GConSump) +ADD_PACK_PROTOTYPES(GConSump::GCONSUMPGroup) ADD_PACK_PROTOTYPES(GuideRateConfig) ADD_PACK_PROTOTYPES(GuideRateConfig::GroupTarget) ADD_PACK_PROTOTYPES(GuideRateConfig::WellTarget) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 2647ec930..18f0d8a57 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1934,6 +1934,35 @@ BOOST_AUTO_TEST_CASE(GConSale) } +BOOST_AUTO_TEST_CASE(GConSumpGroup) +{ +#ifdef HAVE_MPI + Opm::GConSump::GCONSUMPGroup val1{Opm::UDAValue(1.0), + Opm::UDAValue(2.0), + "test", + 3.0, Opm::UnitSystem()}; + auto val2 = PackUnpack(val1); + BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2)); + BOOST_CHECK(val1 == std::get<0>(val2)); +#endif +} + + +BOOST_AUTO_TEST_CASE(GConSump) +{ +#ifdef HAVE_MPI + Opm::GConSump::GCONSUMPGroup group{Opm::UDAValue(1.0), + Opm::UDAValue(2.0), + "test", + 3.0, Opm::UnitSystem()}; + Opm::GConSump val1({{"test1", group}, {"test2", group}}); + 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;