Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
velocity_verlet.hpp
Go to the documentation of this file.
1#pragma once
2
25
26#include <string_view>
27
29#include "orrery/core/types.hpp"
32
33namespace orrery::integrators {
34
42void velocity_verlet_step(core::ParticleData& data, core::Real timestep, AccelerationField& field);
43
45class VelocityVerlet final : public Integrator {
46public:
47 void step(core::ParticleData& data, core::Real timestep, AccelerationField& field) override;
48
49 [[nodiscard]] std::string_view name() const noexcept override { return "velocity Verlet"; }
50
51 [[nodiscard]] int order() const noexcept override { return 2; }
52
53 [[nodiscard]] bool is_symplectic() const noexcept override { return true; }
54
55 [[nodiscard]] core::Index force_evaluations_per_step() const noexcept override { return 1; }
56};
57
58} // namespace orrery::integrators
What an integrator is allowed to know about gravity.
Storage for a set of point masses in structure-of-arrays layout.
Definition particle_data.hpp:43
The acceleration produced by a set of masses at a set of positions.
Definition acceleration_field.hpp:37
The second-order symplectic integrator described above.
Definition velocity_verlet.hpp:45
core::Index force_evaluations_per_step() const noexcept override
How many times step calls the acceleration field.
Definition velocity_verlet.hpp:55
int order() const noexcept override
The order of the method: the power of the timestep that the error after a fixed interval of simulated...
Definition velocity_verlet.hpp:51
bool is_symplectic() const noexcept override
Whether the method preserves the phase-space volume of the flow.
Definition velocity_verlet.hpp:53
std::string_view name() const noexcept override
The method's name, for diagnostics output and test messages.
Definition velocity_verlet.hpp:49
void step(core::ParticleData &data, core::Real timestep, AccelerationField &field) override
Advance the configuration by one step of timestep.
The interface every time integrator presents, and the contract about accelerations that makes the che...
The particle store: one contiguous array per component.
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
void velocity_verlet_step(core::ParticleData &data, core::Real timestep, AccelerationField &field)
One kick-drift-kick step, as a free function.