mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for SolventPvt
This commit is contained in:
parent
37d8f702c8
commit
6fde7dcb47
@ -557,6 +557,19 @@ std::size_t packSize(const Tabulated1DFunction<Scalar>& data,
|
|||||||
template std::size_t packSize(const Tabulated1DFunction<double>& data,
|
template std::size_t packSize(const Tabulated1DFunction<double>& data,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
std::size_t packSize(const SolventPvt<Scalar>& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.solventReferenceDensity(), comm) +
|
||||||
|
packSize(data.inverseSolventB(), comm) +
|
||||||
|
packSize(data.solventMu(), comm) +
|
||||||
|
packSize(data.inverseSolventBMu(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
|
template std::size_t packSize(const SolventPvt<double>& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -1095,6 +1108,20 @@ void pack(const Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
|||||||
template void pack(const Tabulated1DFunction<double>& data, std::vector<char>& buffer,
|
template void pack(const Tabulated1DFunction<double>& data, std::vector<char>& buffer,
|
||||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
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)
|
||||||
|
{
|
||||||
|
pack(data.solventReferenceDensity(), buffer, position, comm);
|
||||||
|
pack(data.inverseSolventB(), buffer, position, comm);
|
||||||
|
pack(data.solventMu(), buffer, position, comm);
|
||||||
|
pack(data.inverseSolventBMu(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
|
template void pack(const SolventPvt<double>& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -1795,6 +1822,26 @@ void unpack(Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
|||||||
template void unpack(Tabulated1DFunction<double>& data, std::vector<char>& buffer,
|
template void unpack(Tabulated1DFunction<double>& data, std::vector<char>& buffer,
|
||||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
void unpack(SolventPvt<Scalar>& data, std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
std::vector<Scalar> solventReferenceDensity;
|
||||||
|
std::vector<typename SolventPvt<Scalar>::TabulatedOneDFunction> inverseSolventB;
|
||||||
|
std::vector<typename SolventPvt<Scalar>::TabulatedOneDFunction> solventMu;
|
||||||
|
std::vector<typename SolventPvt<Scalar>::TabulatedOneDFunction> inverseSolventBMu;
|
||||||
|
unpack(solventReferenceDensity, buffer, position, comm);
|
||||||
|
unpack(inverseSolventB, buffer, position, comm);
|
||||||
|
unpack(solventMu, buffer, position, comm);
|
||||||
|
unpack(inverseSolventBMu, buffer, position, comm);
|
||||||
|
data = SolventPvt<Scalar>(solventReferenceDensity, inverseSolventB,
|
||||||
|
solventMu, inverseSolventBMu);
|
||||||
|
}
|
||||||
|
|
||||||
|
template void unpack(SolventPvt<double>& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
} // 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,
|
||||||
|
@ -145,6 +145,9 @@ std::size_t packSize(const DynamicState<T>& data, Dune::MPIHelper::MPICommunicat
|
|||||||
template<class Scalar>
|
template<class Scalar>
|
||||||
std::size_t packSize(const Tabulated1DFunction<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
std::size_t packSize(const Tabulated1DFunction<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
std::size_t packSize(const SolventPvt<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -204,6 +207,10 @@ template<class Scalar>
|
|||||||
void pack(const Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
void pack(const Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
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);
|
||||||
|
|
||||||
void pack(const char* str, std::vector<char>& buffer, int& position,
|
void pack(const char* str, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
@ -266,6 +273,10 @@ template<class Scalar>
|
|||||||
void unpack(Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
void unpack(Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
template<class Scalar>
|
||||||
|
void unpack(SolventPvt<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,
|
void unpack(char* str, std::size_t length, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
@ -981,6 +981,19 @@ BOOST_AUTO_TEST_CASE(TabulatedOneDFunction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(SolventPvt)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MPI
|
||||||
|
Opm::Tabulated1DFunction<double> func(2, std::vector<double>{1.0, 2.0},
|
||||||
|
std::vector<double>{3.0, 4.0});
|
||||||
|
Opm::SolventPvt<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()
|
bool init_unit_test_func()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user