add mpi serialization for RockTable

This commit is contained in:
Arne Morten Kvarving 2019-12-03 11:49:27 +01:00
parent fb4c1deb10
commit f9fc843ce2
3 changed files with 32 additions and 0 deletions

View File

@ -512,6 +512,11 @@ std::size_t packSize(const SkprwatTable& data, Dune::MPIHelper::MPICommunicator
return packSize(static_cast<const PolyInjTable&>(data), comm);
}
std::size_t packSize(const RockTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<ROCKRecord>&>(data), comm);
}
////// pack routines
template<class T>
@ -1003,6 +1008,12 @@ void pack(const SkprwatTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const PolyInjTable&>(data), buffer, position, comm);
}
void pack(const RockTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<ROCKRecord>&>(data), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -1621,6 +1632,14 @@ void unpack(SkprwatTable& data, std::vector<char>& buffer, int& position,
unpack(static_cast<PolyInjTable&>(data), buffer, position, comm);
}
void unpack(RockTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<ROCKRecord> pdata;
unpack(pdata, buffer, position, comm);
data = RockTable(pdata);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -70,6 +70,7 @@ class Regdims;
class RestartConfig;
class RestartSchedule;
class ROCKRecord;
class RockTable;
class Rock2dTable;
class Rock2dtrTable;
class Runspec;
@ -304,6 +305,7 @@ ADD_PACK_PROTOTYPES(RestartKey)
ADD_PACK_PROTOTYPES(RestartSchedule)
ADD_PACK_PROTOTYPES(RestartValue)
ADD_PACK_PROTOTYPES(ROCKRecord)
ADD_PACK_PROTOTYPES(RockTable)
ADD_PACK_PROTOTYPES(Rock2dTable)
ADD_PACK_PROTOTYPES(Rock2dtrTable)
ADD_PACK_PROTOTYPES(Runspec)

View File

@ -910,6 +910,17 @@ BOOST_AUTO_TEST_CASE(ROCKRecord)
}
BOOST_AUTO_TEST_CASE(RockTable)
{
#if HAVE_MPI
Opm::RockTable val1({Opm::ROCKRecord{1.0,2.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;