Skip to content

Commit

Permalink
bugfix default init statistics action
Browse files Browse the repository at this point in the history
  • Loading branch information
stefaniereuter committed Nov 24, 2024
1 parent 099d8f8 commit 6698296
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
23 changes: 14 additions & 9 deletions src/multio/action/statistics/Statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/multio/action/statistics/TemporalStatistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/multio/action/statistics/cfg/StatisticsConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 6698296

Please sign in to comment.