Orrery
A GPU-accelerated N-body gravitational simulator
Toggle main menu visibility
Loading...
Searching...
No Matches
runge_kutta4.hpp
Go to the documentation of this file.
1
#pragma once
2
31
32
#include <string_view>
33
34
#include "
orrery/core/particle_data.hpp
"
35
#include "
orrery/core/types.hpp
"
36
#include "
orrery/core/vec3_array.hpp
"
37
#include "
orrery/integrators/acceleration_field.hpp
"
38
#include "
orrery/integrators/integrator.hpp
"
39
40
namespace
orrery::integrators {
41
48
class
RungeKutta4
final :
public
Integrator {
49
public
:
50
void
step
(
core::ParticleData
& data, core::Real timestep,
AccelerationField
& field)
override
;
51
52
[[nodiscard]] std::string_view
name
() const noexcept
override
{
return
"RK4"
; }
53
54
[[nodiscard]]
int
order
() const noexcept
override
{
return
4; }
55
56
[[nodiscard]]
bool
is_symplectic
() const noexcept
override
{
return
false
; }
57
65
[[nodiscard]]
core::Index
force_evaluations_per_step
() const noexcept
override
{
return
4; }
66
67
private
:
70
void
evaluate_stage(
core::ParticleData
& data,
AccelerationField
& field, core::Real scale,
71
core::Real weight);
72
73
core::Vec3Array
initial_positions_;
74
core::Vec3Array
initial_velocities_;
75
core::Vec3Array
position_derivative_sum_;
76
core::Vec3Array
velocity_derivative_sum_;
77
};
78
79
}
// namespace orrery::integrators
acceleration_field.hpp
What an integrator is allowed to know about gravity.
orrery::core::ParticleData
Storage for a set of point masses in structure-of-arrays layout.
Definition
particle_data.hpp:43
orrery::core::Vec3Array
A resizable array of 3-vectors in component-array layout.
Definition
vec3_array.hpp:34
orrery::integrators::AccelerationField
The acceleration produced by a set of masses at a set of positions.
Definition
acceleration_field.hpp:37
orrery::integrators::RungeKutta4
The classical fourth-order Runge-Kutta method.
Definition
runge_kutta4.hpp:48
orrery::integrators::RungeKutta4::is_symplectic
bool is_symplectic() const noexcept override
Whether the method preserves the phase-space volume of the flow.
Definition
runge_kutta4.hpp:56
orrery::integrators::RungeKutta4::step
void step(core::ParticleData &data, core::Real timestep, AccelerationField &field) override
Advance the configuration by one step of timestep.
orrery::integrators::RungeKutta4::force_evaluations_per_step
core::Index force_evaluations_per_step() const noexcept override
Four, and the first of them is free.
Definition
runge_kutta4.hpp:65
orrery::integrators::RungeKutta4::name
std::string_view name() const noexcept override
The method's name, for diagnostics output and test messages.
Definition
runge_kutta4.hpp:52
orrery::integrators::RungeKutta4::order
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
runge_kutta4.hpp:54
integrator.hpp
The interface every time integrator presents, and the contract about accelerations that makes the che...
particle_data.hpp
The particle store: one contiguous array per component.
types.hpp
The scalar and index types that every layer of the project agrees on.
orrery::core::Index
std::size_t Index
The type of a particle index and of any count of particles.
Definition
types.hpp:45
vec3_array.hpp
Storage for a vector quantity that is not part of the particle state.
orrery
integrators
runge_kutta4.hpp
Generated by
1.17.0