Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
vec3_array.hpp File Reference

Storage for a vector quantity that is not part of the particle state. More...

#include <vector>
#include "orrery/core/aligned_allocator.hpp"
#include "orrery/core/types.hpp"
#include "orrery/core/vec3_span.hpp"

Go to the source code of this file.

Classes

class  orrery::core::Vec3Array
 A resizable array of 3-vectors in component-array layout. More...

Detailed Description

Storage for a vector quantity that is not part of the particle state.

ParticleData holds the ten arrays a particle is made of, and its invariant is that all ten agree in length. That is exactly what a simulation wants and exactly what an intermediate result does not: a Runge-Kutta stage needs a saved copy of the positions and a running sum of stage derivatives, and neither has a mass or an acceleration to go with it. Allocating a whole particle store to use three of its arrays would move a third more memory than the work requires and would invite a reader to ask which of the unused seven arrays were meaningful.

So this is the same layout decision as ADR-0004 applied to one quantity rather than to ten: three cache-line-aligned component arrays, viewed through the same Vec3Span that every kernel already takes. It lives in core because the layout and the allocator are core's decisions, not because any part of core uses it yet.