Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
acceleration_field.hpp
Go to the documentation of this file.
1#pragma once
2
22
23#include <span>
24
25#include "orrery/core/types.hpp"
27
28namespace orrery::integrators {
29
37class AccelerationField {
38public:
39 virtual ~AccelerationField() = default;
40
57 std::span<const core::Real> masses,
58 core::Vec3Span<core::Real> accelerations) = 0;
59
60protected:
61 // Copying and moving are the derived class's business. They are declared
62 // here because a class with a virtual destructor suppresses the implicit
63 // ones, and left protected because copying an implementation through a
64 // reference to this base would slice it.
65 AccelerationField() = default;
66 AccelerationField(const AccelerationField&) = default;
67 AccelerationField(AccelerationField&&) = default;
68 AccelerationField& operator=(const AccelerationField&) = default;
69 AccelerationField& operator=(AccelerationField&&) = default;
70};
71
72} // namespace orrery::integrators
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.
A view of three component arrays of equal length.
Definition vec3_span.hpp:33
The scalar and index types that every layer of the project agrees on.
Three parallel component arrays, viewed as one sequence of 3-vectors.