Skip to content

Commit

Permalink
Chaops: now time can go backwards, but Frolic is not stable then.
Browse files Browse the repository at this point in the history
  • Loading branch information
cosinekitty committed Nov 26, 2024
1 parent 90f0315 commit fba8748
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/chaos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,12 @@ namespace Sapphire

void update(double dt)
{
using namespace std;

// If the derived class has informed us of a maximum stable time increment,
// use oversampling to keep the actual time increment within that limit:
// find the smallest positive integer n such that dt/n <= max_dt.
const int n = (max_dt <= 0.0) ? 1 : static_cast<int>(std::ceil(dt / max_dt));
const int n = (max_dt <= 0.0) ? 1 : static_cast<int>(ceil(abs(dt) / max_dt));
const double et = dt / n;
for (int i = 0; i < n; ++i)
step(et);
Expand Down

0 comments on commit fba8748

Please sign in to comment.