Simplify serialization of WellSegments

This commit is contained in:
Joakim Hove 2020-02-22 10:49:41 +01:00
parent 22d4e784d3
commit 87ddba6028
2 changed files with 3 additions and 10 deletions

View File

@ -1432,9 +1432,7 @@ std::size_t packSize(const WellSegments& data,
Dune::MPIHelper::MPICommunicator comm) Dune::MPIHelper::MPICommunicator comm)
{ {
return packSize(data.compPressureDrop(), comm) + return packSize(data.compPressureDrop(), comm) +
packSize(data.segments(), comm) + packSize(data.segments(), comm);
packSize(data.segmentNumberIndex(), comm);
} }
std::size_t packSize(const Well& data, std::size_t packSize(const Well& data,
@ -3259,7 +3257,6 @@ void pack(const WellSegments& data,
{ {
pack(data.compPressureDrop(), buffer, position, comm); pack(data.compPressureDrop(), buffer, position, comm);
pack(data.segments(), buffer, position, comm); pack(data.segments(), buffer, position, comm);
pack(data.segmentNumberIndex(), buffer, position, comm);
} }
void pack(const Well& data, void pack(const Well& data,
@ -5726,14 +5723,11 @@ void unpack(WellSegments& data,
{ {
WellSegments::CompPressureDrop compPressureDrop; WellSegments::CompPressureDrop compPressureDrop;
std::vector<Segment> segments; std::vector<Segment> segments;
std::map<int,int> segmentNumberIndex;
unpack(compPressureDrop, buffer, position, comm); unpack(compPressureDrop, buffer, position, comm);
unpack(segments, buffer, position, comm); unpack(segments, buffer, position, comm);
unpack(segmentNumberIndex, buffer, position, comm);
data = WellSegments(compPressureDrop, data = WellSegments(compPressureDrop, segments);
segments, segmentNumberIndex);
} }
void unpack(Well& data, void unpack(Well& data,

View File

@ -1712,8 +1712,7 @@ BOOST_AUTO_TEST_CASE(WellSegments)
std::make_shared<Opm::SpiralICD>(), std::make_shared<Opm::SpiralICD>(),
std::make_shared<Opm::Valve>()); std::make_shared<Opm::Valve>());
Opm::WellSegments val1(Opm::WellSegments::CompPressureDrop::HF_, Opm::WellSegments val1(Opm::WellSegments::CompPressureDrop::HF_,
{seg, seg}, {seg, seg});
{{1,2},{3,4}});
auto val2 = PackUnpack(val1); auto val2 = PackUnpack(val1);
DO_CHECKS(WellSegments) DO_CHECKS(WellSegments)