|
Orrery
A GPU-accelerated N-body gravitational simulator
|
One cell of the tree. More...
#include <orrery/solvers/octree.hpp>
Public Member Functions | |
| constexpr bool | leaf () const noexcept |
Public Attributes | |
| core::Real | mass {} |
| The total mass of everything below this node. | |
| core::Vec3 | centre_of_mass |
| The mass-weighted mean position of everything below this node. | |
| core::Real | acceptance_radius_squared {} |
| The squared distance from the centre of mass beyond which this node may be treated as a single mass. | |
| core::Index | next {} |
| The index just past this node's subtree, which is where a walk that does not descend into it continues. | |
| core::Index | first_particle {} |
| The first particle of a leaf, in the sorted order. | |
| core::Index | particle_count {} |
| How many particles a leaf holds, and zero for an internal node. | |
One cell of the tree.
A leaf holds a non-empty range of the sorted particle arrays. An internal node holds none, and particle_count being zero is what distinguishes the two: a cell with no particles in it is never created, so an empty range can carry the meaning without a flag of its own.
| core::Real orrery::solvers::TreeNode::acceptance_radius_squared {} |
The squared distance from the centre of mass beyond which this node may be treated as a single mass.
Precomputed at build time, where it costs one division per node, rather than derived in the walk from a cell size and an opening angle, where it would cost the same division per node visit. The walk then compares one squared distance against one stored number and needs no arithmetic to decide.
Infinite when the opening angle is zero, which is the correct reading of that request: no cell is ever far enough away, every walk descends to the leaves, and the solver computes exact direct summation by a slower route. That case is the validation instrument of tests/solvers/barnes_hut_test.cpp rather than a configuration anyone would run.