Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix default init statistics action #39

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 4 additions & 4 deletions src/multio/action/statistics/cfg/StatisticsConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ namespace multio::action {

using message::glossary;

StatisticsConfiguration::StatisticsConfiguration( const message::Message& msg, const StatisticsOptions& opt ):
StatisticsConfiguration::StatisticsConfiguration(const message::Message& msg, const StatisticsOptions& opt) :
opt_{opt},
date_{0},
time_{0},
level_{0},
timeStep_{0},
stepFreq_{0},
timeStep_{opt.timeStep()},
stepFreq_{opt.stepFreq()},
step_{0},
param_{"none"},
levType_{"none"},
Expand All @@ -31,7 +31,7 @@ StatisticsConfiguration::StatisticsConfiguration( const message::Message& msg, c
bitmapPresent_{false},
missingValue_{std::numeric_limits<double>::quiet_NaN()},
key_{"unknown"},
logPrefix_{opt_.logPrefix()}{
logPrefix_{opt_.logPrefix()} {

// Associate local procedure pointers
computeEpoch_ = std::bind(&StatisticsConfiguration::computeEpoch, this);
Expand Down
Loading