From 250a7fc33d57cc0e53ec6196b98a7cc8a7d34bf1 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 4 Mar 2020 08:31:41 +0100 Subject: [PATCH] add mpi serialization for TlmixparTable --- opm/simulators/utils/ParallelRestart.cpp | 26 +++++++++++++++++++++++- opm/simulators/utils/ParallelRestart.hpp | 4 ++++ tests/test_ParallelRestart.cpp | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index feb72f6907a..afe16a67fe2 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -467,6 +467,7 @@ HANDLE_AS_POD(SatFuncControls) HANDLE_AS_POD(StandardCond) HANDLE_AS_POD(Tabdims) HANDLE_AS_POD(TimeStampUTC::YMD) +HANDLE_AS_POD(TlmixparRecord) HANDLE_AS_POD(Tuning) HANDLE_AS_POD(VISCREFRecord) HANDLE_AS_POD(WATDENTRecord) @@ -853,6 +854,7 @@ std::size_t packSize(const TableManager& data, Dune::MPIHelper::MPICommunicator packSize(data.getPvcdoTable(), comm) + packSize(data.getDensityTable(), comm) + packSize(data.getRockTable(), comm) + + packSize(data.getTlmixparTable(), comm) + packSize(data.getViscrefTable(), comm) + packSize(data.getWatdentTable(), comm) + packSize(data.getPvtwSaltTables(), comm) + @@ -2046,6 +2048,11 @@ std::size_t packSize(const GridDims& data, return packSize(data.getNXYZ(), comm); } +std::size_t packSize(const TlmixparTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -2715,6 +2722,7 @@ void pack(const TableManager& data, std::vector& buffer, int& position, pack(data.getPvcdoTable(), buffer, position, comm); pack(data.getDensityTable(), buffer, position, comm); pack(data.getRockTable(), buffer, position, comm); + pack(data.getTlmixparTable(), buffer, position, comm); pack(data.getViscrefTable(), buffer, position, comm); pack(data.getWatdentTable(), buffer, position, comm); pack(data.getPvtwSaltTables(), buffer, position, comm); @@ -3973,6 +3981,12 @@ void pack(const GridDims& data, pack(data.getNXYZ(), buffer, position, comm); } +void pack(const TlmixparTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -4864,6 +4878,7 @@ void unpack(TableManager& data, std::vector& buffer, int& position, DensityTable densityTable; RockTable rockTable; ViscrefTable viscrefTable; + TlmixparTable tlmixparTable; WatdentTable watdentTable; std::vector pvtwsaltTables; std::vector bdensityTables; @@ -4892,6 +4907,7 @@ void unpack(TableManager& data, std::vector& buffer, int& position, unpack(pvcdoTable, buffer, position, comm); unpack(densityTable, buffer, position, comm); unpack(rockTable, buffer, position, comm); + unpack(tlmixparTable, buffer, position, comm); unpack(viscrefTable, buffer, position, comm); unpack(watdentTable, buffer, position, comm); unpack(pvtwsaltTables, buffer, position, comm); @@ -4922,7 +4938,7 @@ void unpack(TableManager& data, std::vector& buffer, int& position, data = TableManager(simpleTables, pvtgTables, pvtoTables, rock2dTables, rock2dtrTables, pvtwTable, pvcdoTable, densityTable, - rockTable, viscrefTable, watdentTable, pvtwsaltTables, + rockTable, tlmixparTable, viscrefTable, watdentTable, pvtwsaltTables, bdensityTables, sdensityTables, plymwinjTables, skprwatTables, skprpolyTables, tabdims, regdims, eqldims, aqudims, hasImptvd, hasEntpvd, hasEqlnum, jfunc, oilDenT, gasDenT, @@ -6752,6 +6768,14 @@ void unpack(GridDims& data, data = GridDims(NXYZ); } +void unpack(TlmixparTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = TlmixparTable(pdata); +} + #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 f61d0a0f27b..47f959276e2 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -154,6 +154,8 @@ class TableManager; class TableSchema; class ThresholdPressure; class TimeStampUTC; +class TlmixparRecord; +class TlmixparTable; class TransMult; class Tuning; class UDAValue; @@ -784,6 +786,8 @@ ADD_PACK_PROTOTYPES(TableSchema) ADD_PACK_PROTOTYPES(ThresholdPressure) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeStampUTC) +ADD_PACK_PROTOTYPES(TlmixparRecord) +ADD_PACK_PROTOTYPES(TlmixparTable) ADD_PACK_PROTOTYPES(TransMult) ADD_PACK_PROTOTYPES(Tuning) ADD_PACK_PROTOTYPES(UDAValue) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 6f0ff828c5d..281d47f4c1e 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1202,6 +1202,7 @@ BOOST_AUTO_TEST_CASE(TableManager) Opm::PvcdoTable({Opm::PVCDORecord{1.0, 2.0, 3.0, 4.0, 5.0}}), Opm::DensityTable({Opm::DENSITYRecord{1.0, 2.0, 3.0}}), Opm::RockTable({Opm::ROCKRecord{1.0,2.0}}), + Opm::TlmixparTable({Opm::TlmixparRecord{1.0, 2.0}}), Opm::ViscrefTable({Opm::VISCREFRecord{1.0, 2.0}}), Opm::WatdentTable({Opm::WATDENTRecord{1.0, 2.0, 3.0}}), {{1.0, 2.0, {1.0, 2.0, 3.0}}},