Skip to content

Commit

Permalink
Merge pull request #2399 from akva2/serialize_tlmixpar
Browse files Browse the repository at this point in the history
add mpi serialization for TlmixparTable
  • Loading branch information
akva2 committed Mar 4, 2020
2 parents 6688c19 + 250a7fc commit 76afa6b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
26 changes: 25 additions & 1 deletion opm/simulators/utils/ParallelRestart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) +
Expand Down Expand Up @@ -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<const std::vector<TlmixparRecord>&>(data), comm);
}

////// pack routines

template<class T>
Expand Down Expand Up @@ -2715,6 +2722,7 @@ void pack(const TableManager& data, std::vector<char>& 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);
Expand Down Expand Up @@ -3973,6 +3981,12 @@ void pack(const GridDims& data,
pack(data.getNXYZ(), buffer, position, comm);
}

void pack(const TlmixparTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<TlmixparRecord>&>(data), buffer, position, comm);
}

/// unpack routines

template<class T>
Expand Down Expand Up @@ -4864,6 +4878,7 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
DensityTable densityTable;
RockTable rockTable;
ViscrefTable viscrefTable;
TlmixparTable tlmixparTable;
WatdentTable watdentTable;
std::vector<PvtwsaltTable> pvtwsaltTables;
std::vector<BrineDensityTable> bdensityTables;
Expand Down Expand Up @@ -4892,6 +4907,7 @@ void unpack(TableManager& data, std::vector<char>& 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);
Expand Down Expand Up @@ -4922,7 +4938,7 @@ void unpack(TableManager& data, std::vector<char>& 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,
Expand Down Expand Up @@ -6752,6 +6768,14 @@ void unpack(GridDims& data,
data = GridDims(NXYZ);
}

void unpack(TlmixparTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<TlmixparRecord> 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); \
Expand Down
4 changes: 4 additions & 0 deletions opm/simulators/utils/ParallelRestart.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class TableManager;
class TableSchema;
class ThresholdPressure;
class TimeStampUTC;
class TlmixparRecord;
class TlmixparTable;
class TransMult;
class Tuning;
class UDAValue;
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/test_ParallelRestart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}}},
Expand Down

0 comments on commit 76afa6b

Please sign in to comment.