Add serialization for WellType

This commit is contained in:
Joakim Hove 2020-03-03 10:19:45 +01:00
parent 3f8e794234
commit 69871fdefd
3 changed files with 35 additions and 0 deletions

View File

@ -48,6 +48,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQASTNode.hpp>
@ -531,6 +532,12 @@ std::size_t packSize(const ThresholdPressure& data, Dune::MPIHelper::MPICommunic
packSize(data.pressureTable(), comm);
}
std::size_t packSize(const WellType& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.producer(), comm) +
packSize(data.preferred_phase(), comm);
}
std::size_t packSize(const DenT& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.records(), comm);
@ -2220,6 +2227,12 @@ void pack(const Aquifetp::AQUFETP_data& data, std::vector<char>& buffer, int& po
pack(data.p0, buffer, position, comm);
}
void pack(const WellType& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.producer(), buffer, position, comm);
pack(data.preferred_phase(), buffer, position, comm);
}
void pack(const DenT& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.records(), buffer, position, comm);
@ -4024,6 +4037,17 @@ void unpack(AquiferCT::AQUCT_data& data, std::vector<char>& buffer, int& positio
}
void unpack(WellType& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{
Phase preferred_phase;
bool producer;
unpack(producer, buffer, position, comm);
unpack(preferred_phase, buffer, position, comm);
data = WellType( producer, phase );
}
void unpack(DenT& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{
std::vector<DenT::entry> records;

View File

@ -611,6 +611,7 @@ ADD_PACK_PROTOTYPES(ViscrefTable)
ADD_PACK_PROTOTYPES(WATDENTRecord)
ADD_PACK_PROTOTYPES(WatdentTable)
ADD_PACK_PROTOTYPES(Well)
ADD_PACK_PROTOTYPES(WellType)
ADD_PACK_PROTOTYPES(Well::WellGuideRate)
ADD_PACK_PROTOTYPES(Well::WellInjectionProperties)
ADD_PACK_PROTOTYPES(Well::WellProductionProperties)

View File

@ -56,6 +56,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/OilVaporizationProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Tuning.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
@ -2296,6 +2297,15 @@ BOOST_AUTO_TEST_CASE(Fault)
#endif
}
BOOST_AUTO_TEST_CASE(WellType)
{
#ifdef HAVE_MPI
Opm::WellType val1(true, Phase::OIL);
auto val2 = PackUnpack(val1);
DO_CHECKS(WellType)
#endif
}
BOOST_AUTO_TEST_CASE(DenT)
{
#ifdef HAVE_MPI