mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-29 04:23:48 -06:00
add mpi serialization for Rock2dtrTable
This commit is contained in:
parent
5a1f1a6b36
commit
e08a5c3046
@ -26,6 +26,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
||||
#include <dune/common/parallel/mpitraits.hh>
|
||||
|
||||
namespace Opm
|
||||
@ -233,6 +234,12 @@ std::size_t packSize(const Rock2dTable& data, Dune::MPIHelper::MPICommunicator c
|
||||
packSize(data.pressureValues(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Rock2dtrTable& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.transMultValues(), comm) +
|
||||
packSize(data.pressureValues(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -472,6 +479,13 @@ void pack(const Rock2dTable& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.pressureValues(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Rock2dtrTable& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.transMultValues(), buffer, position, comm);
|
||||
pack(data.pressureValues(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -730,6 +744,16 @@ void unpack(Rock2dTable& data, std::vector<char>& buffer, int& position,
|
||||
data = Rock2dTable(pvmultValues, pressureValues);
|
||||
}
|
||||
|
||||
void unpack(Rock2dtrTable& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<std::vector<double>> transMultValues;
|
||||
std::vector<double> pressureValues;
|
||||
unpack(transMultValues, buffer, position, comm);
|
||||
unpack(pressureValues, buffer, position, comm);
|
||||
data = Rock2dtrTable(transMultValues, pressureValues);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
@ -40,6 +40,7 @@ class EDITNNC;
|
||||
class NNC;
|
||||
struct NNCdata;
|
||||
class Rock2dTable;
|
||||
class Rock2dtrTable;
|
||||
class ThresholdPressure;
|
||||
|
||||
namespace Mpi
|
||||
@ -196,6 +197,7 @@ ADD_PACK_PROTOTYPES(NNCdata)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
ADD_PACK_PROTOTYPES(RestartValue)
|
||||
ADD_PACK_PROTOTYPES(Rock2dTable)
|
||||
ADD_PACK_PROTOTYPES(Rock2dtrTable)
|
||||
ADD_PACK_PROTOTYPES(std::string)
|
||||
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
|
||||
|
||||
@ -285,6 +286,17 @@ BOOST_AUTO_TEST_CASE(Rock2dTable)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Rock2dtrTable)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::Rock2dtrTable val1({{1.0,2.0},{3.0,4.0}}, {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;
|
||||
|
Loading…
Reference in New Issue
Block a user