mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #2293 from akva2/noecl_flush_prestate
More serialization support
This commit is contained in:
commit
753282c0c2
@ -1952,6 +1952,65 @@ std::size_t packSize(const GuideRateConfig::GroupTarget& data,
|
||||
packSize(data.target, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const MULTREGTRecord& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.src_value, comm) +
|
||||
packSize(data.target_value, comm) +
|
||||
packSize(data.trans_mult, comm) +
|
||||
packSize(data.directions, comm) +
|
||||
packSize(data.nnc_behaviour, comm) +
|
||||
packSize(data.region_name, comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const MULTREGTScanner& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getSize(), comm) +
|
||||
packSize(data.getRecords(), comm) +
|
||||
packSize(data.getSearchMap(), comm) +
|
||||
packSize(data.getRegions(), comm) +
|
||||
packSize(data.getDefaultRegion(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const EclipseConfig& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.init(), comm) +
|
||||
packSize(data.io(), comm) +
|
||||
packSize(data.restart(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const TransMult& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getSize(), comm) +
|
||||
packSize(data.getTrans(), comm) +
|
||||
packSize(data.getNames(), comm) +
|
||||
packSize(data.getScanner(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const FaultFace& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getIndices(), comm) +
|
||||
packSize(data.getDir(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const Fault& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getName(), comm) +
|
||||
packSize(data.getTransMult(), comm) +
|
||||
packSize(data.getFaceList(), comm);
|
||||
}
|
||||
|
||||
std::size_t packSize(const FaultCollection& data,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
return packSize(data.getFaults(), comm);
|
||||
}
|
||||
|
||||
////// pack routines
|
||||
|
||||
template<class T>
|
||||
@ -3807,6 +3866,72 @@ void pack(const GuideRateConfig::GroupTarget& data,
|
||||
pack(data.target, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const MULTREGTRecord& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.src_value, buffer, position, comm);
|
||||
pack(data.target_value, buffer, position, comm);
|
||||
pack(data.trans_mult, buffer, position, comm);
|
||||
pack(data.directions, buffer, position, comm);
|
||||
pack(data.nnc_behaviour, buffer, position, comm);
|
||||
pack(data.region_name, buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const MULTREGTScanner& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getSize(), buffer, position, comm);
|
||||
pack(data.getRecords(), buffer, position, comm);
|
||||
pack(data.getSearchMap(), buffer, position, comm);
|
||||
pack(data.getRegions(), buffer, position, comm);
|
||||
pack(data.getDefaultRegion(), 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);
|
||||
pack(data.restart(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const TransMult& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getSize(), buffer, position, comm);
|
||||
pack(data.getTrans(), buffer, position, comm);
|
||||
pack(data.getNames(), buffer, position, comm);
|
||||
pack(data.getScanner(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const FaultFace& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getIndices(), buffer, position, comm);
|
||||
pack(data.getDir(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const Fault& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getName(), buffer, position, comm);
|
||||
pack(data.getTransMult(), buffer, position, comm);
|
||||
pack(data.getFaceList(), buffer, position, comm);
|
||||
}
|
||||
|
||||
void pack(const FaultCollection& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
pack(data.getFaults(), buffer, position, comm);
|
||||
}
|
||||
|
||||
/// unpack routines
|
||||
|
||||
template<class T>
|
||||
@ -6460,6 +6585,103 @@ void unpack(GuideRateConfig::GroupTarget& data,
|
||||
unpack(data.target, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(MULTREGTRecord& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
unpack(data.src_value, buffer, position, comm);
|
||||
unpack(data.target_value, buffer, position, comm);
|
||||
unpack(data.trans_mult, buffer, position, comm);
|
||||
unpack(data.directions, buffer, position, comm);
|
||||
unpack(data.nnc_behaviour, buffer, position, comm);
|
||||
unpack(data.region_name, buffer, position, comm);
|
||||
}
|
||||
|
||||
void unpack(MULTREGTScanner& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::array<size_t, 3> size;
|
||||
std::vector<MULTREGTRecord> records;
|
||||
MULTREGTScanner::ExternalSearchMap searchMap;
|
||||
std::map<std::string, std::vector<int>> regions;
|
||||
std::string defaultRegion;
|
||||
|
||||
unpack(size, buffer, position, comm);
|
||||
unpack(records, buffer, position, comm);
|
||||
unpack(searchMap, buffer, position, comm);
|
||||
unpack(regions, buffer, position, comm);
|
||||
unpack(defaultRegion, buffer, position, comm);
|
||||
|
||||
data = MULTREGTScanner(size, records, searchMap, regions, defaultRegion);
|
||||
}
|
||||
|
||||
void unpack(EclipseConfig& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
InitConfig init;
|
||||
IOConfig io;
|
||||
RestartConfig restart;
|
||||
|
||||
unpack(init, buffer, position, comm);
|
||||
unpack(io, buffer, position, comm);
|
||||
unpack(restart, buffer, position, comm);
|
||||
data = EclipseConfig(io, init, restart);
|
||||
}
|
||||
|
||||
void unpack(TransMult& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::array<size_t, 3> size;
|
||||
std::map<FaceDir::DirEnum, std::vector<double>> trans;
|
||||
std::map<FaceDir::DirEnum, std::string> names;
|
||||
MULTREGTScanner scanner;
|
||||
|
||||
unpack(size, buffer, position, comm);
|
||||
unpack(trans, buffer, position, comm);
|
||||
unpack(names, buffer, position, comm);
|
||||
unpack(scanner, buffer, position, comm);
|
||||
data = TransMult(size, trans, names, scanner);
|
||||
}
|
||||
|
||||
void unpack(FaultFace& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::vector<size_t> indices;
|
||||
FaceDir::DirEnum dir;
|
||||
|
||||
unpack(indices, buffer, position, comm);
|
||||
unpack(dir, buffer, position, comm);
|
||||
data = FaultFace(indices, dir);
|
||||
}
|
||||
|
||||
void unpack(Fault& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
std::string name;
|
||||
double transMult;
|
||||
std::vector<FaultFace> faceList;
|
||||
|
||||
unpack(name, buffer, position, comm);
|
||||
unpack(transMult, buffer, position, comm);
|
||||
unpack(faceList, buffer, position, comm);
|
||||
data = Fault(name, transMult, faceList);
|
||||
}
|
||||
|
||||
void unpack(FaultCollection& data,
|
||||
std::vector<char>& buffer, int& position,
|
||||
Dune::MPIHelper::MPICommunicator comm)
|
||||
{
|
||||
OrderedMap<std::string, Fault> faults;
|
||||
|
||||
unpack(faults, buffer, position, comm);
|
||||
data = FaultCollection(faults);
|
||||
}
|
||||
|
||||
#define INSTANTIATE_PACK_VECTOR(...) \
|
||||
template std::size_t packSize(const std::vector<__VA_ARGS__>& data, \
|
||||
Dune::MPIHelper::MPICommunicator comm); \
|
||||
|
@ -84,12 +84,16 @@ class DENSITYRecord;
|
||||
class DensityTable;
|
||||
class Dimension;
|
||||
class EclHysterConfig;
|
||||
class EclipseConfig;
|
||||
class Eqldims;
|
||||
class EDITNNC;
|
||||
class EndpointScaling;
|
||||
class Equil;
|
||||
class EquilRecord;
|
||||
class Events;
|
||||
class Fault;
|
||||
class FaultCollection;
|
||||
class FaultFace;
|
||||
class FoamConfig;
|
||||
class FoamData;
|
||||
class InitConfig;
|
||||
@ -99,6 +103,8 @@ class JFunc;
|
||||
class Location;
|
||||
class MessageLimits;
|
||||
class MLimits;
|
||||
class MULTREGTRecord;
|
||||
class MULTREGTScanner;
|
||||
class NNC;
|
||||
struct NNCdata;
|
||||
class OilVaporizationProperties;
|
||||
@ -137,6 +143,7 @@ class TableManager;
|
||||
class TableSchema;
|
||||
class ThresholdPressure;
|
||||
class TimeStampUTC;
|
||||
class TransMult;
|
||||
class Tuning;
|
||||
class UDAValue;
|
||||
class UDQASTNode;
|
||||
@ -654,12 +661,16 @@ ADD_PACK_PROTOTYPES(DENSITYRecord)
|
||||
ADD_PACK_PROTOTYPES(DensityTable)
|
||||
ADD_PACK_PROTOTYPES(Dimension)
|
||||
ADD_PACK_PROTOTYPES(EclHysterConfig)
|
||||
ADD_PACK_PROTOTYPES(EclipseConfig)
|
||||
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(Fault)
|
||||
ADD_PACK_PROTOTYPES(FaultCollection)
|
||||
ADD_PACK_PROTOTYPES(FaultFace)
|
||||
ADD_PACK_PROTOTYPES(FoamConfig)
|
||||
ADD_PACK_PROTOTYPES(FoamData)
|
||||
ADD_PACK_PROTOTYPES(GConSale)
|
||||
@ -679,6 +690,8 @@ ADD_PACK_PROTOTYPES(JFunc)
|
||||
ADD_PACK_PROTOTYPES(Location)
|
||||
ADD_PACK_PROTOTYPES(MessageLimits)
|
||||
ADD_PACK_PROTOTYPES(MLimits)
|
||||
ADD_PACK_PROTOTYPES(MULTREGTRecord)
|
||||
ADD_PACK_PROTOTYPES(MULTREGTScanner)
|
||||
ADD_PACK_PROTOTYPES(NNC)
|
||||
ADD_PACK_PROTOTYPES(NNCdata)
|
||||
ADD_PACK_PROTOTYPES(OilVaporizationProperties)
|
||||
@ -722,6 +735,7 @@ ADD_PACK_PROTOTYPES(ThresholdPressure)
|
||||
ADD_PACK_PROTOTYPES(TimeMap)
|
||||
ADD_PACK_PROTOTYPES(TimeMap::StepData)
|
||||
ADD_PACK_PROTOTYPES(TimeStampUTC)
|
||||
ADD_PACK_PROTOTYPES(TransMult)
|
||||
ADD_PACK_PROTOTYPES(Tuning)
|
||||
ADD_PACK_PROTOTYPES(UDAValue)
|
||||
ADD_PACK_PROTOTYPES(UDQActive)
|
||||
|
@ -2415,6 +2415,117 @@ BOOST_AUTO_TEST_CASE(WellBrineProperties)
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MULTREGTRecord)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::MULTREGTRecord val1{1, 2, 3.0, 4, Opm::MULTREGT::ALL, "test"};
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(MULTREGTScanner)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
std::vector<Opm::MULTREGTRecord> records{{1, 2, 3.0, 4, Opm::MULTREGT::ALL, "test1"}};
|
||||
std::map<std::pair<int, int>, int> searchRecord{{{5,6},0}};
|
||||
Opm::MULTREGTScanner::ExternalSearchMap searchMap;
|
||||
searchMap.insert({"test2", searchRecord});
|
||||
Opm::MULTREGTScanner val1({1, 2, 3},
|
||||
records,
|
||||
searchMap,
|
||||
{{"test3", {7,8}}},
|
||||
"test4");
|
||||
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EclipseConfig)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::IOConfig io(true, false, true, false, false, true, 1, "test1", true,
|
||||
"test2", true, "test3", false);
|
||||
Opm::InitConfig init(Opm::Equil({getEquilRecord(), getEquilRecord()}),
|
||||
Opm::FoamConfig({getFoamData(), getFoamData()}),
|
||||
true, true, 20, "test1");
|
||||
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
|
||||
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
|
||||
Opm::RestartConfig restart(getTimeMap(), 1, true, rsched, rkw, {false, true});
|
||||
Opm::EclipseConfig val1{io, init, restart};
|
||||
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TransMult)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
std::vector<Opm::MULTREGTRecord> records{{1, 2, 3.0, 4, Opm::MULTREGT::ALL, "test1"}};
|
||||
std::map<std::pair<int, int>, int> searchRecord{{{5,6},0}};
|
||||
Opm::MULTREGTScanner::ExternalSearchMap searchMap;
|
||||
searchMap.insert({"test2", searchRecord});
|
||||
Opm::MULTREGTScanner scanner({1, 2, 3},
|
||||
records,
|
||||
searchMap,
|
||||
{{"test3", {7,8}}},
|
||||
"test4");
|
||||
|
||||
Opm::TransMult val1({1, 2, 3},
|
||||
{{Opm::FaceDir::YPlus, {4.0, 5.0}}},
|
||||
{{Opm::FaceDir::ZPlus, "test1"}},
|
||||
scanner);
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(FaultFace)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::FaultFace val1({1,2,3,4,5,6}, Opm::FaceDir::YPlus);
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Fault)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Fault val1("test", 1.0, {{{1,2,3,4,5,6}, Opm::FaceDir::YPlus}});
|
||||
auto val2 = PackUnpack(val1);
|
||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(FaultCollection)
|
||||
{
|
||||
#ifdef HAVE_MPI
|
||||
Opm::Fault fault("test", 1.0, {{{1,2,3,4,5,6}, Opm::FaceDir::YPlus}});
|
||||
Opm::OrderedMap<std::string, Opm::Fault> faults;
|
||||
faults.insert({"test2", fault});
|
||||
Opm::FaultCollection val1(faults);
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user