mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
add mpi serialization for Dimension
This commit is contained in:
parent
781625ec63
commit
e53072faf5
@ -1126,6 +1126,14 @@ std::size_t packSize(const std::shared_ptr<T>& data,
|
|||||||
template std::size_t packSize(const std::shared_ptr<SpiralICD>& data,
|
template std::size_t packSize(const std::shared_ptr<SpiralICD>& data,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
std::size_t packSize(const Dimension& data,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
return packSize(data.getName(), comm) +
|
||||||
|
packSize(data.getSIScalingRaw(), comm) +
|
||||||
|
packSize(data.getSIOffset(), comm);
|
||||||
|
}
|
||||||
|
|
||||||
////// pack routines
|
////// pack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -2264,6 +2272,15 @@ void pack(const std::shared_ptr<T>& data, std::vector<char>& buffer, int& positi
|
|||||||
template void pack(const std::shared_ptr<SpiralICD>& data, std::vector<char>& buffer,
|
template void pack(const std::shared_ptr<SpiralICD>& data, std::vector<char>& buffer,
|
||||||
int& position, Dune::MPIHelper::MPICommunicator comm);
|
int& position, Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
void pack(const Dimension& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
pack(data.getName(), buffer, position, comm);
|
||||||
|
pack(data.getSIScalingRaw(), buffer, position, comm);
|
||||||
|
pack(data.getSIOffset(), buffer, position, comm);
|
||||||
|
}
|
||||||
|
|
||||||
/// unpack routines
|
/// unpack routines
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@ -3851,6 +3868,19 @@ template void unpack(std::shared_ptr<SpiralICD>& data,
|
|||||||
std::vector<char>& buffer, int& position,
|
std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm);
|
Dune::MPIHelper::MPICommunicator comm);
|
||||||
|
|
||||||
|
void unpack(Dimension& data,
|
||||||
|
std::vector<char>& buffer, int& position,
|
||||||
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
double siScaling, siOffset;
|
||||||
|
|
||||||
|
unpack(name, buffer, position, comm);
|
||||||
|
unpack(siScaling, buffer, position, comm);
|
||||||
|
unpack(siOffset, buffer, position, comm);
|
||||||
|
data = Dimension(name, siScaling, siOffset);
|
||||||
|
}
|
||||||
|
|
||||||
#define INSTANTIATE_PACK_VECTOR(T) \
|
#define INSTANTIATE_PACK_VECTOR(T) \
|
||||||
template std::size_t packSize(const std::vector<T>& data, \
|
template std::size_t packSize(const std::vector<T>& data, \
|
||||||
Dune::MPIHelper::MPICommunicator comm); \
|
Dune::MPIHelper::MPICommunicator comm); \
|
||||||
|
@ -62,6 +62,7 @@ class ColumnSchema;
|
|||||||
class Connection;
|
class Connection;
|
||||||
class DENSITYRecord;
|
class DENSITYRecord;
|
||||||
class DensityTable;
|
class DensityTable;
|
||||||
|
class Dimension;
|
||||||
class EclHysterConfig;
|
class EclHysterConfig;
|
||||||
class Eqldims;
|
class Eqldims;
|
||||||
class EDITNNC;
|
class EDITNNC;
|
||||||
@ -539,6 +540,7 @@ ADD_PACK_PROTOTYPES(data::Well)
|
|||||||
ADD_PACK_PROTOTYPES(data::WellRates)
|
ADD_PACK_PROTOTYPES(data::WellRates)
|
||||||
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
ADD_PACK_PROTOTYPES(DENSITYRecord)
|
||||||
ADD_PACK_PROTOTYPES(DensityTable)
|
ADD_PACK_PROTOTYPES(DensityTable)
|
||||||
|
ADD_PACK_PROTOTYPES(Dimension)
|
||||||
ADD_PACK_PROTOTYPES(EDITNNC)
|
ADD_PACK_PROTOTYPES(EDITNNC)
|
||||||
ADD_PACK_PROTOTYPES(EndpointScaling)
|
ADD_PACK_PROTOTYPES(EndpointScaling)
|
||||||
ADD_PACK_PROTOTYPES(Equil)
|
ADD_PACK_PROTOTYPES(Equil)
|
||||||
|
@ -1507,6 +1507,17 @@ BOOST_AUTO_TEST_CASE(Segment)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(Dimension)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MPI
|
||||||
|
Opm::Dimension val1("test", 1.0, 2.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()
|
bool init_unit_test_func()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user