add mpi serialization for PlyshlogTable

This commit is contained in:
Arne Morten Kvarving
2020-03-06 08:52:42 +01:00
parent c4439976fe
commit 719c008f22
3 changed files with 63 additions and 0 deletions

View File

@@ -82,6 +82,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/Regdims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SkprwatTable.hpp>
@@ -1848,6 +1849,16 @@ std::size_t packSize(const Stone1exTable& data, Dune::MPIHelper::MPICommunicator
return packSize(static_cast<const std::vector<Stone1exRecord>&>(data), comm);
}
std::size_t packSize(const PlyshlogTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const SimpleTable&>(data), comm) +
packSize(data.getRefPolymerConcentration(), comm) +
packSize(data.getRefSalinity(), comm) +
packSize(data.getRefTemperature(), comm) +
packSize(data.hasRefSalinity(), comm) +
packSize(data.hasRefTemperature(), comm);
}
////// pack routines
template<class T>
@@ -3578,6 +3589,17 @@ void pack(const Stone1exTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const std::vector<Stone1exRecord>&>(data), buffer, position, comm);
}
void pack(const PlyshlogTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const SimpleTable&>(data), buffer, position, comm);
pack(data.getRefPolymerConcentration(), buffer, position, comm);
pack(data.getRefSalinity(), buffer, position, comm);
pack(data.getRefTemperature(), buffer, position, comm);
pack(data.hasRefSalinity(), buffer, position, comm);
pack(data.hasRefTemperature(), buffer, position, comm);
}
/// unpack routines
template<class T>
@@ -6031,6 +6053,32 @@ void unpack(Stone1exTable& data, std::vector<char>& buffer, int& position,
data = Stone1exTable(pdata);
}
void unpack(PlyshlogTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
TableSchema schema;
OrderedMap<std::string, TableColumn> columns;
bool jfunc;
double refPolymerConcentration;
double refSalinity;
double refTemperature;
bool hasRefSalinity;
bool hasRefTemperature;
unpack(schema, buffer, position, comm);
unpack(columns, buffer, position, comm);
unpack(jfunc, buffer, position, comm);
unpack(refPolymerConcentration, buffer, position, comm);
unpack(refSalinity, buffer, position, comm);
unpack(refTemperature, buffer, position, comm);
unpack(hasRefSalinity, buffer, position, comm);
unpack(hasRefTemperature, buffer, position, comm);
data = PlyshlogTable(schema, columns, jfunc,
refPolymerConcentration, refSalinity,
refTemperature, hasRefSalinity, hasRefTemperature);
}
#define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@@ -109,6 +109,7 @@ struct NNCdata;
class OilVaporizationProperties;
class Phases;
class PlymwinjTable;
class PlyshlogTable;
class PlyvmhRecord;
class PlyvmhTable;
class PolyInjTable;
@@ -573,6 +574,7 @@ ADD_PACK_PROTOTYPES(Phases)
ADD_PACK_PROTOTYPES(PlmixparRecord)
ADD_PACK_PROTOTYPES(PlmixparTable)
ADD_PACK_PROTOTYPES(PlymwinjTable)
ADD_PACK_PROTOTYPES(PlyshlogTable)
ADD_PACK_PROTOTYPES(PlyvmhRecord)
ADD_PACK_PROTOTYPES(PlyvmhTable)
ADD_PACK_PROTOTYPES(PolyInjTable)

View File

@@ -87,6 +87,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/DenT.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/JFunc.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlymwinjTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PlyshlogTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtgTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/PvtoTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Regdims.hpp>
@@ -2387,6 +2388,18 @@ BOOST_AUTO_TEST_CASE(GridDims)
}
BOOST_AUTO_TEST_CASE(PlyshlogTable)
{
#ifdef HAVE_MPI
Opm::OrderedMap<std::string, Opm::TableColumn> data;
data.insert({"test3", getTableColumn()});
Opm::PlyshlogTable val1(getTableSchema(), data, true, 1.0, 2.0, 3.0, true, true);
auto val2 = PackUnpack(val1);
DO_CHECKS(PlyshlogTable)
#endif
}
bool init_unit_test_func()
{
return true;