51namespace orrery::sim {
66 std::unique_ptr<integrators::Integrator> integrator, core::Real timestep,
67 std::unique_ptr<backend::Executor> executor =
nullptr,
68 std::unique_ptr<RunOutput> output =
nullptr);
89 void run(core::Index steps);
102 bool accelerations_are_current = false);
104 [[nodiscard]] core::Index step_index() const noexcept {
return step_; }
107 [[nodiscard]] core::Real
time() const noexcept {
108 return static_cast<core::Real
>(step_) * timestep_;
111 [[nodiscard]] core::Real timestep() const noexcept {
return timestep_; }
113 [[nodiscard]]
const core::ParticleData& particles() const noexcept {
return particles_; }
115 [[nodiscard]]
const solvers::ForceSolver& solver() const noexcept {
return *solver_; }
117 [[nodiscard]]
const integrators::Integrator& integrator() const noexcept {
135 std::unique_ptr<backend::Executor> executor_;
137 std::unique_ptr<solvers::ForceSolver> solver_;
138 std::unique_ptr<integrators::Integrator> integrator_;
139 std::unique_ptr<RunOutput> output_;
142 core::Real timestep_;
Storage for a set of point masses in structure-of-arrays layout.
Definition particle_data.hpp:43
Somewhere for a run to report itself to.
Definition run_output.hpp:40
void step()
Advance by one step and count it.
core::Real time() const noexcept
The simulated time, step * timestep.
Definition simulation.hpp:107
void run(core::Index steps)
Record the current state, then take steps steps, recording as the output asks.
Simulation(core::ParticleData particles, std::unique_ptr< solvers::ForceSolver > solver, std::unique_ptr< integrators::Integrator > integrator, core::Real timestep, std::unique_ptr< backend::Executor > executor=nullptr, std::unique_ptr< RunOutput > output=nullptr)
Take ownership of a configuration and the machinery to advance it.
void restore(core::ParticleData particles, core::Index step, bool accelerations_are_current=false)
Replace the state and the step counter, as a resume does.
core::Diagnostics measure() const
Measure the conserved quantities of the current state.
The conserved quantities, which are how this project knows it is right.
How a kernel asks for a loop to be run in parallel.
What every gravitational force solver in this project provides.
The interface every time integrator presents, and the contract about accelerations that makes the che...
The particle store: one contiguous array per component.
Every conserved quantity of a configuration, measured at one instant.
Definition diagnostics.hpp:52
The scalar and index types that every layer of the project agrees on.
std::size_t Index
The type of a particle index and of any count of particles.
Definition types.hpp:45