Orrery
A GPU-accelerated N-body gravitational simulator
Toggle main menu visibility
Loading...
Searching...
No Matches
integrator.hpp
Go to the documentation of this file.
1
#pragma once
2
32
33
#include <string_view>
34
35
#include "
orrery/core/particle_data.hpp
"
36
#include "
orrery/core/types.hpp
"
37
#include "
orrery/integrators/acceleration_field.hpp
"
38
39
namespace
orrery::integrators {
40
51
inline
void
refresh_accelerations
(
core::ParticleData
& data,
AccelerationField
& field) {
52
field.
evaluate
(data.positions(), data.masses(), data.accelerations());
53
}
54
56
class
Integrator {
57
public
:
58
virtual
~Integrator() =
default
;
59
65
virtual
void
step
(
core::ParticleData
& data, core::Real timestep,
AccelerationField
& field) = 0;
66
68
[[nodiscard]]
virtual
std::string_view
name
() const noexcept = 0;
69
72
[[nodiscard]] virtual
int
order
() const noexcept = 0;
73
80
[[nodiscard]] virtual
bool
is_symplectic
() const noexcept = 0;
81
87
[[nodiscard]] virtual core::Index
force_evaluations_per_step
() const noexcept = 0;
88
89
protected:
90
// As on `AccelerationField`, and for the same reasons.
91
Integrator() = default;
92
Integrator(const Integrator&) = default;
93
Integrator(Integrator&&) = default;
94
Integrator& operator=(const Integrator&) = default;
95
Integrator& operator=(Integrator&&) = default;
96
};
97
98
}
// 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::integrators::AccelerationField
The acceleration produced by a set of masses at a set of positions.
Definition
acceleration_field.hpp:37
orrery::integrators::AccelerationField::evaluate
virtual void evaluate(core::Vec3Span< const core::Real > positions, std::span< const core::Real > masses, core::Vec3Span< core::Real > accelerations)=0
Write the acceleration of each position into accelerations.
orrery::integrators::Integrator::force_evaluations_per_step
virtual core::Index force_evaluations_per_step() const noexcept=0
How many times step calls the acceleration field.
orrery::integrators::Integrator::is_symplectic
virtual bool is_symplectic() const noexcept=0
Whether the method preserves the phase-space volume of the flow.
orrery::integrators::Integrator::order
virtual int order() const noexcept=0
The order of the method: the power of the timestep that the error after a fixed interval of simulated...
orrery::integrators::Integrator::name
virtual std::string_view name() const noexcept=0
The method's name, for diagnostics output and test messages.
orrery::integrators::Integrator::step
virtual void step(core::ParticleData &data, core::Real timestep, AccelerationField &field)=0
Advance the configuration by one step of timestep.
orrery::integrators::refresh_accelerations
void refresh_accelerations(core::ParticleData &data, AccelerationField &field)
Establish the acceleration invariant for a configuration.
Definition
integrator.hpp:51
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
integrators
integrator.hpp
Generated by
1.17.0