Skip to content

Commit

Permalink
More corrections to time object advancment.
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldwj authored and mattw-nws committed Aug 23, 2023
1 parent 571738c commit d8e8621
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion include/core/Layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ namespace ngen
} //done catchments

++output_time_index;
simulation_time.advance_timestep();
if ( output_time_index < simulation_time.get_total_output_times() )
{
simulation_time.advance_timestep();
}
}


Expand Down
8 changes: 6 additions & 2 deletions src/NGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ int main(int argc, char *argv[]) {
}

//Now loop some time, iterate catchments, do stuff for total number of output times
for( int count = 0; count < manager->Simulation_Time_Object->get_total_output_times(); count++)
auto num_times = manager->Simulation_Time_Object->get_total_output_times();
for( int count = 0; count < num_times; count++)
{
// The Inner loop will advance all layers unless doing so will break one of two constraints
// 1) A layer may not proceed ahead of the master simulation object's current time
Expand Down Expand Up @@ -430,7 +431,10 @@ int main(int argc, char *argv[]) {
} //done levels
} while( layer_min_next_time < next_time ); // rerun the loop until the last layer would pass the master next time

manager->Simulation_Time_Object->advance_timestep();
if (count + 1 < num_times)
{
manager->Simulation_Time_Object->advance_timestep();
}

} //done time
std::cout<<"Finished "<<manager->Simulation_Time_Object->get_total_output_times()<<" timesteps."<<std::endl;
Expand Down

0 comments on commit d8e8621

Please sign in to comment.