|
Orrery
A GPU-accelerated N-body gravitational simulator
|
The softening length of the Plummer kernel above. More...
#include <orrery/core/softening.hpp>
Public Member Functions | |
| constexpr | Softening () noexcept=default |
| No softening: exact point masses. | |
| constexpr | Softening (Real length) noexcept |
| Softening with the given length. | |
| constexpr Real | squared () const noexcept |
| The softening length squared, which is the form every kernel uses. | |
| Real | length () const noexcept |
The softening length of the Plummer kernel above.
A type rather than a bare Real because a softening length and a softening length squared are both scalars, they appear within one line of each other in every kernel that uses them, and passing one where the other is expected is silent. Holding the square is what the arithmetic wants, so it is what is stored, and the length is recovered on the rare occasions anything asks.
|
constexprdefaultnoexcept |
No softening: exact point masses.
The right choice for the analytic comparisons, where softening would be an error term rather than a model. A Kepler orbit is between two point masses and is checked against the point-mass result.
|
inlineexplicitconstexprnoexcept |
Softening with the given length.
explicit because a length is not a softening until someone says it is, and the two arguments a diagnostic takes after it are also scalars.
The sign of the argument does not matter, since only the square is kept. That is not an invitation to pass a negative length; it is the reason no check rejects one.