77namespace orrery::solvers {
142 [[nodiscard]] std::string_view
name() const noexcept
override {
return "barnes-hut"; }
159 [[nodiscard]]
const Octree&
tree() const noexcept {
return tree_; }
185 using ComponentArray = std::vector<core::Real, core::AlignedAllocator<core::Real>>;
202 KernelKind kernel_{fastest_available_kernel()};
204 MortonOrdering ordering_;
214 ComponentArray sorted_x_;
215 ComponentArray sorted_y_;
216 ComponentArray sorted_z_;
217 ComponentArray sorted_mass_;
219 InteractionCount count_;
220 EvaluationTimings timings_;
An allocator that starts every allocation on a cache line.
Something that can run a loop body over a range, possibly in parallel.
Definition executor.hpp:52
The softening length of the Plummer kernel above.
Definition softening.hpp:49
const Octree & tree() const noexcept
The tree the last evaluation built, empty before the first.
Definition barnes_hut_solver.hpp:159
KernelKind kernel() const noexcept
The kernel this solver will use at the leaves.
Definition barnes_hut_solver.hpp:182
const backend::Executor * executor() const noexcept
The executor this solver evaluates through, or null if it runs on the calling thread.
Definition barnes_hut_solver.hpp:166
void select_kernel(KernelKind kind) noexcept
Ask for a particular kernel for the pairs at the leaves, and settle for the scalar one if this machin...
Definition barnes_hut_solver.hpp:177
std::string_view name() const noexcept override
The solver's name, for benchmark tables and test messages.
Definition barnes_hut_solver.hpp:142
BarnesHutSolver(TreeParameters parameters={}) noexcept
A solver over exact point masses, evaluated on the calling thread.
Definition barnes_hut_solver.hpp:114
void reset_interaction_count() noexcept override
Set every counter back to zero.
Definition barnes_hut_solver.hpp:148
const EvaluationTimings & timings() const noexcept
Where the last evaluation's time went.
Definition barnes_hut_solver.hpp:162
BarnesHutSolver(TreeParameters parameters, core::Softening softening, backend::Executor &executor) noexcept
A softened solver evaluated through executor.
Definition barnes_hut_solver.hpp:127
BarnesHutSolver(TreeParameters parameters, core::Softening softening) noexcept
A solver softening at the given length.
Definition barnes_hut_solver.hpp:118
void evaluate(core::Vec3Span< const core::Real > positions, std::span< const core::Real > masses, core::Vec3Span< core::Real > accelerations) override
Write the acceleration at each position into accelerations.
const TreeParameters & parameters() const noexcept
The parameters in force, which are the ones asked for after correction.
Definition barnes_hut_solver.hpp:151
core::Softening softening() const noexcept override
The softening this solver applies.
Definition barnes_hut_solver.hpp:144
InteractionCount interaction_count() const noexcept override
The work done since construction or since the last reset.
Definition barnes_hut_solver.hpp:146
The octree of one configuration, built from Morton-sorted particles.
Definition octree.hpp:208
The innermost loop of the direct solver, in more than one instruction set.
KernelKind
Which implementation of the summation to use.
Definition direct_kernel.hpp:85
@ kScalar
One pair at a time, in index order.
Definition direct_kernel.hpp:91
bool kernel_available(KernelKind kind) noexcept
Whether this build, on this machine, can run kind.
How a kernel asks for a loop to be run in parallel.
What every gravitational force solver in this project provides.
The unit in which the cost of a force evaluation is reported.
The order the tree solver reads particles in, and the reason it is not the order they arrived in.
The tree the Barnes-Hut solver walks, and the moments it carries.
TreeParameters corrected_parameters(TreeParameters parameters) noexcept
parameters with the corrections its own documentation describes: the opening angle brought into [0,...
Plummer softening, defined once for everything that needs it.
A view of three component arrays of equal length.
Definition vec3_span.hpp:33
Where the time of one force evaluation went.
Definition barnes_hut_solver.hpp:92
backend::Duration ordering
Computing and sorting the Morton codes.
Definition barnes_hut_solver.hpp:94
backend::Duration traversal
Walking the tree for every particle, which is the part that should dominate.
Definition barnes_hut_solver.hpp:104
backend::Duration construction
Building the octree over the sorted order, moments included.
Definition barnes_hut_solver.hpp:97
backend::Duration gathering
Gathering the sorted positions and masses.
Definition barnes_hut_solver.hpp:100
What a solver has done since the count was last reset.
Definition interaction_count.hpp:37
The choices that decide what the tree costs and how accurate it is.
Definition octree.hpp:147
The scalar and index types that every layer of the project agrees on.
Three parallel component arrays, viewed as one sequence of 3-vectors.
What each worker thread did, and how long it spent doing nothing.
std::chrono::nanoseconds Duration
Durations are stored in nanoseconds so that they add without conversion and mean the same thing on ev...
Definition worker_statistics.hpp:53