mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for Rock2dTable
This commit is contained in:
parent
fb7d4b7cb9
commit
5a1f1a6b36
@ -25,6 +25,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
#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 <dune/common/parallel/mpitraits.hh>
|
||||
|
||||
namespace Opm
|
||||
@ -226,6 +227,12 @@ std::size_t packSize(const EDITNNC& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
return packSize(data.data(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Rock2dTable& data, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.pvmultValues(), comm) +
|
||||
packSize(data.pressureValues(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -458,6 +465,13 @@ void pack(const EDITNNC& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.data(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Rock2dTable& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.pvmultValues(), buffer, position, comm);
|
||||
pack(data.pressureValues(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -706,6 +720,16 @@ void unpack(EDITNNC& data, std::vector<char>& buffer, int& position,
|
||||
data = EDITNNC(res);
|
||||
}
|
||||
|
||||
void unpack(Rock2dTable& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<std::vector<double>> pvmultValues;
|
||||
std::vector<double> pressureValues;
|
||||
unpack(pvmultValues, buffer, position, comm);
|
||||
unpack(pressureValues, buffer, position, comm);
|
||||
data = Rock2dTable(pvmultValues, pressureValues);
|
||||
}
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
@ -39,6 +39,7 @@ namespace Opm
|
||||
class EDITNNC;
|
||||
class NNC;
|
||||
struct NNCdata;
|
||||
class Rock2dTable;
|
||||
class ThresholdPressure;
|
||||
|
||||
namespace Mpi
|
||||
@ -194,6 +195,7 @@ ADD_PACK_PROTOTYPES(NNC)
|
||||
ADD_PACK_PROTOTYPES(NNCdata)
|
||||
ADD_PACK_PROTOTYPES(RestartKey)
|
||||
ADD_PACK_PROTOTYPES(RestartValue)
|
||||
ADD_PACK_PROTOTYPES(Rock2dTable)
|
||||
ADD_PACK_PROTOTYPES(std::string)
|
||||
ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#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/output/eclipse/RestartValue.hpp>
|
||||
|
||||
|
||||
@ -273,6 +274,17 @@ BOOST_AUTO_TEST_CASE(NNC)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Rock2dTable)
|
||||
{
|
||||
#if HAVE_MPI
|
||||
Opm::Rock2dTable 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