Merge pull request #2468 from akva2/serialize_internal_eclstate_part3

Internal serialization in EclipseState - part 3
This commit is contained in:
Arne Morten Kvarving 2020-03-16 14:21:50 +01:00 committed by GitHub
commit d3115c7afd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 291 deletions

View File

@ -23,12 +23,7 @@
#include "ParallelRestart.hpp"
#include <opm/common/OpmLog/Location.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/Equil.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/FoamConfig.hpp>
#include <opm/parser/eclipse/EclipseState/InitConfig/InitConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/IOConfig.hpp>
#include <opm/parser/eclipse/EclipseState/IOConfig/RestartConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/ActionAST.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Action/Actions.hpp>
@ -541,29 +536,6 @@ std::size_t packSize(const TableContainer& data, Dune::MPIHelper::MPICommunicato
return res;
}
std::size_t packSize(const Equil& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.records(), comm);
}
std::size_t packSize(const FoamConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.records(), comm) +
packSize(data.getTransportPhase(), comm) +
packSize(data.getMobilityModel(), comm);
}
std::size_t packSize(const InitConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getEquil(), comm) +
packSize(data.getFoamConfig(), comm) +
packSize(data.filleps(), comm) +
packSize(data.hasGravity(), comm) +
packSize(data.restartRequested(), comm) +
packSize(data.getRestartStep(), comm) +
packSize(data.getRestartRootName(), comm);
}
std::size_t packSize(const TimeMap& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.timeList(), comm);
@ -579,22 +551,6 @@ std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator
packSize(data.saveKeywords(), comm);
}
std::size_t packSize(const IOConfig& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getWriteINITFile(), comm) +
packSize(data.getWriteEGRIDFile(), comm) +
packSize(data.getUNIFIN(), comm) +
packSize(data.getUNIFOUT(), comm) +
packSize(data.getFMTIN(), comm) +
packSize(data.getFMTOUT(), comm) +
packSize(data.getDeckFileName(), comm) +
packSize(data.getOutputEnabled(), comm) +
packSize(data.getOutputDir(), comm) +
packSize(data.getNoSim(), comm) +
packSize(data.getBaseName(), comm) +
packSize(data.getEclCompatibleRST(), comm);
}
std::size_t packSize(const Phases& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.getBits(), comm);
@ -1447,30 +1403,6 @@ std::size_t packSize(const PvtwsaltTable& data,
packSize(data.getTableValues(), comm);
}
std::size_t packSize(const EquilRecord& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.datumDepth(), comm) +
packSize(data.datumDepthPressure(), comm) +
packSize(data.waterOilContactDepth(), comm) +
packSize(data.waterOilContactCapillaryPressure(), comm) +
packSize(data.gasOilContactDepth(), comm) +
packSize(data.gasOilContactCapillaryPressure(), comm) +
packSize(data.liveOilInitConstantRs(), comm) +
packSize(data.wetGasInitConstantRv(), comm) +
packSize(data.initializationTargetAccuracy(), comm);
}
std::size_t packSize(const FoamData& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.referenceSurfactantConcentration(), comm) +
packSize(data.exponent(), comm) +
packSize(data.minimumSurfactantConcentration(), comm) +
packSize(data.allowDesorption(), comm) +
packSize(data.rockDensity(), comm);
}
std::size_t packSize(const RestartSchedule& data,
Dune::MPIHelper::MPICommunicator comm)
{
@ -1544,13 +1476,6 @@ std::size_t packSize(const GuideRateConfig::GroupTarget& data,
packSize(data.target, comm);
}
std::size_t packSize(const EclipseConfig& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.init(), comm) +
packSize(data.io(), comm);
}
std::size_t packSize(const SolventDensityTable& data,
Dune::MPIHelper::MPICommunicator comm)
{
@ -2001,32 +1926,6 @@ void pack(const TableContainer& data, std::vector<char>& buffer, int& position,
}
}
void pack(const Equil& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.records(), buffer, position, comm);
}
void pack(const FoamConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.records(), buffer, position, comm);
pack(data.getTransportPhase(), buffer, position, comm);
pack(data.getMobilityModel(), buffer, position, comm);
}
void pack(const InitConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getEquil(), buffer, position, comm);
pack(data.getFoamConfig(), buffer, position, comm);
pack(data.filleps(), buffer, position, comm);
pack(data.hasGravity(), buffer, position, comm);
pack(data.restartRequested(), buffer, position, comm);
pack(data.getRestartStep(), buffer, position, comm);
pack(data.getRestartRootName(), buffer, position, comm);
}
void pack(const TimeMap& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@ -2044,23 +1943,6 @@ void pack(const RestartConfig& data, std::vector<char>& buffer, int& position,
pack(data.saveKeywords(), buffer, position, comm);
}
void pack(const IOConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.getWriteINITFile(), buffer, position, comm);
pack(data.getWriteEGRIDFile(), buffer, position, comm);
pack(data.getUNIFIN(), buffer, position, comm);
pack(data.getUNIFOUT(), buffer, position, comm);
pack(data.getFMTIN(), buffer, position, comm);
pack(data.getFMTOUT(), buffer, position, comm);
pack(data.getDeckFileName(), buffer, position, comm);
pack(data.getOutputEnabled(), buffer, position, comm);
pack(data.getOutputDir(), buffer, position, comm);
pack(data.getNoSim(), buffer, position, comm);
pack(data.getBaseName(), buffer, position, comm);
pack(data.getEclCompatibleRST(), buffer, position, comm);
}
void pack(const Phases& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@ -2936,32 +2818,6 @@ void pack(const PvtwsaltTable& data,
pack(data.getTableValues(), buffer, position, comm);
}
void pack(const EquilRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.datumDepth(), buffer, position, comm);
pack(data.datumDepthPressure(), buffer, position, comm);
pack(data.waterOilContactDepth(), buffer, position, comm);
pack(data.waterOilContactCapillaryPressure(), buffer, position, comm);
pack(data.gasOilContactDepth(), buffer, position, comm);
pack(data.gasOilContactCapillaryPressure(), buffer, position, comm);
pack(data.liveOilInitConstantRs(), buffer, position, comm);
pack(data.wetGasInitConstantRv(), buffer, position, comm);
pack(data.initializationTargetAccuracy(), buffer, position, comm);
}
void pack(const FoamData& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.referenceSurfactantConcentration(), buffer, position, comm);
pack(data.exponent(), buffer, position, comm);
pack(data.minimumSurfactantConcentration(), buffer, position, comm);
pack(data.allowDesorption(), buffer, position, comm);
pack(data.rockDensity(), buffer, position, comm);
}
void pack(const RestartSchedule& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
@ -3043,14 +2899,6 @@ void pack(const GuideRateConfig::GroupTarget& data,
pack(data.target, buffer, position, comm);
}
void pack(const EclipseConfig& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.init(), buffer, position, comm);
pack(data.io(), buffer, position, comm);
}
void pack(const SolventDensityTable& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
@ -3607,45 +3455,6 @@ void unpack(TableContainer& data, std::vector<char>& buffer, int& position,
}
}
void unpack(Equil& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<EquilRecord> records;
unpack(records, buffer, position, comm);
data = Equil(records);
}
void unpack(FoamConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<FoamData> records;
Phase transport_phase;
FoamConfig::MobilityModel mobility_model;
unpack(records, buffer, position, comm);
unpack(transport_phase, buffer, position, comm);
unpack(mobility_model, buffer, position, comm);
data = FoamConfig(records, transport_phase, mobility_model);
}
void unpack(InitConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
Equil equil;
FoamConfig foam;
bool filleps, hasGravity, restartRequested;
int restartStep;
std::string restartRootName;
unpack(equil, buffer, position, comm);
unpack(foam, buffer, position, comm);
unpack(filleps, buffer, position, comm);
unpack(hasGravity, buffer, position, comm);
unpack(restartRequested, buffer, position, comm);
unpack(restartStep, buffer, position, comm);
unpack(restartRootName, buffer, position, comm);
data = InitConfig(equil, foam, filleps, hasGravity,
restartRequested, restartStep, restartRootName);
}
void unpack(TimeMap& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@ -3674,30 +3483,6 @@ void unpack(RestartConfig& data, std::vector<char>& buffer, int& position,
restart_keyw, save_keyw);
}
void unpack(IOConfig& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
bool write_init, write_egrid, unifin, unifout, fmtin, fmtout;
std::string deck_name, output_dir, base_name;
bool output_enabled, no_sim, ecl_compatible_rst;
unpack(write_init, buffer, position, comm);
unpack(write_egrid, buffer, position, comm);
unpack(unifin, buffer, position, comm);
unpack(unifout, buffer, position, comm);
unpack(fmtin, buffer, position, comm);
unpack(fmtout, buffer, position, comm);
unpack(deck_name, buffer, position, comm);
unpack(output_enabled, buffer, position, comm);
unpack(output_dir, buffer, position, comm);
unpack(no_sim, buffer, position, comm);
unpack(base_name, buffer, position, comm);
unpack(ecl_compatible_rst, buffer, position, comm);
data = IOConfig(write_init, write_egrid, unifin, unifout, fmtin, fmtout,
deck_name, output_enabled, output_dir,
no_sim, base_name, ecl_compatible_rst);
}
void unpack(Phases& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
@ -5022,49 +4807,6 @@ void unpack(PvtwsaltTable& data, std::vector<char>& buffer, int& position,
data = PvtwsaltTable(refPressValue, refSaltConValue, tableValues);
}
void unpack(EquilRecord& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
double datumDepth, datumDepthPressure, waterOilContactDepth;
double waterOilContactCapillaryPressure, gasOilContactDepth;
double gasOilContactCapillaryPressure;
bool liveOilInitConstantRs, wetGasInitConstantRv;
int initializationTargetAccuracy;
unpack(datumDepth, buffer, position, comm);
unpack(datumDepthPressure, buffer, position, comm);
unpack(waterOilContactDepth, buffer, position, comm);
unpack(waterOilContactCapillaryPressure, buffer, position, comm);
unpack(gasOilContactDepth, buffer, position, comm);
unpack(gasOilContactCapillaryPressure, buffer, position, comm);
unpack(liveOilInitConstantRs, buffer, position, comm);
unpack(wetGasInitConstantRv, buffer, position, comm);
unpack(initializationTargetAccuracy, buffer, position, comm);
data = EquilRecord(datumDepth, datumDepthPressure, waterOilContactDepth,
waterOilContactCapillaryPressure, gasOilContactDepth,
gasOilContactCapillaryPressure, liveOilInitConstantRs,
wetGasInitConstantRv, initializationTargetAccuracy);
}
void unpack(FoamData& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
double referenceSurfactantConcentration, exponent;
double minimumSurfactantConcentration;
bool allowDesorption;
double rockDensity;
unpack(referenceSurfactantConcentration, buffer, position, comm);
unpack(exponent, buffer, position, comm);
unpack(minimumSurfactantConcentration, buffer, position, comm);
unpack(allowDesorption, buffer, position, comm);
unpack(rockDensity, buffer, position, comm);
data = FoamData(referenceSurfactantConcentration, exponent,
minimumSurfactantConcentration, allowDesorption, rockDensity);
}
void unpack(RestartSchedule& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
@ -5162,18 +4904,6 @@ void unpack(GuideRateConfig::GroupTarget& data,
unpack(data.target, buffer, position, comm);
}
void unpack(EclipseConfig& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
InitConfig init;
IOConfig io;
unpack(init, buffer, position, comm);
unpack(io, buffer, position, comm);
data = EclipseConfig(init, io);
}
void unpack(SolventDensityTable& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{

View File

@ -76,16 +76,9 @@ class DENSITYRecord;
class DensityTable;
class Dimension;
class EclHysterConfig;
class EclipseConfig;
class Eqldims;
class EndpointScaling;
class Equil;
class EquilRecord;
class Events;
class FoamConfig;
class FoamData;
class InitConfig;
class IOConfig;
template<class T> class IOrderSet;
class JFunc;
class Location;
@ -517,14 +510,9 @@ ADD_PACK_PROTOTYPES(DenT)
ADD_PACK_PROTOTYPES(DenT::entry)
ADD_PACK_PROTOTYPES(Dimension)
ADD_PACK_PROTOTYPES(EclHysterConfig)
ADD_PACK_PROTOTYPES(EclipseConfig)
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(GConSale)
ADD_PACK_PROTOTYPES(GConSale::GCONSALEGroup)
ADD_PACK_PROTOTYPES(GConSump)
@ -536,8 +524,6 @@ ADD_PACK_PROTOTYPES(GuideRateModel)
ADD_PACK_PROTOTYPES(Group)
ADD_PACK_PROTOTYPES(Group::GroupInjectionProperties)
ADD_PACK_PROTOTYPES(Group::GroupProductionProperties)
ADD_PACK_PROTOTYPES(InitConfig)
ADD_PACK_PROTOTYPES(IOConfig)
ADD_PACK_PROTOTYPES(JFunc)
ADD_PACK_PROTOTYPES(Location)
ADD_PACK_PROTOTYPES(MessageLimits)

View File

@ -793,7 +793,7 @@ BOOST_AUTO_TEST_CASE(EquilRecord)
{
#if HAVE_MPI
Opm::EquilRecord val1 = getEquilRecord();
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(EquilRecord)
#endif
}
@ -803,7 +803,7 @@ BOOST_AUTO_TEST_CASE(Equil)
{
#if HAVE_MPI
Opm::Equil val1({getEquilRecord(), getEquilRecord()});
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(Equil)
#endif
}
@ -813,7 +813,7 @@ BOOST_AUTO_TEST_CASE(FoamData)
{
#if HAVE_MPI
Opm::FoamData val1 = getFoamData();
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(FoamData)
#endif
}
@ -823,7 +823,7 @@ BOOST_AUTO_TEST_CASE(FoamConfig)
{
#if HAVE_MPI
Opm::FoamConfig val1 = getFoamConfig();
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(FoamConfig)
#endif
}
@ -835,7 +835,7 @@ BOOST_AUTO_TEST_CASE(InitConfig)
Opm::InitConfig val1(Opm::Equil({getEquilRecord(), getEquilRecord()}),
getFoamConfig(),
true, true, true, 20, "test1");
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(InitConfig)
#endif
}
@ -901,7 +901,7 @@ BOOST_AUTO_TEST_CASE(IOConfig)
#if HAVE_MPI
Opm::IOConfig val1(true, false, true, false, false, true, "test1", true,
"test2", true, "test3", false);
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(IOConfig)
#endif
}
@ -2267,7 +2267,7 @@ BOOST_AUTO_TEST_CASE(EclipseConfig)
true, true, true, 20, "test1");
Opm::EclipseConfig val1{init, io};
auto val2 = PackUnpack(val1);
auto val2 = PackUnpack2(val1);
DO_CHECKS(EclipseConfig)
#endif
}