add mpi serialization for DensityTable

This commit is contained in:
Arne Morten Kvarving 2019-12-02 15:52:39 +01:00
parent e5b1b48bcb
commit 0adbdc1d05
3 changed files with 32 additions and 0 deletions

View File

@ -460,6 +460,11 @@ std::size_t packSize(const PvcdoTable& data, Dune::MPIHelper::MPICommunicator co
return packSize(static_cast<const std::vector<PVCDORecord>&>(data), comm);
}
std::size_t packSize(const DensityTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<DENSITYRecord>&>(data), comm);
}
////// pack routines
template<class T>
@ -905,6 +910,12 @@ void pack(const PvcdoTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const std::vector<PVCDORecord>&>(data), buffer, position, comm);
}
void pack(const DensityTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<DENSITYRecord>&>(data), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -1465,6 +1476,14 @@ void unpack(PvcdoTable& data, std::vector<char>& buffer, int& position,
data = PvcdoTable(pdata);
}
void unpack(DensityTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<DENSITYRecord> pdata;
unpack(pdata, buffer, position, comm);
data = DensityTable(pdata);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -42,6 +42,7 @@ namespace Opm
class Actdims;
class ColumnSchema;
class DENSITYRecord;
class DensityTable;
class EclHysterConfig;
class EDITNNC;
class EndpointScaling;
@ -261,6 +262,7 @@ ADD_PACK_PROTOTYPES(data::Solution)
ADD_PACK_PROTOTYPES(data::Well)
ADD_PACK_PROTOTYPES(data::WellRates)
ADD_PACK_PROTOTYPES(DENSITYRecord)
ADD_PACK_PROTOTYPES(DensityTable)
ADD_PACK_PROTOTYPES(EDITNNC)
ADD_PACK_PROTOTYPES(EndpointScaling)
ADD_PACK_PROTOTYPES(Equil)

View File

@ -772,6 +772,17 @@ BOOST_AUTO_TEST_CASE(DENSITYRecord)
}
BOOST_AUTO_TEST_CASE(DensityTable)
{
#if HAVE_MPI
Opm::DensityTable val1({Opm::DENSITYRecord{1.0, 2.0, 3.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()
{
return true;