diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index a5b0747e8..0500a9f5b 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -52,8 +52,6 @@ #include #include #include -#include -#include #include #include @@ -354,96 +352,6 @@ std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator packSize(data.saveKeywords(), comm); } -namespace { - -struct SplitSimpleTables { - size_t plyshMax = 0; - size_t rockMax = 0; - std::map> plyshMap; - std::map> rockMap; -}; - -SplitSimpleTables -splitSimpleTable(std::map& simpleTables) -{ - SplitSimpleTables result; - - // PlyshlogTable need special treatment - auto it = simpleTables.find("PLYSHLOG"); - if (it != simpleTables.end()) { - result.plyshMax = it->second.max(); - for (const auto& mapIt : it->second.tables()) { - auto ptr = std::static_pointer_cast(mapIt.second); - result.plyshMap.insert(std::make_pair(mapIt.first, ptr)); - } - simpleTables.erase(it); - } - - // RocktabTable need special treatment - it = simpleTables.find("ROCKMAP"); - if (it != simpleTables.end()) { - result.rockMax = it->second.max(); - for (const auto& mapIt : it->second.tables()) { - auto ptr = std::static_pointer_cast(mapIt.second); - result.rockMap.insert(std::make_pair(mapIt.first, ptr)); - } - simpleTables.erase(it); - } - - return result; -} - -} - -std::size_t packSize(const TableManager& data, Dune::MPIHelper::MPICommunicator comm) -{ - auto simpleTables = data.getSimpleTables(); - auto splitTab = splitSimpleTable(simpleTables); - - return packSize(simpleTables, comm) + - packSize(splitTab.plyshMax, comm) + - packSize(splitTab.plyshMap, comm) + - packSize(splitTab.rockMax, comm) + - packSize(splitTab.rockMap, comm) + - packSize(data.getPvtgTables(), comm) + - packSize(data.getPvtoTables(), comm) + - packSize(data.getRock2dTables(), comm) + - packSize(data.getRock2dtrTables(), comm) + - packSize(data.getPvtwTable(), comm) + - packSize(data.getPvcdoTable(), comm) + - packSize(data.getDensityTable(), comm) + - packSize(data.getPlyvmhTable(), comm) + - packSize(data.getRockTable(), comm) + - packSize(data.getPlmixparTable(), comm) + - packSize(data.getShrateTable(), comm) + - packSize(data.getStone1exTable(), comm) + - packSize(data.getTlmixparTable(), comm) + - packSize(data.getViscrefTable(), comm) + - packSize(data.getWatdentTable(), comm) + - packSize(data.getPvtwSaltTables(), comm) + - packSize(data.getBrineDensityTables(), comm) + - packSize(data.getSolventDensityTables(), comm) + - packSize(data.getPlymwinjTables(), comm) + - packSize(data.getSkprwatTables(), comm) + - packSize(data.getSkprpolyTables(), comm) + - packSize(data.getTabdims(), comm) + - packSize(data.getRegdims(), comm) + - packSize(data.getEqldims(), comm) + - packSize(data.getAqudims(), comm) + - packSize(data.useImptvd(), comm) + - packSize(data.useEnptvd(), comm) + - packSize(data.useEqlnum(), comm) + - packSize(data.useShrate(), comm) + - packSize(data.useJFunc(), comm) + - (data.useJFunc() ? packSize(data.getJFunc(), comm) : 0) + - packSize(data.OilDenT(), comm) + - packSize(data.GasDenT(), comm) + - packSize(data.WatDenT(), comm) + - packSize(data.stCond(), comm) + - packSize(data.gas_comp_index(), comm) + - packSize(data.rtemp(), comm); -} - template std::size_t packSize(const std::map& data, Dune::MPIHelper::MPICommunicator comm); @@ -1336,57 +1244,6 @@ void pack(const RestartConfig& data, std::vector& buffer, int& position, pack(data.saveKeywords(), buffer, position, comm); } -void pack(const TableManager& data, std::vector& buffer, int& position, - Dune::MPIHelper::MPICommunicator comm) -{ - auto simpleTables = data.getSimpleTables(); - auto splitTab = splitSimpleTable(simpleTables); - - pack(simpleTables, buffer, position, comm); - pack(splitTab.plyshMax, buffer, position, comm); - pack(splitTab.plyshMap, buffer, position, comm); - pack(splitTab.rockMax, buffer, position, comm); - pack(splitTab.rockMap, buffer, position, comm); - pack(data.getPvtgTables(), buffer, position, comm); - pack(data.getPvtoTables(), buffer, position, comm); - pack(data.getRock2dTables(), buffer, position, comm); - pack(data.getRock2dtrTables(), buffer, position, comm); - pack(data.getPvtwTable(), buffer, position, comm); - pack(data.getPvcdoTable(), buffer, position, comm); - pack(data.getDensityTable(), buffer, position, comm); - pack(data.getPlyvmhTable(), buffer, position, comm); - pack(data.getRockTable(), buffer, position, comm); - pack(data.getPlmixparTable(), buffer, position, comm); - pack(data.getShrateTable(), buffer, position, comm); - pack(data.getStone1exTable(), 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); - pack(data.getBrineDensityTables(), buffer, position, comm); - pack(data.getSolventDensityTables(), buffer, position, comm); - pack(data.getPlymwinjTables(), buffer, position, comm); - pack(data.getSkprwatTables(), buffer, position, comm); - pack(data.getSkprpolyTables(), buffer, position, comm); - pack(data.getTabdims(), buffer, position, comm); - pack(data.getRegdims(), buffer, position, comm); - pack(data.getEqldims(), buffer, position, comm); - pack(data.getAqudims(), buffer, position, comm); - pack(data.useImptvd(), buffer, position, comm); - pack(data.useEnptvd(), buffer, position, comm); - pack(data.useEqlnum(), buffer, position, comm); - pack(data.useShrate(), buffer, position, comm); - pack(data.useJFunc(), buffer, position, comm); - if (data.useJFunc()) - pack(data.getJFunc(), buffer, position, comm); - pack(data.OilDenT(), buffer, position, comm); - pack(data.GasDenT(), buffer, position, comm); - pack(data.WatDenT(), buffer, position, comm); - pack(data.stCond(), buffer, position, comm); - pack(data.gas_comp_index(), buffer, position, comm); - pack(data.rtemp(), buffer, position, comm); -} - void pack(const OilVaporizationProperties& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) @@ -2351,118 +2208,6 @@ void unpack(RestartConfig& data, std::vector& buffer, int& position, restart_keyw, save_keyw); } -void unpack(TableManager& data, std::vector& buffer, int& position, - Dune::MPIHelper::MPICommunicator comm) -{ - std::map simpleTables; - SplitSimpleTables split; - std::vector pvtgTables; - std::vector pvtoTables; - std::vector rock2dTables; - std::vector rock2dtrTables; - PvtwTable pvtwTable; - PvcdoTable pvcdoTable; - DensityTable densityTable; - PlyvmhTable plyvmhTable; - RockTable rockTable; - ViscrefTable viscrefTable; - PlmixparTable plmixparTable; - ShrateTable shrateTable; - Stone1exTable stone1exTable; - TlmixparTable tlmixparTable; - WatdentTable watdentTable; - std::vector pvtwsaltTables; - std::vector bdensityTables; - std::vector sdensityTables; - std::map plymwinjTables; - std::map skprwatTables; - std::map skprpolyTables; - Tabdims tabdims; - Regdims regdims; - Eqldims eqldims; - Aqudims aqudims; - bool hasImptvd; - bool hasEntpvd; - bool hasEqlnum; - bool hasShrate; - DenT oilDenT, gasDenT, watDenT; - StandardCond stcond; - std::size_t gas_comp_index; - std::shared_ptr jfunc; - double rtemp; - - unpack(simpleTables, buffer, position, comm); - unpack(split.plyshMax, buffer, position, comm); - unpack(split.plyshMap, buffer, position, comm); - unpack(split.rockMax, buffer, position, comm); - unpack(split.rockMap, buffer, position, comm); - unpack(pvtgTables, buffer, position, comm); - unpack(pvtoTables, buffer, position, comm); - unpack(rock2dTables, buffer, position, comm); - unpack(rock2dtrTables, buffer, position, comm); - unpack(pvtwTable, buffer, position, comm); - unpack(pvcdoTable, buffer, position, comm); - unpack(densityTable, buffer, position, comm); - unpack(plyvmhTable, buffer, position, comm); - unpack(rockTable, buffer, position, comm); - unpack(plmixparTable, buffer, position, comm); - unpack(shrateTable, buffer, position, comm); - unpack(stone1exTable, buffer, position, comm); - unpack(tlmixparTable, buffer, position, comm); - unpack(viscrefTable, buffer, position, comm); - unpack(watdentTable, buffer, position, comm); - unpack(pvtwsaltTables, buffer, position, comm); - unpack(bdensityTables, buffer, position, comm); - unpack(sdensityTables, buffer, position, comm); - unpack(plymwinjTables, buffer, position, comm); - unpack(skprwatTables, buffer, position, comm); - unpack(skprpolyTables, buffer, position, comm); - unpack(tabdims, buffer, position, comm); - unpack(regdims, buffer, position, comm); - unpack(eqldims, buffer, position, comm); - unpack(aqudims, buffer, position, comm); - unpack(hasImptvd, buffer, position, comm); - unpack(hasEntpvd, buffer, position, comm); - unpack(hasEqlnum, buffer, position, comm); - unpack(hasShrate, buffer, position, comm); - bool hasJf; - unpack(hasJf, buffer, position, comm); - if (hasJf) { - jfunc = std::make_shared(); - unpack(*jfunc, buffer, position, comm); - } - unpack(oilDenT, buffer, position, comm); - unpack(gasDenT, buffer, position, comm); - unpack(watDenT, buffer, position, comm); - unpack(stcond, buffer, position, comm); - unpack(gas_comp_index, buffer, position, comm); - unpack(rtemp, buffer, position, comm); - - if (split.plyshMax > 0) { - TableContainer container(split.plyshMax); - for (const auto& it : split.plyshMap) { - container.addTable(it.first, it.second); - } - simpleTables.insert(std::make_pair("PLYSHLOG", container)); - } - if (split.rockMax > 0) { - TableContainer container(split.rockMax); - for (const auto& it : split.rockMap) { - container.addTable(it.first, it.second); - } - simpleTables.insert(std::make_pair("ROCKTAB", container)); - } - - data = TableManager(simpleTables, pvtgTables, pvtoTables, rock2dTables, - rock2dtrTables, pvtwTable, pvcdoTable, densityTable, - plyvmhTable, rockTable, plmixparTable, shrateTable, stone1exTable, - tlmixparTable, viscrefTable, watdentTable, pvtwsaltTables, - bdensityTables, sdensityTables, plymwinjTables, skprwatTables, - skprpolyTables, tabdims, regdims, eqldims, aqudims, hasImptvd, - hasEntpvd, hasEqlnum, hasShrate, jfunc, oilDenT, gasDenT, - watDenT, stcond, gas_comp_index, rtemp); -} - void unpack(OilVaporizationProperties& data, std::vector& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index 3201ee0a2..b6e175aa2 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -72,7 +72,6 @@ class RestartSchedule; class RFTConfig; class Segment; class SpiralICD; -class TableManager; class TimeStampUTC; class Tuning; class UDAValue; @@ -452,7 +451,6 @@ ADD_PACK_PROTOTYPES(RFTConfig) ADD_PACK_PROTOTYPES(Segment) ADD_PACK_PROTOTYPES(SpiralICD) ADD_PACK_PROTOTYPES(std::string) -ADD_PACK_PROTOTYPES(TableManager) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeStampUTC) ADD_PACK_PROTOTYPES(Tuning) diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 9fea367c1..a0882a172 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -1261,7 +1261,7 @@ BOOST_AUTO_TEST_CASE(TableManager) {7.0, 8.0}, 77, 1.0); - auto val2 = PackUnpack(val1); + auto val2 = PackUnpack2(val1); DO_CHECKS(TableManager) #endif }