add mpi serialization for SkprpolyTable

This commit is contained in:
Arne Morten Kvarving 2019-12-02 23:34:19 +01:00
parent cda78cee94
commit 81602af103
3 changed files with 37 additions and 0 deletions

View File

@ -43,6 +43,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
@ -492,6 +493,12 @@ std::size_t packSize(const PlymwinjTable& data, Dune::MPIHelper::MPICommunicator
return packSize(static_cast<const PolyInjTable&>(data), comm);
}
std::size_t packSize(const SkprpolyTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const PolyInjTable&>(data), comm) +
packSize(data.referenceConcentration(), comm);
}
////// pack routines
template<class T>
@ -970,6 +977,13 @@ void pack(const PlymwinjTable& data, std::vector<char>& buffer, int& position,
pack(static_cast<const PolyInjTable&>(data), buffer, position, comm);
}
void pack(const SkprpolyTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const PolyInjTable&>(data), buffer, position, comm);
pack(data.referenceConcentration(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -1573,6 +1587,15 @@ void unpack(PlymwinjTable& data, std::vector<char>& buffer, int& position,
unpack(static_cast<PolyInjTable&>(data), buffer, position, comm);
}
void unpack(SkprpolyTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(static_cast<PolyInjTable&>(data), buffer, position, comm);
double refConcentration;
unpack(refConcentration, buffer, position, comm);
data.setReferenceConcentration(refConcentration);
}
} // end namespace Mpi
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
const std::vector<Opm::RestartKey>& solutionKeys,

View File

@ -71,6 +71,7 @@ class Rock2dtrTable;
class Runspec;
class SimulationConfig;
class SimpleTable;
class SkprpolyTable;
class Tabdims;
class TableColumn;
class TableContainer;
@ -300,6 +301,7 @@ ADD_PACK_PROTOTYPES(Runspec)
ADD_PACK_PROTOTYPES(std::string)
ADD_PACK_PROTOTYPES(SimulationConfig)
ADD_PACK_PROTOTYPES(SimpleTable)
ADD_PACK_PROTOTYPES(SkprpolyTable)
ADD_PACK_PROTOTYPES(Tabdims)
ADD_PACK_PROTOTYPES(TableColumn)
ADD_PACK_PROTOTYPES(TableContainer)

View File

@ -45,6 +45,7 @@
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SimpleTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/SkprpolyTable.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Tabdims.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/TableContainer.hpp>
@ -839,6 +840,17 @@ BOOST_AUTO_TEST_CASE(PlymwinjTable)
}
BOOST_AUTO_TEST_CASE(SkprpolyTable)
{
#if HAVE_MPI
Opm::SkprpolyTable val1({1.0}, {2.0}, 1, {{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()
{
return true;