add mpi serialization for SolventDensityTable

This commit is contained in:
Arne Morten Kvarving 2020-02-26 13:30:43 +01:00
parent c23dd11d6b
commit 92303531b9
3 changed files with 40 additions and 1 deletions

View File

@ -855,6 +855,7 @@ std::size_t packSize(const TableManager& data, Dune::MPIHelper::MPICommunicator
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) +
@ -2029,6 +2030,12 @@ std::size_t packSize(const FaultCollection& data,
return packSize(data.getFaults(), comm);
}
std::size_t packSize(const SolventDensityTable& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getSolventDensityColumn(), comm);
}
////// pack routines
template<class T>
@ -2702,6 +2709,7 @@ void pack(const TableManager& data, std::vector<char>& buffer, int& position,
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);
@ -3939,6 +3947,13 @@ void pack(const EclEpsScalingPointsInfo<Scalar>& data, std::vector<char>& buffer
pack(data.maxKrg, buffer, position, comm);
}
void pack(const SolventDensityTable& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getSolventDensityColumn(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -4833,6 +4848,7 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
WatdentTable watdentTable;
std::vector<PvtwsaltTable> pvtwsaltTables;
std::vector<BrineDensityTable> bdensityTables;
std::vector<SolventDensityTable> sdensityTables;
std::map<int, PlymwinjTable> plymwinjTables;
std::map<int, SkprwatTable> skprwatTables;
std::map<int, SkprpolyTable> skprpolyTables;
@ -4860,6 +4876,7 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
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);
@ -4885,7 +4902,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,
bdensityTables, plymwinjTables,
bdensityTables, sdensityTables, plymwinjTables,
skprwatTables, skprpolyTables, tabdims, regdims, eqldims,
aqudims, hasImptvd, hasEntpvd, hasEqlnum, jfunc, oilDenT, gasDenT,
watDenT, gas_comp_index, rtemp);
@ -6691,6 +6708,15 @@ void unpack(FaultCollection& data,
data = FaultCollection(faults);
}
void unpack(SolventDensityTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<double> tableValues;
unpack(tableValues, buffer, position, comm);
data = SolventDensityTable(tableValues);
}
#define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@ -141,6 +141,7 @@ class SimulationConfig;
class SimpleTable;
class SkprpolyTable;
class SkprwatTable;
class SolventDensityTable;
class SpiralICD;
class SummaryConfig;
class SummaryNode;
@ -767,6 +768,7 @@ ADD_PACK_PROTOTYPES(SimulationConfig)
ADD_PACK_PROTOTYPES(SimpleTable)
ADD_PACK_PROTOTYPES(SkprpolyTable)
ADD_PACK_PROTOTYPES(SkprwatTable)
ADD_PACK_PROTOTYPES(SolventDensityTable)
ADD_PACK_PROTOTYPES(SpiralICD)
ADD_PACK_PROTOTYPES(std::string)
ADD_PACK_PROTOTYPES(SummaryConfig)

View File

@ -1206,6 +1206,7 @@ BOOST_AUTO_TEST_CASE(TableManager)
Opm::WatdentTable({Opm::WATDENTRecord{1.0, 2.0, 3.0}}),
{{1.0, 2.0, {1.0, 2.0, 3.0}}},
{{{1.0, 2.0, 3.0}}},
{{{4.0, 5.0, 6.0}}},
{{1, Opm::PlymwinjTable({1.0}, {2.0}, 1, {{1.0}, {2.0}})}},
{{2, Opm::SkprwatTable({1.0}, {2.0}, 1, {{1.0}, {2.0}})}},
{{3, Opm::SkprpolyTable({1.0}, {2.0}, 1, {{1.0}, {2.0}}, 3.0)}},
@ -2509,6 +2510,16 @@ BOOST_AUTO_TEST_CASE(EclEpsScalingPointsInfo)
}
BOOST_AUTO_TEST_CASE(SolventDensityTable)
{
#ifdef HAVE_MPI
Opm::SolventDensityTable val1({1.0, 2.0, 3.0});
auto val2 = PackUnpack(val1);
DO_CHECKS(SolventDensityTable)
#endif
}
bool init_unit_test_func()
{
return true;