mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for Tabulated1DFunction
This commit is contained in:
@@ -546,6 +546,17 @@ std::size_t packSize(const TableManager& data, Dune::MPIHelper::MPICommunicator
|
||||
packSize(data.rtemp(), comm);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const Tabulated1DFunction<Scalar>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.xValues(), comm) +
|
||||
packSize(data.yValues(), comm);
|
||||
}
|
||||
|
||||
template std::size_t packSize(const Tabulated1DFunction<double>& data,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -1073,6 +1084,17 @@ void pack(const TableManager& data, std::vector<char>& buffer, int& position,
|
||||
pack(data.rtemp(), buffer, position, comm);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.xValues(), buffer, position, comm);
|
||||
pack(data.yValues(), buffer, position, comm);
|
||||
}
|
||||
|
||||
template void pack(const Tabulated1DFunction<double>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@@ -1760,6 +1782,19 @@ void unpack(TableManager& data, std::vector<char>& buffer, int& position,
|
||||
aqudims, hasImptvd, hasEntpvd, hasEqlnum, jfunc, rtemp);
|
||||
}
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(Tabulated1DFunction<Scalar>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<Scalar> xValues, yValues;
|
||||
unpack(xValues, buffer, position, comm);
|
||||
unpack(yValues, buffer, position, comm);
|
||||
data = Tabulated1DFunction<Scalar>(xValues, yValues, false);
|
||||
}
|
||||
|
||||
template void unpack(Tabulated1DFunction<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,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <mpi.h>
|
||||
#endif
|
||||
|
||||
#include <opm/material/fluidsystems/blackoilpvt/SolventPvt.hpp>
|
||||
#include <opm/output/eclipse/RestartValue.hpp>
|
||||
#include <opm/output/eclipse/EclipseIO.hpp>
|
||||
#include <opm/output/eclipse/Summary.hpp>
|
||||
@@ -141,6 +142,9 @@ std::size_t packSize(const OrderedMap<Key,Value>& data, Dune::MPIHelper::MPIComm
|
||||
template<class T>
|
||||
std::size_t packSize(const DynamicState<T>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
std::size_t packSize(const Tabulated1DFunction<Scalar>& data, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@@ -196,6 +200,10 @@ template<class T>
|
||||
void pack(const DynamicState<T>& data, std::vector<char>& buffer,
|
||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void pack(const Tabulated1DFunction<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);
|
||||
|
||||
@@ -254,6 +262,10 @@ template<class T>
|
||||
void unpack(DynamicState<T>& data, std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm);
|
||||
|
||||
template<class Scalar>
|
||||
void unpack(Tabulated1DFunction<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/SolventPvt.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Edit/EDITNNC.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Grid/NNC.hpp>
|
||||
@@ -968,6 +969,18 @@ BOOST_AUTO_TEST_CASE(TableManager)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TabulatedOneDFunction)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Tabulated1DFunction<double> val1(2, std::vector<double>{1.0, 2.0},
|
||||
std::vector<double>{3.0, 4.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;
|
||||
|
||||
Reference in New Issue
Block a user