mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-11 06:15:34 -06:00
Merge pull request #2308 from joakim-hove/serialize-restart-config
Moved IOConfig to become member of RestartConfig
This commit is contained in:
commit
91167ad405
@ -626,7 +626,8 @@ std::size_t packSize(const TimeMap& data, Dune::MPIHelper::MPICommunicator comm)
|
|||||||
|
|
||||||
std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator comm)
|
std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
return packSize(data.timeMap(), comm) +
|
return packSize(data.ioConfig(), comm) +
|
||||||
|
packSize(data.timeMap(), comm) +
|
||||||
packSize(data.getFirstRestartStep(), comm) +
|
packSize(data.getFirstRestartStep(), comm) +
|
||||||
packSize(data.writeInitialRst(), comm) +
|
packSize(data.writeInitialRst(), comm) +
|
||||||
packSize(data.restartSchedule(), comm) +
|
packSize(data.restartSchedule(), comm) +
|
||||||
@ -2009,7 +2010,6 @@ std::size_t packSize(const EclipseConfig& data,
|
|||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
return packSize(data.init(), comm) +
|
return packSize(data.init(), comm) +
|
||||||
packSize(data.io(), comm) +
|
|
||||||
packSize(data.restart(), comm);
|
packSize(data.restart(), comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2463,6 +2463,7 @@ void pack(const TimeMap& data, std::vector<char>& buffer, int& position,
|
|||||||
void pack(const RestartConfig& data, std::vector<char>& buffer, int& position,
|
void pack(const RestartConfig& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
|
pack(data.ioConfig(), buffer, position, comm);
|
||||||
pack(data.timeMap(), buffer, position, comm);
|
pack(data.timeMap(), buffer, position, comm);
|
||||||
pack(data.getFirstRestartStep(), buffer, position, comm);
|
pack(data.getFirstRestartStep(), buffer, position, comm);
|
||||||
pack(data.writeInitialRst(), buffer, position, comm);
|
pack(data.writeInitialRst(), buffer, position, comm);
|
||||||
@ -3925,7 +3926,6 @@ void pack(const EclipseConfig& data,
|
|||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
pack(data.init(), buffer, position, comm);
|
pack(data.init(), buffer, position, comm);
|
||||||
pack(data.io(), buffer, position, comm);
|
|
||||||
pack(data.restart(), buffer, position, comm);
|
pack(data.restart(), buffer, position, comm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4515,19 +4515,21 @@ void unpack(TimeMap& data, std::vector<char>& buffer, int& position,
|
|||||||
void unpack(RestartConfig& data, std::vector<char>& buffer, int& position,
|
void unpack(RestartConfig& data, std::vector<char>& buffer, int& position,
|
||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
|
IOConfig ioConfig;
|
||||||
TimeMap timemap;
|
TimeMap timemap;
|
||||||
int firstRstStep;
|
int firstRstStep;
|
||||||
bool writeInitialRst;
|
bool writeInitialRst;
|
||||||
DynamicState<RestartSchedule> restart_sched;
|
DynamicState<RestartSchedule> restart_sched;
|
||||||
DynamicState<std::map<std::string,int>> restart_keyw;
|
DynamicState<std::map<std::string,int>> restart_keyw;
|
||||||
std::vector<bool> save_keyw;
|
std::vector<bool> save_keyw;
|
||||||
|
unpack(ioConfig, buffer, position, comm);
|
||||||
unpack(timemap, buffer, position, comm);
|
unpack(timemap, buffer, position, comm);
|
||||||
unpack(firstRstStep, buffer, position, comm);
|
unpack(firstRstStep, buffer, position, comm);
|
||||||
unpack(writeInitialRst, buffer, position, comm);
|
unpack(writeInitialRst, buffer, position, comm);
|
||||||
unpack(restart_sched, buffer, position, comm);
|
unpack(restart_sched, buffer, position, comm);
|
||||||
unpack(restart_keyw, buffer, position, comm);
|
unpack(restart_keyw, buffer, position, comm);
|
||||||
unpack(save_keyw, buffer, position, comm);
|
unpack(save_keyw, buffer, position, comm);
|
||||||
data = RestartConfig(timemap, firstRstStep, writeInitialRst, restart_sched,
|
data = RestartConfig(ioConfig, timemap, firstRstStep, writeInitialRst, restart_sched,
|
||||||
restart_keyw, save_keyw);
|
restart_keyw, save_keyw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6708,13 +6710,11 @@ void unpack(EclipseConfig& data,
|
|||||||
Dune::MPIHelper::MPICommunicator comm)
|
Dune::MPIHelper::MPICommunicator comm)
|
||||||
{
|
{
|
||||||
InitConfig init;
|
InitConfig init;
|
||||||
IOConfig io;
|
|
||||||
RestartConfig restart;
|
RestartConfig restart;
|
||||||
|
|
||||||
unpack(init, buffer, position, comm);
|
unpack(init, buffer, position, comm);
|
||||||
unpack(io, buffer, position, comm);
|
|
||||||
unpack(restart, buffer, position, comm);
|
unpack(restart, buffer, position, comm);
|
||||||
data = EclipseConfig(io, init, restart);
|
data = EclipseConfig(init, restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpack(TransMult& data,
|
void unpack(TransMult& data,
|
||||||
|
@ -821,7 +821,9 @@ BOOST_AUTO_TEST_CASE(RestartConfig)
|
|||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
|
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
|
||||||
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
|
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
|
||||||
Opm::RestartConfig val1(getTimeMap(), 1, true, rsched, rkw, {false, true});
|
Opm::IOConfig io(true, false, true, false, false, true, "test1", true,
|
||||||
|
"test2", true, "test3", false);
|
||||||
|
Opm::RestartConfig val1(io, getTimeMap(), 1, true, rsched, rkw, {false, true});
|
||||||
auto val2 = PackUnpack(val1);
|
auto val2 = PackUnpack(val1);
|
||||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||||
BOOST_CHECK(val1 == std::get<0>(val2));
|
BOOST_CHECK(val1 == std::get<0>(val2));
|
||||||
@ -2464,8 +2466,8 @@ BOOST_AUTO_TEST_CASE(EclipseConfig)
|
|||||||
true, true, true, 20, "test1");
|
true, true, true, 20, "test1");
|
||||||
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
|
Opm::DynamicState<Opm::RestartSchedule> rsched({Opm::RestartSchedule(1, 2, 3)}, 2);
|
||||||
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
|
Opm::DynamicState<std::map<std::string,int>> rkw({{{"test",3}}}, 3);
|
||||||
Opm::RestartConfig restart(getTimeMap(), 1, true, rsched, rkw, {false, true});
|
Opm::RestartConfig restart(io, getTimeMap(), 1, true, rsched, rkw, {false, true});
|
||||||
Opm::EclipseConfig val1{io, init, restart};
|
Opm::EclipseConfig val1{init, restart};
|
||||||
|
|
||||||
auto val2 = PackUnpack(val1);
|
auto val2 = PackUnpack(val1);
|
||||||
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
BOOST_CHECK(std::get<1>(val2) == std::get<2>(val2));
|
||||||
|
Loading…
Reference in New Issue
Block a user