add mpi serialization for MULTREGTRecord

This commit is contained in:
Arne Morten Kvarving 2020-01-14 12:29:23 +01:00
parent 02ce13c800
commit 252f323fb6
3 changed files with 48 additions and 0 deletions

View File

@ -1952,6 +1952,17 @@ std::size_t packSize(const GuideRateConfig::GroupTarget& data,
packSize(data.target, comm); packSize(data.target, comm);
} }
std::size_t packSize(const MULTREGTRecord& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.src_value, comm) +
packSize(data.target_value, comm) +
packSize(data.trans_mult, comm) +
packSize(data.directions, comm) +
packSize(data.nnc_behaviour, comm) +
packSize(data.region_name, comm);
}
////// pack routines ////// pack routines
template<class T> template<class T>
@ -3807,6 +3818,18 @@ void pack(const GuideRateConfig::GroupTarget& data,
pack(data.target, buffer, position, comm); pack(data.target, buffer, position, comm);
} }
void pack(const MULTREGTRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.src_value, buffer, position, comm);
pack(data.target_value, buffer, position, comm);
pack(data.trans_mult, buffer, position, comm);
pack(data.directions, buffer, position, comm);
pack(data.nnc_behaviour, buffer, position, comm);
pack(data.region_name, buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@ -6460,6 +6483,18 @@ void unpack(GuideRateConfig::GroupTarget& data,
unpack(data.target, buffer, position, comm); unpack(data.target, buffer, position, comm);
} }
void unpack(MULTREGTRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.src_value, buffer, position, comm);
unpack(data.target_value, buffer, position, comm);
unpack(data.trans_mult, buffer, position, comm);
unpack(data.directions, buffer, position, comm);
unpack(data.nnc_behaviour, buffer, position, comm);
unpack(data.region_name, buffer, position, comm);
}
#define INSTANTIATE_PACK_VECTOR(...) \ #define INSTANTIATE_PACK_VECTOR(...) \
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \ template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
Dune::MPIHelper::MPICommunicator comm); \ Dune::MPIHelper::MPICommunicator comm); \

View File

@ -99,6 +99,7 @@ class JFunc;
class Location; class Location;
class MessageLimits; class MessageLimits;
class MLimits; class MLimits;
class MULTREGTRecord;
class NNC; class NNC;
struct NNCdata; struct NNCdata;
class OilVaporizationProperties; class OilVaporizationProperties;
@ -679,6 +680,7 @@ ADD_PACK_PROTOTYPES(JFunc)
ADD_PACK_PROTOTYPES(Location) ADD_PACK_PROTOTYPES(Location)
ADD_PACK_PROTOTYPES(MessageLimits) ADD_PACK_PROTOTYPES(MessageLimits)
ADD_PACK_PROTOTYPES(MLimits) ADD_PACK_PROTOTYPES(MLimits)
ADD_PACK_PROTOTYPES(MULTREGTRecord)
ADD_PACK_PROTOTYPES(NNC) ADD_PACK_PROTOTYPES(NNC)
ADD_PACK_PROTOTYPES(NNCdata) ADD_PACK_PROTOTYPES(NNCdata)
ADD_PACK_PROTOTYPES(OilVaporizationProperties) ADD_PACK_PROTOTYPES(OilVaporizationProperties)

View File

@ -2415,6 +2415,17 @@ BOOST_AUTO_TEST_CASE(WellBrineProperties)
} }
BOOST_AUTO_TEST_CASE(MULTREGTRecord)
{
#ifdef HAVE_MPI
Opm::MULTREGTRecord val1{1, 2, 3.0, 4, Opm::MULTREGT::ALL, "test"};
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;