add mpi serialization of PvtxTable

This commit is contained in:
Arne Morten Kvarving
2019-12-18 13:08:13 +01:00
parent 6ca259c890
commit d4df817b50
3 changed files with 131 additions and 3 deletions
+77
View File
@@ -34,6 +34,8 @@
#include <opm/parser/eclipse/EclipseState/SimulationConfig/SimulationConfig.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.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>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
@@ -422,6 +424,26 @@ std::size_t packSize(const Runspec& data, Dune::MPIHelper::MPICommunicator comm)
packSize(data.actdims(), comm);
}
std::size_t packSize(const PvtxTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getOuterColumnSchema(), comm) +
packSize(data.getOuterColumn(), comm) +
packSize(data.getUnderSaturatedSchema(), comm) +
packSize(data.getSaturatedSchema(), comm) +
packSize(data.getUnderSaturatedTables(), comm) +
packSize(data.getSaturatedTable(), comm);
}
std::size_t packSize(const PvtgTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const PvtxTable&>(data), comm);
}
std::size_t packSize(const PvtoTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const PvtxTable&>(data), comm);
}
////// pack routines
template<class T>
@@ -832,6 +854,29 @@ void pack(const Runspec& data, std::vector<char>& buffer, int& position,
pack(data.actdims(), buffer, position, comm);
}
void pack(const PvtxTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getOuterColumnSchema(), buffer, position, comm);
pack(data.getOuterColumn(), buffer, position, comm);
pack(data.getUnderSaturatedSchema(), buffer, position, comm);
pack(data.getSaturatedSchema(), buffer, position, comm);
pack(data.getUnderSaturatedTables(), buffer, position, comm);
pack(data.getSaturatedTable(), buffer, position, comm);
}
void pack(const PvtgTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const PvtxTable&>(data), buffer, position, comm);
}
void pack(const PvtoTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const PvtxTable&>(data), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -1345,6 +1390,38 @@ void unpack(Runspec& data, std::vector<char>& buffer, int& position,
udqparams, hystPar, actdims);
}
template<class PVTType>
void unpack_pvt(PVTType& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
ColumnSchema outer_schema;
TableColumn outer_column;
TableSchema undersat_schema, sat_schema;
std::vector<SimpleTable> undersat_tables;
SimpleTable sat_table;
unpack(outer_schema, buffer, position, comm);
unpack(outer_column, buffer, position, comm);
unpack(undersat_schema, buffer, position, comm);
unpack(sat_schema, buffer, position, comm);
unpack(undersat_tables, buffer, position, comm);
unpack(sat_table, buffer, position, comm);
data = PVTType(outer_schema, outer_column, undersat_schema, sat_schema,
undersat_tables, sat_table);
}
void unpack(PvtgTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack_pvt(data, buffer, position, comm);
}
void unpack(PvtoTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack_pvt(data, buffer, position, comm);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,
+4
View File
@@ -53,6 +53,8 @@ class IOConfig;
class NNC;
struct NNCdata;
class Phases;
class PvtgTable;
class PvtoTable;
class RestartConfig;
class RestartSchedule;
class Rock2dTable;
@@ -264,6 +266,8 @@ ADD_PACK_PROTOTYPES(IOConfig)
ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata)
ADD_PACK_PROTOTYPES(Phases)
ADD_PACK_PROTOTYPES(PvtgTable)
ADD_PACK_PROTOTYPES(PvtoTable)
ADD_PACK_PROTOTYPES(RestartConfig)
ADD_PACK_PROTOTYPES(RestartKey)
ADD_PACK_PROTOTYPES(RestartSchedule)