add mpi serialization for Group::GroupInjectionProperties

This commit is contained in:
Arne Morten Kvarving 2019-12-11 13:32:28 +01:00
parent 2df5aaf876
commit c030545478
3 changed files with 66 additions and 2 deletions

View File

@ -1215,6 +1215,20 @@ std::size_t packSize(const IOrderSet<T>& data,
packSize(data.data(), comm);
}
std::size_t packSize(const Group::GroupInjectionProperties& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.phase, comm) +
packSize(data.cmode, comm) +
packSize(data.surface_max_rate, comm) +
packSize(data.resv_max_rate, comm) +
packSize(data.target_reinj_fraction, comm) +
packSize(data.target_void_fraction, comm) +
packSize(data.reinj_group, comm) +
packSize(data.voidage_group, comm) +
packSize(data.injection_controls, comm);
}
////// pack routines
template<class T>
@ -2443,6 +2457,21 @@ void pack(const IOrderSet<T>& data, std::vector<char>& buffer, int& position,
pack(data.data(), buffer, position, comm);
}
void pack(const Group::GroupInjectionProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.phase, buffer, position, comm);
pack(data.cmode, buffer, position, comm);
pack(data.surface_max_rate, buffer, position, comm);
pack(data.resv_max_rate, buffer, position, comm);
pack(data.target_reinj_fraction, buffer, position, comm);
pack(data.target_void_fraction, buffer, position, comm);
pack(data.reinj_group, buffer, position, comm);
pack(data.voidage_group, buffer, position, comm);
pack(data.injection_controls, buffer, position, comm);
}
/// unpack routines
template<class T>
@ -4180,6 +4209,21 @@ void unpack(IOrderSet<T>& data, std::vector<char>& buffer, int& position,
data = IOrderSet<T>(index, storage);
}
void unpack(Group::GroupInjectionProperties& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.phase, buffer, position, comm);
unpack(data.cmode, buffer, position, comm);
unpack(data.surface_max_rate, buffer, position, comm);
unpack(data.resv_max_rate, buffer, position, comm);
unpack(data.target_reinj_fraction, buffer, position, comm);
unpack(data.target_void_fraction, buffer, position, comm);
unpack(data.reinj_group, buffer, position, comm);
unpack(data.voidage_group, buffer, position, comm);
unpack(data.injection_controls, buffer, position, comm);
}
#define INSTANTIATE_PACK_VECTOR(T) \
template std::size_t packSize(const std::vector<T>& data, \
Dune::MPIHelper::MPICommunicator comm); \

View File

@ -41,6 +41,7 @@
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicVector.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTestConfig.hpp>
@ -569,15 +570,16 @@ ADD_PACK_PROTOTYPES(data::WellRates)
ADD_PACK_PROTOTYPES(DENSITYRecord)
ADD_PACK_PROTOTYPES(DensityTable)
ADD_PACK_PROTOTYPES(Dimension)
ADD_PACK_PROTOTYPES(EclHysterConfig)
ADD_PACK_PROTOTYPES(EDITNNC)
ADD_PACK_PROTOTYPES(EndpointScaling)
ADD_PACK_PROTOTYPES(Equil)
ADD_PACK_PROTOTYPES(Eqldims)
ADD_PACK_PROTOTYPES(EquilRecord)
ADD_PACK_PROTOTYPES(Events)
ADD_PACK_PROTOTYPES(FoamConfig)
ADD_PACK_PROTOTYPES(FoamData)
ADD_PACK_PROTOTYPES(EclHysterConfig)
ADD_PACK_PROTOTYPES(Eqldims)
ADD_PACK_PROTOTYPES(Group::GroupInjectionProperties)
ADD_PACK_PROTOTYPES(InitConfig)
ADD_PACK_PROTOTYPES(IOConfig)
ADD_PACK_PROTOTYPES(JFunc)

View File

@ -1581,6 +1581,24 @@ BOOST_AUTO_TEST_CASE(Well)
}
BOOST_AUTO_TEST_CASE(GroupInjectionProperties)
{
#ifdef HAVE_MPI
Opm::Group::GroupInjectionProperties val1{Opm::Phase::WATER,
Opm::Group::InjectionCMode::REIN,
Opm::UDAValue(1.0),
Opm::UDAValue(2.0),
Opm::UDAValue(3.0),
Opm::UDAValue(4.0),
"test1", "test2", 5};
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;