From 579dbe73c177fa410783d4f6eee335f38528bca7 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 PlmixparTable --- opm/simulators/utils/ParallelRestart.cpp | 33 +++++++++++++++++++++--- opm/simulators/utils/ParallelRestart.hpp | 4 +++ tests/test_ParallelRestart.cpp | 1 + 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index e616628e2..cca4b91c2 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -459,6 +459,7 @@ HANDLE_AS_POD(DENSITYRecord) HANDLE_AS_POD(DenT::entry) HANDLE_AS_POD(Eqldims) HANDLE_AS_POD(MLimits) +HANDLE_AS_POD(PlmixparRecord) HANDLE_AS_POD(PVTWRecord) HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Regdims) @@ -863,6 +864,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.getPlmixparTable(), comm) + packSize(data.getTlmixparTable(), comm) + packSize(data.getViscrefTable(), comm) + packSize(data.getWatdentTable(), comm) + @@ -1826,6 +1828,11 @@ std::size_t packSize(const TlmixparTable& data, Dune::MPIHelper::MPICommunicator return packSize(static_cast&>(data), comm); } +std::size_t packSize(const PlmixparTable& data, Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(static_cast&>(data), comm); +} + ////// pack routines template @@ -2504,6 +2511,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.getPlmixparTable(), buffer, position, comm); pack(data.getTlmixparTable(), buffer, position, comm); pack(data.getViscrefTable(), buffer, position, comm); pack(data.getWatdentTable(), buffer, position, comm); @@ -3534,6 +3542,12 @@ void pack(const TlmixparTable& data, std::vector& buffer, int& position, pack(static_cast&>(data), buffer, position, comm); } +void pack(const PlmixparTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(static_cast&>(data), buffer, position, comm); +} + /// unpack routines template @@ -4439,6 +4453,7 @@ void unpack(TableManager& data, std::vector& buffer, int& position, DensityTable densityTable; RockTable rockTable; ViscrefTable viscrefTable; + PlmixparTable plmixparTable; TlmixparTable tlmixparTable; WatdentTable watdentTable; std::vector pvtwsaltTables; @@ -4468,6 +4483,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(plmixparTable, buffer, position, comm); unpack(tlmixparTable, buffer, position, comm); unpack(viscrefTable, buffer, position, comm); unpack(watdentTable, buffer, position, comm); @@ -4499,10 +4515,11 @@ void unpack(TableManager& data, std::vector& buffer, int& position, data = TableManager(simpleTables, pvtgTables, pvtoTables, rock2dTables, rock2dtrTables, pvtwTable, pvcdoTable, densityTable, - rockTable, tlmixparTable, viscrefTable, watdentTable, pvtwsaltTables, - bdensityTables, sdensityTables, plymwinjTables, - skprwatTables, skprpolyTables, tabdims, regdims, eqldims, - aqudims, hasImptvd, hasEntpvd, hasEqlnum, jfunc, oilDenT, gasDenT, + rockTable, plmixparTable, tlmixparTable, viscrefTable, + watdentTable, pvtwsaltTables, bdensityTables, sdensityTables, + plymwinjTables, skprwatTables, skprpolyTables, tabdims, + regdims, eqldims, aqudims, hasImptvd, hasEntpvd, hasEqlnum, + jfunc, oilDenT, gasDenT, watDenT, stcond, gas_comp_index, rtemp); } @@ -5954,6 +5971,14 @@ void unpack(TlmixparTable& data, std::vector& buffer, int& position, data = TlmixparTable(pdata); } +void unpack(PlmixparTable& data, std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + std::vector pdata; + unpack(pdata, buffer, position, comm); + data = PlmixparTable(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 76b610b2c..102881769 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -113,6 +113,8 @@ class PolyInjTable; class PVCDORecord; class PvcdoTable; class PolymerConfig; +class PlmixparRecord; +class PlmixparTable; class PvtgTable; class PvtoTable; class PVTWRecord; @@ -563,6 +565,8 @@ ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(OilVaporizationProperties) ADD_PACK_PROTOTYPES(Phases) +ADD_PACK_PROTOTYPES(PlmixparRecord) +ADD_PACK_PROTOTYPES(PlmixparTable) ADD_PACK_PROTOTYPES(PlymwinjTable) ADD_PACK_PROTOTYPES(PolyInjTable) ADD_PACK_PROTOTYPES(PolymerConfig) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index aeb27b929..11c84a2ef 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1220,6 +1220,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::PlmixparTable({Opm::PlmixparRecord{1.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}}),