mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for DryGasPvt
This commit is contained in:
parent
f2640197be
commit
a2ac61f592
@ -584,7 +584,17 @@ std::size_t packSize(const IntervalTabulated2DFunction<Scalar>& data,
|
||||
template std::size_t packSize(const IntervalTabulated2DFunction<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template std::size_t packSize(const std::map<int,IntervalTabulated2DFunction<double>>& data,
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const DryGasPvt<Scalar>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.gasReferenceDensity(), comm) +
|
||||
packSize(data.inverseGasB(), comm) +
|
||||
packSize(data.gasMu(), comm) +
|
||||
packSize(data.inverseGasBMu(), comm);
|
||||
}
|
||||
|
||||
template std::size_t packSize(const DryGasPvt<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
@ -1154,6 +1164,20 @@ template void pack(const SolventPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const DryGasPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.gasReferenceDensity(), buffer, position, comm);
|
||||
pack(data.inverseGasB(), buffer, position, comm);
|
||||
pack(data.gasMu(), buffer, position, comm);
|
||||
pack(data.inverseGasBMu(), buffer, position, comm);
|
||||
}
|
||||
|
||||
template void pack(const DryGasPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -1894,6 +1918,26 @@ template void unpack(SolventPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(DryGasPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<Scalar> gasReferenceDensity;
|
||||
std::vector<typename DryGasPvt<Scalar>::TabulatedOneDFunction> inverseGasB;
|
||||
std::vector<typename DryGasPvt<Scalar>::TabulatedOneDFunction> gasMu;
|
||||
std::vector<typename DryGasPvt<Scalar>::TabulatedOneDFunction> inverseGasBMu;
|
||||
unpack(gasReferenceDensity, buffer, position, comm);
|
||||
unpack(inverseGasB, buffer, position, comm);
|
||||
unpack(gasMu, buffer, position, comm);
|
||||
unpack(inverseGasBMu, buffer, position, comm);
|
||||
data = DryGasPvt<Scalar>(gasReferenceDensity, inverseGasB,
|
||||
gasMu, inverseGasBMu);
|
||||
}
|
||||
|
||||
template void unpack(DryGasPvt<double>& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
} // end namespace Mpi
|
||||
RestartValue loadParallelRestart(const EclipseIO* eclIO, SummaryState& summaryState,
|
||||
const std::vector<Opm::RestartKey>& solutionKeys,
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/material/common/IntervalTabulated2DFunction.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/output/eclipse/Summary.hpp>
|
||||
@ -152,6 +153,9 @@ std::size_t packSize(const IntervalTabulated2DFunction<Scalar>& data, Dune::MPIH
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const SolventPvt<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const DryGasPvt<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -219,6 +223,10 @@ template<class Scalar>
|
||||
void pack(const SolventPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const DryGasPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
void pack(const char* str, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
@ -289,6 +297,10 @@ template<class Scalar>
|
||||
void unpack(SolventPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(DryGasPvt<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <opm/simulators/utils/ParallelRestart.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/DryGasPvt.hpp>
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
@ -1008,6 +1009,19 @@ BOOST_AUTO_TEST_CASE(SolventPvt)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DryGasPvt)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Tabulated1DFunction<double> func(2, std::vector<double>{1.0, 2.0},
|
||||
std::vector<double>{3.0, 4.0});
|
||||
Opm::DryGasPvt<double> val1({1.0, 2.0}, {func}, {func}, {func});
|
||||
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