add mpi serialization for WatdentTable

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

View File

@@ -472,6 +472,11 @@ std::size_t packSize(const ViscrefTable& data, Dune::MPIHelper::MPICommunicator
return packSize(static_cast<const std::vector<VISCREFRecord>&>(data), comm); return packSize(static_cast<const std::vector<VISCREFRecord>&>(data), comm);
} }
std::size_t packSize(const WatdentTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const std::vector<WATDENTRecord>&>(data), comm);
}
////// pack routines ////// pack routines
template<class T> template<class T>
@@ -929,6 +934,12 @@ void pack(const ViscrefTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const std::vector<VISCREFRecord>&>(data), buffer, position, comm); pack(static_cast<const std::vector<VISCREFRecord>&>(data), buffer, position, comm);
} }
void pack(const WatdentTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const std::vector<WATDENTRecord>&>(data), buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@@ -1505,6 +1516,14 @@ void unpack(ViscrefTable& data, std::vector<char>& buffer, int& position,
data = ViscrefTable(pdata); data = ViscrefTable(pdata);
} }
void unpack(WatdentTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<WATDENTRecord> pdata;
unpack(pdata, buffer, position, comm);
data = WatdentTable(pdata);
}
} // end namespace Mpi } // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState, RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys, const std::vector<Opm::RestartKey>& solutionKeys,

View File

@@ -78,6 +78,7 @@ class UDQParams;
class VISCREFRecord; class VISCREFRecord;
class ViscrefTable; class ViscrefTable;
class WATDENTRecord; class WATDENTRecord;
class WatdentTable;
class Welldims; class Welldims;
class WellSegmentDims; class WellSegmentDims;
@@ -306,6 +307,7 @@ ADD_PACK_PROTOTYPES(UDQParams)
ADD_PACK_PROTOTYPES(VISCREFRecord) ADD_PACK_PROTOTYPES(VISCREFRecord)
ADD_PACK_PROTOTYPES(ViscrefTable) ADD_PACK_PROTOTYPES(ViscrefTable)
ADD_PACK_PROTOTYPES(WATDENTRecord) ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Welldims) ADD_PACK_PROTOTYPES(Welldims)
ADD_PACK_PROTOTYPES(WellSegmentDims) ADD_PACK_PROTOTYPES(WellSegmentDims)

View File

@@ -816,6 +816,17 @@ BOOST_AUTO_TEST_CASE(WATDENTRecord)
} }
BOOST_AUTO_TEST_CASE(WatdentTable)
{
#if HAVE_MPI
Opm::WatdentTable val1({Opm::WATDENTRecord{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() bool init_unit_test_func()
{ {
return true; return true;