mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for UniformXTabulated2DFunction
This commit is contained in:
@@ -604,6 +604,19 @@ std::size_t packSize(const IntervalTabulated2DFunction<Scalar>& data,
|
||||
template std::size_t packSize(const IntervalTabulated2DFunction<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const UniformXTabulated2DFunction<Scalar>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.xPos(), comm) +
|
||||
packSize(data.yPos(), comm) +
|
||||
packSize(data.samples(), comm) +
|
||||
packSize(data.interpolationGuide(), comm);
|
||||
}
|
||||
|
||||
template std::size_t packSize(const UniformXTabulated2DFunction<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const DryGasPvt<Scalar>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
@@ -1193,6 +1206,30 @@ template void pack(const IntervalTabulated2DFunction<double>& data,
|
||||
std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template
|
||||
void pack(const std::vector<IntervalTabulated2DFunction<double>>& data,
|
||||
std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template
|
||||
void pack(const std::map<int,IntervalTabulated2DFunction<double>>& data,
|
||||
std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const UniformXTabulated2DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.xPos(), buffer, position, comm);
|
||||
pack(data.yPos(), buffer, position, comm);
|
||||
pack(data.samples(), buffer, position, comm);
|
||||
pack(data.interpolationGuide(), buffer, position, comm);
|
||||
}
|
||||
|
||||
template void pack(const UniformXTabulated2DFunction<double>& data,
|
||||
std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const SolventPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
@@ -1964,6 +2001,25 @@ template void unpack(IntervalTabulated2DFunction<double>& data,
|
||||
std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(UniformXTabulated2DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<Scalar> xPos, yPos;
|
||||
std::vector<std::vector<typename UniformXTabulated2DFunction<Scalar>::SamplePoint>> samples;
|
||||
typename UniformXTabulated2DFunction<Scalar>::InterpolationPolicy interpolationGuide;
|
||||
unpack(xPos, buffer, position, comm);
|
||||
unpack(yPos, buffer, position, comm);
|
||||
unpack(samples, buffer, position, comm);
|
||||
unpack(interpolationGuide, buffer, position, comm);
|
||||
data = UniformXTabulated2DFunction<Scalar>(xPos, yPos, samples,
|
||||
interpolationGuide);
|
||||
}
|
||||
|
||||
template void unpack(UniformXTabulated2DFunction<double>& data,
|
||||
std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(SolventPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/material/common/IntervalTabulated2DFunction.hpp>
|
||||
#include <opm/material/common/UniformXTabulated2DFunction.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
@@ -154,6 +155,9 @@ std::size_t packSize(const Tabulated1DFunction<Scalar>& data, Dune::MPIHelper::M
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const IntervalTabulated2DFunction<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const UniformXTabulated2DFunction<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const SolventPvt<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
@@ -227,6 +231,10 @@ template<class Scalar>
|
||||
void pack(const IntervalTabulated2DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const UniformXTabulated2DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const SolventPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
@@ -305,6 +313,10 @@ template<class Scalar>
|
||||
void unpack(IntervalTabulated2DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(UniformXTabulated2DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(SolventPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
@@ -996,6 +996,21 @@ BOOST_AUTO_TEST_CASE(IntervalTabulatedTwoDFunction)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(UniformXTabulatedTwoDFunction)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
std::vector<double> xPos{1.0, 2.0};
|
||||
std::vector<double> yPos{3.0, 4.0};
|
||||
std::vector<std::vector<std::tuple<double,double,double>>> samples{{{1.0, 2.0, 3.0}}, {{4.0, 5.0, 6.0}}};
|
||||
using FFuncType = Opm::UniformXTabulated2DFunction<double>;
|
||||
FFuncType val1(xPos, yPos, samples, FFuncType::Vertical);
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SolventPvt)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
|
||||
Reference in New Issue
Block a user