add mpi serialization for RocktabTable

This commit is contained in:
Arne Morten Kvarving 2020-03-06 09:03:58 +01:00
parent 719c008f22
commit c3e3524753
3 changed files with 45 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/RocktabTable.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>
@ -1859,6 +1860,12 @@ std::size_t packSize(const PlyshlogTable& data, Dune::MPIHelper::MPICommunicator
packSize(data.hasRefTemperature(), comm);
}
std::size_t packSize(const RocktabTable& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(static_cast<const SimpleTable&>(data), comm) +
packSize(data.isDirectional(), comm);
}
////// pack routines
template<class T>
@ -3600,6 +3607,13 @@ void pack(const PlyshlogTable& data, std::vector<char>& buffer, int& position,
pack(data.hasRefTemperature(), buffer, position, comm);
}
void pack(const RocktabTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(static_cast<const SimpleTable&>(data), buffer, position, comm);
pack(data.isDirectional(), buffer, position, comm);
}
/// unpack routines
template<class T>
@ -6079,6 +6093,22 @@ void unpack(PlyshlogTable& data, std::vector<char>& buffer, int& position,
refTemperature, hasRefSalinity, hasRefTemperature);
}
void unpack(RocktabTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
TableSchema schema;
OrderedMap<std::string, TableColumn> columns;
bool jfunc;
bool isDirectional;
unpack(schema, buffer, position, comm);
unpack(columns, buffer, position, comm);
unpack(jfunc, buffer, position, comm);
unpack(isDirectional, buffer, position, comm);
data = RocktabTable(schema, columns, jfunc, isDirectional);
}
#define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@ -128,6 +128,7 @@ class RestartSchedule;
class RFTConfig;
class ROCKRecord;
class RockTable;
class RocktabTable;
class Rock2dTable;
class Rock2dtrTable;
class Runspec;
@ -597,6 +598,7 @@ ADD_PACK_PROTOTYPES(ROCKRecord)
ADD_PACK_PROTOTYPES(RockTable)
ADD_PACK_PROTOTYPES(Rock2dTable)
ADD_PACK_PROTOTYPES(Rock2dtrTable)
ADD_PACK_PROTOTYPES(RocktabTable)
ADD_PACK_PROTOTYPES(Runspec)
ADD_PACK_PROTOTYPES(Schedule)
ADD_PACK_PROTOTYPES(Segment)

View File

@ -93,6 +93,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/RocktabTable.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>
@ -2400,6 +2401,18 @@ BOOST_AUTO_TEST_CASE(PlyshlogTable)
}
BOOST_AUTO_TEST_CASE(RocktabTable)
{
#ifdef HAVE_MPI
Opm::OrderedMap<std::string, Opm::TableColumn> data;
data.insert({"test3", getTableColumn()});
Opm::RocktabTable val1(getTableSchema(), data, true, true);
auto val2 = PackUnpack(val1);
DO_CHECKS(RocktabTable)
#endif
}
bool init_unit_test_func()
{
return true;