add mpi serialization for PvtwsaltTable

This commit is contained in:
Arne Morten Kvarving
2020-01-08 12:38:37 +01:00
committed by Tor Harald Sandve
parent b9f8429691
commit 1f8ed78683
3 changed files with 33 additions and 22 deletions

View File

@@ -1682,6 +1682,14 @@ std::size_t packSize(const BrineDensityTable& data,
return packSize(data.getBrineDensityColumn(), comm); return packSize(data.getBrineDensityColumn(), comm);
} }
std::size_t packSize(const PvtwsaltTable& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getReferencePressureValue(), comm) +
packSize(data.getReferenceSaltConcentrationValue(), comm) +
packSize(data.getTableValues(), comm);
}
std::size_t packSize(const SummaryNode& data, std::size_t packSize(const SummaryNode& data,
Dune::MPIHelper::MPICommunicator comm) Dune::MPIHelper::MPICommunicator comm)
{ {
@@ -3406,28 +3414,6 @@ void pack(const BrineDensityTable& data,
pack(data.getBrineDensityColumn(), buffer, position, comm); pack(data.getBrineDensityColumn(), buffer, position, comm);
} }
void pack(const SummaryNode& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.keyword(), buffer, position, comm);
pack(data.category(), buffer, position, comm);
pack(data.location(), buffer, position, comm) ;
pack(data.type(), buffer, position, comm);
pack(data.namedEntity(), buffer, position, comm);
pack(data.number(), buffer, position, comm);
pack(data.isUserDefined(), buffer, position, comm);
}
void pack(const SummaryConfig& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getKwds(), buffer, position, comm);
pack(data.getShortKwds(), buffer, position, comm);
pack(data.getSmryKwds(), buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@@ -5869,6 +5855,18 @@ void unpack(BrineDensityTable& data, std::vector<char>& buffer, int& position,
data = BrineDensityTable(tableValues); data = BrineDensityTable(tableValues);
} }
void unpack(PvtwsaltTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
double refPressValue, refSaltConValue;
std::vector<double> tableValues;
unpack(refPressValue, buffer, position, comm);
unpack(refSaltConValue, buffer, position, comm);
unpack(tableValues, buffer, position, comm);
data = PvtwsaltTable(refPressValue, refSaltConValue, tableValues);
}
void unpack(SummaryNode& data, void unpack(SummaryNode& data,
std::vector<char>& buffer, int& position, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) Dune::MPIHelper::MPICommunicator comm)

View File

@@ -110,6 +110,7 @@ class PvcdoTable;
class PvtgTable; class PvtgTable;
class PvtoTable; class PvtoTable;
class PVTWRecord; class PVTWRecord;
class PvtwsaltTable;
class PvtwTable; class PvtwTable;
class Regdims; class Regdims;
class RestartConfig; class RestartConfig;
@@ -688,6 +689,7 @@ ADD_PACK_PROTOTYPES(PvcdoTable)
ADD_PACK_PROTOTYPES(PvtgTable) ADD_PACK_PROTOTYPES(PvtgTable)
ADD_PACK_PROTOTYPES(PvtoTable) ADD_PACK_PROTOTYPES(PvtoTable)
ADD_PACK_PROTOTYPES(PVTWRecord) ADD_PACK_PROTOTYPES(PVTWRecord)
ADD_PACK_PROTOTYPES(PvtwsaltTable)
ADD_PACK_PROTOTYPES(PvtwTable) ADD_PACK_PROTOTYPES(PvtwTable)
ADD_PACK_PROTOTYPES(Regdims) ADD_PACK_PROTOTYPES(Regdims)
ADD_PACK_PROTOTYPES(RestartConfig) ADD_PACK_PROTOTYPES(RestartConfig)

View File

@@ -2387,6 +2387,17 @@ BOOST_AUTO_TEST_CASE(SummaryConfig)
} }
BOOST_AUTO_TEST_CASE(PvtwsaltTable)
{
#ifdef HAVE_MPI
Opm::PvtwsaltTable val1(1.0, 2.0, {3.0, 4.0, 5.0});
auto val2 = PackUnpack(val1);
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
BOOST_CHECK(val1 == std::get<0>(val2));
#endif
}
bool init_unit_test_func() bool init_unit_test_func()
{ {
return true; return true;