From 720fd6663825c421eff8f34aa6b03b320e9c6b2c Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 16 Jan 2020 12:27:39 +0100 Subject: [PATCH] fixed: do not handle TimeMap::StepData as POD valgrind is not happy --- opm/simulators/utils/ParallelRestart.cpp | 61 +++++++++++++++++++++++- opm/simulators/utils/ParallelRestart.hpp | 2 + 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/opm/simulators/utils/ParallelRestart.cpp b/opm/simulators/utils/ParallelRestart.cpp index cb6586575..d128abfc5 100644 --- a/opm/simulators/utils/ParallelRestart.cpp +++ b/opm/simulators/utils/ParallelRestart.cpp @@ -457,7 +457,7 @@ HANDLE_AS_POD(PVCDORecord) HANDLE_AS_POD(Regdims) HANDLE_AS_POD(ROCKRecord) HANDLE_AS_POD(Tabdims) -HANDLE_AS_POD(TimeMap::StepData) +HANDLE_AS_POD(TimeStampUTC::YMD) HANDLE_AS_POD(VISCREFRecord) HANDLE_AS_POD(WATDENTRecord) HANDLE_AS_POD(Well::WellGuideRate) @@ -1891,6 +1891,23 @@ std::size_t packSize(const RestartSchedule& data, packSize(data.rptsched_restart, comm); } +std::size_t packSize(const TimeStampUTC& data, + Dune::MPIHelper::MPICommunicator comm) +{ + return packSize(data.ymd(), comm) + + packSize(data.hour(), comm) + + packSize(data.minutes(), comm) + + packSize(data.seconds(), comm) + + 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); +} + ////// pack routines template @@ -3671,6 +3688,25 @@ void pack(const RestartSchedule& data, pack(data.rptsched_restart, buffer, position, comm); } +void pack(const TimeStampUTC& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.ymd(), buffer, position, comm); + pack(data.hour(), buffer, position, comm); + pack(data.minutes(), buffer, position, comm); + pack(data.seconds(), buffer, position, comm); + pack(data.microseconds(), buffer, position, comm); +} + +void pack(const TimeMap::StepData& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + pack(data.stepnumber, buffer, position, comm); + pack(data.timestamp, buffer, position, comm); +} + /// unpack routines template @@ -6235,6 +6271,29 @@ void unpack(RestartSchedule& data, unpack(data.rptsched_restart, buffer, position, comm); } +void unpack(TimeStampUTC& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + TimeStampUTC::YMD ymd; + int hour, minutes, seconds, usec; + + unpack(ymd, buffer, position, comm); + unpack(hour, buffer, position, comm); + unpack(minutes, buffer, position, comm); + unpack(seconds, buffer, position, comm); + unpack(usec, buffer, position, comm); + data = TimeStampUTC(ymd, hour, minutes, seconds, usec); +} + +void unpack(TimeMap::StepData& data, + std::vector& buffer, int& position, + Dune::MPIHelper::MPICommunicator comm) +{ + unpack(data.stepnumber, buffer, position, comm); + unpack(data.timestamp, buffer, position, comm); +} + #define INSTANTIATE_PACK_VECTOR(T) \ template std::size_t packSize(const std::vector& data, \ Dune::MPIHelper::MPICommunicator comm); \ diff --git a/opm/simulators/utils/ParallelRestart.hpp b/opm/simulators/utils/ParallelRestart.hpp index f81590386..715a97911 100644 --- a/opm/simulators/utils/ParallelRestart.hpp +++ b/opm/simulators/utils/ParallelRestart.hpp @@ -136,6 +136,7 @@ class TableContainer; class TableManager; class TableSchema; class ThresholdPressure; +class TimeStampUTC; class Tuning; class UDAValue; class UDQASTNode; @@ -720,6 +721,7 @@ ADD_PACK_PROTOTYPES(TableSchema) ADD_PACK_PROTOTYPES(ThresholdPressure) ADD_PACK_PROTOTYPES(TimeMap) ADD_PACK_PROTOTYPES(TimeMap::StepData) +ADD_PACK_PROTOTYPES(TimeStampUTC) ADD_PACK_PROTOTYPES(Tuning) ADD_PACK_PROTOTYPES(UDAValue) ADD_PACK_PROTOTYPES(UDQActive)