add mpi serialization for Rock2dTable

This commit is contained in:
Arne Morten Kvarving
2019-11-28 15:46:13 +01:00
parent fb7d4b7cb9
commit 5a1f1a6b36
3 changed files with 38 additions and 0 deletions

View File

@@ -25,6 +25,7 @@
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
#include <dune/common/parallel/mpitraits.hh>
namespace Opm
@@ -226,6 +227,12 @@ std::size_t packSize(const EDITNNC& data, Dune::MPIHelper::MPICommunicator comm)
return packSize(data.data(), comm);
}
std::size_t packSize(const Rock2dTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.pvmultValues(), comm) +
packSize(data.pressureValues(), comm);
}
////// pack routines
template<class T>
@@ -458,6 +465,13 @@ void pack(const EDITNNC& data, std::vector<char>& buffer, int& position,
pack(data.data(), buffer, position, comm);
}
void pack(const Rock2dTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.pvmultValues(), buffer, position, comm);
pack(data.pressureValues(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -706,6 +720,16 @@ void unpack(EDITNNC& data, std::vector<char>& buffer, int& position,
data = EDITNNC(res);
}
void unpack(Rock2dTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<std::vector<double>> pvmultValues;
std::vector<double> pressureValues;
unpack(pvmultValues, buffer, position, comm);
unpack(pressureValues, buffer, position, comm);
data = Rock2dTable(pvmultValues, pressureValues);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,