add mpi serialization for Group::GroupProductionProperties

This commit is contained in:
Arne Morten Kvarving
2019-12-11 13:33:02 +01:00
parent c030545478
commit dcdba24f53
3 changed files with 67 additions and 0 deletions

View File

@@ -1229,6 +1229,21 @@ std::size_t packSize(const Group::GroupInjectionProperties& data,
packSize(data.injection_controls, comm); packSize(data.injection_controls, comm);
} }
std::size_t packSize(const Group::GroupProductionProperties& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.cmode, comm) +
packSize(data.exceed_action, comm) +
packSize(data.oil_target, comm) +
packSize(data.water_target, comm) +
packSize(data.gas_target, comm) +
packSize(data.liquid_target, comm) +
packSize(data.guide_rate, comm) +
packSize(data.guide_rate_def, comm) +
packSize(data.resv_target, comm) +
packSize(data.production_controls, comm);
}
////// pack routines ////// pack routines
template<class T> template<class T>
@@ -2472,6 +2487,22 @@ void pack(const Group::GroupInjectionProperties& data,
pack(data.injection_controls, buffer, position, comm); pack(data.injection_controls, buffer, position, comm);
} }
void pack(const Group::GroupProductionProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.cmode, buffer, position, comm);
pack(data.exceed_action, buffer, position, comm);
pack(data.oil_target, buffer, position, comm);
pack(data.water_target, buffer, position, comm);
pack(data.gas_target, buffer, position, comm);
pack(data.liquid_target, buffer, position, comm);
pack(data.guide_rate, buffer, position, comm);
pack(data.guide_rate_def, buffer, position, comm);
pack(data.resv_target, buffer, position, comm);
pack(data.production_controls, buffer, position, comm);
}
/// unpack routines /// unpack routines
template<class T> template<class T>
@@ -4224,6 +4255,22 @@ void unpack(Group::GroupInjectionProperties& data,
unpack(data.injection_controls, buffer, position, comm); unpack(data.injection_controls, buffer, position, comm);
} }
void unpack(Group::GroupProductionProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.cmode, buffer, position, comm);
unpack(data.exceed_action, buffer, position, comm);
unpack(data.oil_target, buffer, position, comm);
unpack(data.water_target, buffer, position, comm);
unpack(data.gas_target, buffer, position, comm);
unpack(data.liquid_target, buffer, position, comm);
unpack(data.guide_rate, buffer, position, comm);
unpack(data.guide_rate_def, buffer, position, comm);
unpack(data.resv_target, buffer, position, comm);
unpack(data.production_controls, buffer, position, comm);
}
#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); \

View File

@@ -580,6 +580,7 @@ ADD_PACK_PROTOTYPES(Events)
ADD_PACK_PROTOTYPES(FoamConfig) ADD_PACK_PROTOTYPES(FoamConfig)
ADD_PACK_PROTOTYPES(FoamData) ADD_PACK_PROTOTYPES(FoamData)
ADD_PACK_PROTOTYPES(Group::GroupInjectionProperties) ADD_PACK_PROTOTYPES(Group::GroupInjectionProperties)
ADD_PACK_PROTOTYPES(Group::GroupProductionProperties)
ADD_PACK_PROTOTYPES(InitConfig) ADD_PACK_PROTOTYPES(InitConfig)
ADD_PACK_PROTOTYPES(IOConfig) ADD_PACK_PROTOTYPES(IOConfig)
ADD_PACK_PROTOTYPES(JFunc) ADD_PACK_PROTOTYPES(JFunc)

View File

@@ -1599,6 +1599,25 @@ BOOST_AUTO_TEST_CASE(GroupInjectionProperties)
} }
BOOST_AUTO_TEST_CASE(GroupProductionProperties)
{
#ifdef HAVE_MPI
Opm::Group::GroupProductionProperties val1{Opm::Group::ProductionCMode::PRBL,
Opm::Group::ExceedAction::WELL,
Opm::UDAValue(1.0),
Opm::UDAValue(2.0),
Opm::UDAValue(3.0),
Opm::UDAValue(4.0),
5.0, Opm::Group::GuideRateTarget::COMB,
6.0, 7};
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;