Skip to content

Commit

Permalink
OutputFieldsDefault: fix next_out edge case
Browse files Browse the repository at this point in the history
floordiv would also work
  • Loading branch information
James committed Sep 7, 2023
1 parent d1cdcba commit a059e51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/OutputFieldsDefault.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ struct BaseOutputFieldItemParams
// Returns the next output timestep after the given timestep.
int next_out(int timestep)
{
if (timestep < out_first)
return out_first;
int n_intervals_elapsed = (timestep - out_first) / out_interval;
return out_first + out_interval * (n_intervals_elapsed + 1);
}
Expand Down

0 comments on commit a059e51

Please sign in to comment.