diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index c862676ef..d3d06f7b7 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -399,6 +399,15 @@ std::size_t packSize(const EndpointScaling& data, Dune::MPIHelper::MPICommunicat return packSize(data.getBits(), comm); } +std::size_t packSize(const UDQParams& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.reseed(), comm) + + packSize(data.rand_seed(), comm) + + packSize(data.range(), comm) + + packSize(data.undefinedValue(), comm) + + packSize(data.cmpEpsilon(), comm); +} + ////// pack routines template @@ -786,6 +795,16 @@ void pack(const EndpointScaling& data, std::vector& buffer, int& position, pack(data.getBits(), buffer, position, comm); } +void pack(const UDQParams& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.reseed(), buffer, position, comm); + pack(data.rand_seed(), buffer, position, comm); + pack(data.range(), buffer, position, comm); + pack(data.undefinedValue(), buffer, position, comm); + pack(data.cmpEpsilon(), buffer, position, comm); +} + /// unpack routines template @@ -1261,6 +1280,21 @@ void unpack(EndpointScaling& data, std::vector& buffer, int& position, data = EndpointScaling(std::bitset<4>(bits)); } +void unpack(UDQParams& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + bool reseed; + int rand_seed; + double range, undefVal, cmp_eps; + + unpack(reseed, buffer, position, comm); + unpack(rand_seed, buffer, position, comm); + unpack(range, buffer, position, comm); + unpack(undefVal, buffer, position, comm); + unpack(cmp_eps, buffer, position, comm); + data = UDQParams(reseed, rand_seed, range, undefVal, cmp_eps); +} + } // 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 2609e2dc5..bed199d50 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -62,6 +62,7 @@ class TableColumn; class TableContainer; class TableSchema; class ThresholdPressure; +class UDQParams; class Welldims; class WellSegmentDims; @@ -274,6 +275,7 @@ ADD_PACK_PROTOTYPES(TableSchema) ADD_PACK_PROTOTYPES(ThresholdPressure) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeMap::StepData) +ADD_PACK_PROTOTYPES(UDQParams) ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(WellSegmentDims) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 4072c2ec5..38408da3f 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -604,6 +604,17 @@ BOOST_AUTO_TEST_CASE(WellSegmentDims) } +BOOST_AUTO_TEST_CASE(UDQParams) +{ +#if HAVE_MPI + Opm::UDQParams val1(true, 1, 2.0, 3.0, 4.0); + 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;