From 66982960adca801f03f3babeb40788f87b88667a Mon Sep 17 00:00:00 2001 From: Stefanie Reuter Date: Sun, 24 Nov 2024 22:29:21 +0000 Subject: [PATCH] bugfix default init statistics action --- src/multio/action/statistics/Statistics.cc | 23 +++++++++++-------- .../action/statistics/TemporalStatistics.cc | 3 ++- .../statistics/cfg/StatisticsConfiguration.cc | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/multio/action/statistics/Statistics.cc b/src/multio/action/statistics/Statistics.cc index 12f50afa..8cafa400 100644 --- a/src/multio/action/statistics/Statistics.cc +++ b/src/multio/action/statistics/Statistics.cc @@ -332,23 +332,28 @@ void Statistics::executeImpl(message::Message msg) { // TODO: Reorganize the code to avoid this second search // which is not efficient stat = fieldStats_.find(key); + if (opt_.solver_send_initial_condition()) { + return; + } } - - // Exit if the current time is the same as the current point in the - // window and the solver does not send the initial condition. - // This can happen when the solver is sending the initial condition - // and and the same point is already present in the restart - auto& ts = *(stat->second); - if ( cfg.curr() == ts.cwin().currPoint() && opt_.solver_send_initial_condition() ) { - return; + else{ + // Exit if the current time is the same as the current point in the + // window and the solver does not send the initial condition. + // This can happen when the solver is sending the initial condition + // and and the same point is already present in the restart + auto& ts = *(stat->second); + + if ( cfg.curr() == ts.cwin().currPoint() && opt_.solver_send_initial_condition() ) { + return; + } } - // std::ostringstream os; // os << "Current time vs current point in the window :: " // << cfg.curr() << " " << ts.cwin().currPoint() // << std::endl; // std::cout << os.str() << std::endl; + auto& ts = *(stat->second); // In any case if the current time is greater than the current point in the window, we have a problem if ( cfg.curr() <= ts.cwin().currPoint() ) { std::ostringstream os; diff --git a/src/multio/action/statistics/TemporalStatistics.cc b/src/multio/action/statistics/TemporalStatistics.cc index 1822cbbe..456f4b2b 100644 --- a/src/multio/action/statistics/TemporalStatistics.cc +++ b/src/multio/action/statistics/TemporalStatistics.cc @@ -55,11 +55,12 @@ void TemporalStatistics::updateData(message::Message& msg, const StatisticsConfi } void TemporalStatistics::updateWindow(const message::Message& msg, const StatisticsConfiguration& cfg) { - LOG_DEBUG_LIB(::multio::LibMultio) << cfg.logPrefix() << " *** Update Window " << std::endl; + LOG_DEBUG_LIB(multio::LibMultio) << cfg.logPrefix() << " *** Update Window " << std::endl; window_.updateWindow(window_.endPoint(), periodUpdater_->updateWinEndTime(window_.endPoint())); for (auto& stat : statistics_) { stat->updateWindow(msg.payload().data(), msg.size(), msg, cfg); } + return; } diff --git a/src/multio/action/statistics/cfg/StatisticsConfiguration.cc b/src/multio/action/statistics/cfg/StatisticsConfiguration.cc index a4be5621..3d2e763e 100644 --- a/src/multio/action/statistics/cfg/StatisticsConfiguration.cc +++ b/src/multio/action/statistics/cfg/StatisticsConfiguration.cc @@ -21,8 +21,8 @@ StatisticsConfiguration::StatisticsConfiguration( const message::Message& msg, c date_{0}, time_{0}, level_{0}, - timeStep_{0}, - stepFreq_{0}, + timeStep_{opt.timeStep()}, + stepFreq_{opt.stepFreq()}, step_{0}, param_{"none"}, levType_{"none"},