diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index 221587f3d..a3598e370 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -2005,6 +2005,12 @@ std::size_t packSize(const Fault& data, packSize(data.getFaceList(), comm); } +std::size_t packSize(const FaultCollection& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.getFaults(), comm); +} + ////// pack routines template @@ -3919,6 +3925,13 @@ void pack(const Fault& data, pack(data.getFaceList(), buffer, position, comm); } +void pack(const FaultCollection& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.getFaults(), buffer, position, comm); +} + /// unpack routines template @@ -6659,6 +6672,16 @@ void unpack(Fault& data, data = Fault(name, transMult, faceList); } +void unpack(FaultCollection& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + OrderedMap faults; + + unpack(faults, buffer, position, comm); + data = FaultCollection(faults); +} + #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 d5c4a6f67..7d6865a4e 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -92,6 +92,7 @@ class Equil; class EquilRecord; class Events; class Fault; +class FaultCollection; class FaultFace; class FoamConfig; class FoamData; @@ -668,6 +669,7 @@ ADD_PACK_PROTOTYPES(Eqldims) ADD_PACK_PROTOTYPES(EquilRecord) ADD_PACK_PROTOTYPES(Events) ADD_PACK_PROTOTYPES(Fault) +ADD_PACK_PROTOTYPES(FaultCollection) ADD_PACK_PROTOTYPES(FaultFace) ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamData) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index cb0f7273a..04e58f085 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -2512,6 +2512,20 @@ BOOST_AUTO_TEST_CASE(Fault) } +BOOST_AUTO_TEST_CASE(FaultCollection) +{ +#ifdef HAVE_MPI + Opm::Fault fault("test", 1.0, {{{1,2,3,4,5,6}, Opm::FaceDir::YPlus}}); + Opm::OrderedMap faults; + faults.insert({"test2", fault}); + Opm::FaultCollection val1(faults); + 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;