add mpi serialization for PolyInjTable

This commit is contained in:
Arne Morten Kvarving 2019-12-02 23:00:46 +01:00
parent 2511121a84
commit 0cadc377ac
2 changed files with 33 additions and 0 deletions

View File

@ -36,6 +36,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/FlatTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/JFunc.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PolyInjTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
@ -477,6 +478,14 @@ std::size_t packSize(const WatdentTable& data, Dune::MPIHelper::MPICommunicator
return packSize(static_cast<const std::vector<WATDENTRecord>&>(data), comm);
}
std::size_t packSize(const PolyInjTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getThroughputs(), comm) +
packSize(data.getVelocities(), comm) +
packSize(data.getTableNumber(), comm) +
packSize(data.getTableData(), comm);
}
////// pack routines
template<class T>
@ -940,6 +949,15 @@ void pack(const WatdentTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const std::vector<WATDENTRecord>&>(data), buffer, position, comm);
}
void pack(const PolyInjTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getThroughputs(), buffer, position, comm);
pack(data.getVelocities(), buffer, position, comm);
pack(data.getTableNumber(), buffer, position, comm);
pack(data.getTableData(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -1524,6 +1542,19 @@ void unpack(WatdentTable& data, std::vector<char>& buffer, int& position,
data = WatdentTable(pdata);
}
void unpack(PolyInjTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<double> throughputs, velocities;
int tableNumber;
std::vector<std::vector<double>> tableData;
unpack(throughputs, buffer, position, comm);
unpack(velocities, buffer, position, comm);
unpack(tableNumber, buffer, position, comm);
unpack(tableData, buffer, position, comm);
data = PolyInjTable(throughputs, velocities, tableNumber, tableData);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -56,6 +56,7 @@ class JFunc;
class NNC;
struct NNCdata;
class Phases;
class PolyInjTable;
class PVCDORecord;
class PvcdoTable;
class PvtgTable;
@ -280,6 +281,7 @@ ADD_PACK_PROTOTYPES(JFunc)
ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata)
ADD_PACK_PROTOTYPES(Phases)
ADD_PACK_PROTOTYPES(PolyInjTable)
ADD_PACK_PROTOTYPES(PVCDORecord)
ADD_PACK_PROTOTYPES(PvcdoTable)
ADD_PACK_PROTOTYPES(PvtgTable)