Use (std::vector<std::time_t>&) constructor when serialing TimeMap

This commit is contained in:
Joakim Hove 2020-01-22 16:40:23 +01:00
parent 2cfe1dce7f
commit 54509c7b56
3 changed files with 3 additions and 46 deletions

View File

@ -611,9 +611,7 @@ std::size_t packSize(const SimulationConfig& data, Dune::MPIHelper::MPICommunica
std::size_t packSize(const TimeMap& data, Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.timeList(), comm) +
packSize(data.firstTimeStepMonths(), comm) +
packSize(data.firstTimeStepYears(), comm);
return packSize(data.timeList(), comm);
}
std::size_t packSize(const RestartConfig& data, Dune::MPIHelper::MPICommunicator comm)
@ -1923,13 +1921,6 @@ std::size_t packSize(const TimeStampUTC& data,
packSize(data.microseconds(), comm);
}
std::size_t packSize(const TimeMap::StepData& data,
Dune::MPIHelper::MPICommunicator comm)
{
return packSize(data.stepnumber, comm) +
packSize(data.timestamp, comm);
}
std::size_t packSize(const EclHysterConfig& data,
Dune::MPIHelper::MPICommunicator comm)
{
@ -2449,8 +2440,6 @@ void pack(const TimeMap& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.timeList(), buffer, position, comm);
pack(data.firstTimeStepMonths(), buffer, position, comm);
pack(data.firstTimeStepYears(), buffer, position, comm);
}
void pack(const RestartConfig& data, std::vector<char>& buffer, int& position,
@ -3831,14 +3820,6 @@ void pack(const TimeStampUTC& data,
pack(data.microseconds(), buffer, position, comm);
}
void pack(const TimeMap::StepData& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
pack(data.stepnumber, buffer, position, comm);
pack(data.timestamp, buffer, position, comm);
}
void pack(const EclHysterConfig& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
@ -4496,13 +4477,9 @@ void unpack(TimeMap& data, std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
std::vector<std::time_t> timeList;
std::vector<TimeMap::StepData> firstStepMonths;
std::vector<TimeMap::StepData> firstStepYears;
unpack(timeList, buffer, position, comm);
unpack(firstStepMonths, buffer, position, comm);
unpack(firstStepYears, buffer, position, comm);
data = TimeMap(timeList, firstStepMonths, firstStepYears);
data = TimeMap(timeList);
}
void unpack(RestartConfig& data, std::vector<char>& buffer, int& position,
@ -6594,13 +6571,6 @@ void unpack(TimeStampUTC& data,
data = TimeStampUTC(ymd, hour, minutes, seconds, usec);
}
void unpack(TimeMap::StepData& data,
std::vector<char>& buffer, int& position,
Dune::MPIHelper::MPICommunicator comm)
{
unpack(data.stepnumber, buffer, position, comm);
unpack(data.timestamp, buffer, position, comm);
}
void unpack(EclHysterConfig& data,
std::vector<char>& buffer, int& position,

View File

@ -746,7 +746,6 @@ ADD_PACK_PROTOTYPES(TableManager)
ADD_PACK_PROTOTYPES(TableSchema)
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)

View File

@ -223,9 +223,7 @@ Opm::FoamData getFoamData()
Opm::TimeMap getTimeMap()
{
return Opm::TimeMap({123},
{{1, Opm::TimeStampUTC(123)}},
{{2, Opm::TimeStampUTC(456)}});
return Opm::TimeMap({123});
}
Opm::PvtgTable getPvtgTable()
@ -789,16 +787,6 @@ BOOST_AUTO_TEST_CASE(RestartSchedule)
}
BOOST_AUTO_TEST_CASE(StepData)
{
#if HAVE_MPI
Opm::TimeMap::StepData val1{1, Opm::TimeStampUTC(123456)};
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(TimeMap)
{