Add serialization for AquiferConfig

This commit is contained in:
Joakim Hove 2020-02-18 16:01:54 +01:00
parent ff3c634924
commit 86972dc494
3 changed files with 40 additions and 0 deletions

View File

@ -562,6 +562,13 @@ std::size_t packSize(const AquiferCT& data, Dune::MPIHelper::MPICommunicator com
return packSize(data.data(), comm);
}
std::size_t packSize(const AquiferConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.fetp(), comm) +
packSize(data.ct(), comm) +
packSize(data.connections(), comm);
}
std::size_t packSize(const Aquancon::AquancCell& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.aquiferID, comm) +
@ -2354,6 +2361,13 @@ void pack(const Aquifetp& data, std::vector<char>& buffer, int& position,
pack(data.data(), buffer, position, comm);
}
void pack(const AquiferConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.fetp(), buffer, position, comm);
pack(data.ct(), buffer, position, comm);
pack(data.connections(), buffer, position, comm);
}
void pack(const Aquancon::AquancCell& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm) {
pack(data.aquiferID, buffer, position, comm);
@ -4370,6 +4384,17 @@ void unpack(Aquancon::AquancCell& data, std::vector<char>& buffer, int& position
}
void unpack(AquiferConfig& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm) {
Aquifetp fetp;
AquiferCT ct;
Aquancon conn;
unpack(fetp, buffer, position, comm);
unpack(ct, buffer, position, comm);
unpack(conn, buffer, position, comm);
data = AquiferConfig(fetp, ct, conn);
}
void unpack(Aquancon& data, std::vector<char>& buffer, int& position, Dune::MPIHelper::MPICommunicator comm)
{

View File

@ -40,6 +40,7 @@
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Aquancon.hpp>
#include <opm/parser/eclipse/EclipseState/AquiferCT.hpp>
#include <opm/parser/eclipse/EclipseState/Aquifetp.hpp>
@ -672,6 +673,7 @@ ADD_PACK_PROTOTYPES(Action::ASTNode)
ADD_PACK_PROTOTYPES(Action::Condition)
ADD_PACK_PROTOTYPES(Action::Quantity)
ADD_PACK_PROTOTYPES(Aqudims)
ADD_PACK_PROTOTYPES(AquiferConfig)
ADD_PACK_PROTOTYPES(Aquancon)
ADD_PACK_PROTOTYPES(Aquancon::AquancCell)
ADD_PACK_PROTOTYPES(AquiferCT)

View File

@ -1925,6 +1925,19 @@ BOOST_AUTO_TEST_CASE(Aquancon)
#endif
}
BOOST_AUTO_TEST_CASE(AquferConfig)
{
#ifdef HAVE_MPI
Opm::Aquifetp fetp = getAquifetp();
Opm::AquiferCT ct = getAquiferCT();
Opm::Aquancon conn = getAquancon();
Opm::AquiferConfig val1(fetp, ct, conn);
auto val2 = PackUnpack(val1);
DO_CHECKS(AquiferConfig);
#endif
}
BOOST_AUTO_TEST_CASE(GuideRateModel)