mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for TableSchema
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
||||||
#include <dune/common/parallel/mpitraits.hh>
|
#include <dune/common/parallel/mpitraits.hh>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@@ -259,6 +260,11 @@ std::size_t packSize(const ColumnSchema& data, Dune::MPIHelper::MPICommunicator
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t packSize(const TableSchema& data, Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.getColumns(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -523,6 +529,12 @@ void pack(const ColumnSchema& data, std::vector<char>& buffer, int& position,
|
|||||||
pack(data.getDefaultValue(), buffer, position, comm);
|
pack(data.getDefaultValue(), buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pack(const TableSchema& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data.getColumns(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -819,6 +831,14 @@ void unpack(ColumnSchema& data, std::vector<char>& buffer, int& position,
|
|||||||
data = ColumnSchema(name, order, action);
|
data = ColumnSchema(name, order, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unpack(TableSchema& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
OrderedMap<std::string, ColumnSchema> columns;
|
||||||
|
unpack(columns, buffer, position, comm);
|
||||||
|
data = TableSchema(columns);
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace Mpi
|
} // end namespace Mpi
|
||||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class NNC;
|
|||||||
struct NNCdata;
|
struct NNCdata;
|
||||||
class Rock2dTable;
|
class Rock2dTable;
|
||||||
class Rock2dtrTable;
|
class Rock2dtrTable;
|
||||||
|
class TableSchema;
|
||||||
class ThresholdPressure;
|
class ThresholdPressure;
|
||||||
|
|
||||||
namespace Mpi
|
namespace Mpi
|
||||||
@@ -213,6 +214,7 @@ ADD_PACK_PROTOTYPES(RestartValue)
|
|||||||
ADD_PACK_PROTOTYPES(Rock2dTable)
|
ADD_PACK_PROTOTYPES(Rock2dTable)
|
||||||
ADD_PACK_PROTOTYPES(Rock2dtrTable)
|
ADD_PACK_PROTOTYPES(Rock2dtrTable)
|
||||||
ADD_PACK_PROTOTYPES(std::string)
|
ADD_PACK_PROTOTYPES(std::string)
|
||||||
|
ADD_PACK_PROTOTYPES(TableSchema)
|
||||||
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||||
|
|
||||||
} // end namespace Mpi
|
} // end namespace Mpi
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/ColumnSchema.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
||||||
|
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
||||||
#include <opm/output/eclipse/RestartValue.hpp>
|
#include <opm/output/eclipse/RestartValue.hpp>
|
||||||
|
|
||||||
|
|
||||||
@@ -119,6 +120,16 @@ Opm::ThresholdPressure getThresholdPressure()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Opm::TableSchema getTableSchema()
|
||||||
|
{
|
||||||
|
Opm::OrderedMap<std::string, Opm::ColumnSchema> data;
|
||||||
|
data.insert({"test1", Opm::ColumnSchema("test1", Opm::Table::INCREASING,
|
||||||
|
Opm::Table::DEFAULT_LINEAR)});
|
||||||
|
data.insert({"test2", Opm::ColumnSchema("test2", Opm::Table::INCREASING, 1.0)});
|
||||||
|
return Opm::TableSchema(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -314,6 +325,17 @@ BOOST_AUTO_TEST_CASE(ColumnSchema)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(TableSchema)
|
||||||
|
{
|
||||||
|
#if HAVE_MPI
|
||||||
|
Opm::TableSchema val1 = getTableSchema();
|
||||||
|
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()
|
bool init_unit_test_func()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user