diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index bf4db5d80..90c4f062c 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -315,6 +315,11 @@ std::size_t packSize(const Equil& data, Dune::MPIHelper::MPICommunicator comm) return packSize(data.records(), comm); } +std::size_t packSize(const FoamConfig& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.records(), comm); +} + ////// pack routines template @@ -618,6 +623,12 @@ void pack(const Equil& data, std::vector& buffer, int& position, pack(data.records(), buffer, position, comm); } +void pack(const FoamConfig& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.records(), buffer, position, comm); +} + /// unpack routines template @@ -969,6 +980,14 @@ void unpack(Equil& data, std::vector& buffer, int& position, data = Equil(records); } +void unpack(FoamConfig& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector records; + unpack(records, buffer, position, comm); + data = FoamConfig(records); +} + } // 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 ae2ebe4a3..e2c7b41da 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 FoamConfig; class FoamData; class NNC; struct NNCdata; @@ -226,6 +227,7 @@ ADD_PACK_PROTOTYPES(data::WellRates) ADD_PACK_PROTOTYPES(EDITNNC) ADD_PACK_PROTOTYPES(Equil) ADD_PACK_PROTOTYPES(EquilRecord) +ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamData) ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 32824db32..639ebcd83 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -441,6 +441,17 @@ BOOST_AUTO_TEST_CASE(FoamData) } +BOOST_AUTO_TEST_CASE(FoamConfig) +{ +#if HAVE_MPI + Opm::FoamConfig val1({getFoamData(), 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;