mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for SimpleTable
This commit is contained in:
parent
443cb4402f
commit
ec95a19f4c
@ -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/SimpleTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
||||||
#include <dune/common/parallel/mpitraits.hh>
|
#include <dune/common/parallel/mpitraits.hh>
|
||||||
@ -285,6 +286,13 @@ std::size_t packSize(const TableColumn& data, Dune::MPIHelper::MPICommunicator c
|
|||||||
packSize(data.defaultCount(), comm);
|
packSize(data.defaultCount(), comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t packSize(const SimpleTable& data, Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.schema(), comm) +
|
||||||
|
packSize(data.columns(), comm) +
|
||||||
|
packSize(data.jfunc(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -555,6 +563,14 @@ void pack(const TableColumn& data, std::vector<char>& buffer, int& position,
|
|||||||
pack(data.defaultCount(), buffer, position, comm);
|
pack(data.defaultCount(), buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pack(const SimpleTable& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data.schema(), buffer, position, comm);
|
||||||
|
pack(data.columns(), buffer, position, comm);
|
||||||
|
pack(data.jfunc(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -869,6 +885,18 @@ void unpack(TableColumn& data, std::vector<char>& buffer, int& position,
|
|||||||
data = TableColumn(schema, name, values, defaults, defaultCount);
|
data = TableColumn(schema, name, values, defaults, defaultCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unpack(SimpleTable& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
TableSchema schema;
|
||||||
|
OrderedMap<std::string, TableColumn> columns;
|
||||||
|
bool jf;
|
||||||
|
unpack(schema, buffer, position, comm);
|
||||||
|
unpack(columns, buffer, position, comm);
|
||||||
|
unpack(jf, buffer, position, comm);
|
||||||
|
data = SimpleTable(schema, columns, jf);
|
||||||
|
}
|
||||||
|
|
||||||
} // 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 SimpleTable;
|
||||||
class TableColumn;
|
class TableColumn;
|
||||||
class TableSchema;
|
class TableSchema;
|
||||||
class ThresholdPressure;
|
class ThresholdPressure;
|
||||||
@ -226,6 +227,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(SimpleTable)
|
||||||
ADD_PACK_PROTOTYPES(TableColumn)
|
ADD_PACK_PROTOTYPES(TableColumn)
|
||||||
ADD_PACK_PROTOTYPES(TableSchema)
|
ADD_PACK_PROTOTYPES(TableSchema)
|
||||||
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||||
|
@ -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/SimpleTable.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/TableColumn.hpp>
|
||||||
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
#include <opm/parser/eclipse/EclipseState/Tables/TableSchema.hpp>
|
||||||
#include <opm/output/eclipse/RestartValue.hpp>
|
#include <opm/output/eclipse/RestartValue.hpp>
|
||||||
@ -139,6 +140,14 @@ Opm::TableColumn getTableColumn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Opm::SimpleTable getSimpleTable()
|
||||||
|
{
|
||||||
|
Opm::OrderedMap<std::string, Opm::TableColumn> data;
|
||||||
|
data.insert({"test3", getTableColumn()});
|
||||||
|
return Opm::SimpleTable(getTableSchema(), data, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -356,6 +365,17 @@ BOOST_AUTO_TEST_CASE(TableColumn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(SimpleTable)
|
||||||
|
{
|
||||||
|
#if HAVE_MPI
|
||||||
|
Opm::SimpleTable val1 = getSimpleTable();
|
||||||
|
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user