|
numerics
|
Gravitational N-body simulation using num::ode_verlet / num::ode_rk4. More...
#include "ode/ode.hpp"#include <vector>#include <utility>#include <cstdint>#include <cmath>#include <string>Go to the source code of this file.
Classes | |
| struct | nbody::Body |
| struct | nbody::NBodySim |
Namespaces | |
| namespace | nbody |
Enumerations | |
| enum class | nbody::Scenario { nbody::Figure8 , nbody::SolarSystem , nbody::BinaryPlus , nbody::Galaxy } |
Functions | |
| const char * | nbody::scenario_name (Scenario s) |
Gravitational N-body simulation using num::ode_verlet / num::ode_rk4.
NBodySim wraps the ODE module to provide a per-frame step() interface. Each call to step(dt) runs exactly one time step of the chosen integrator:
Verlet (symplectic, default) – ode_verlet: O(h²), bounded energy error RK4 (non-symplectic) – ode_rk4: O(h⁴), secular energy drift
This lets the visualisation directly compare the two on the same scenario.
Definition in file nbody.hpp.