|
Orrery
A GPU-accelerated N-body gravitational simulator
|
A view of three component arrays of equal length. More...
#include <orrery/core/vec3_span.hpp>
Public Member Functions | |
| constexpr Index | size () const noexcept |
| The number of vectors in the view. | |
| constexpr bool | empty () const noexcept |
| constexpr Vec3 | get (Index index) const noexcept |
| Gather one vector from the three arrays. | |
| constexpr void | set (Index index, Vec3 value) const noexcept |
| Scatter one vector across the three arrays. | |
| constexpr | operator Vec3Span< const T > () const noexcept |
| A mutable view converts to a read-only one, so that a caller holding write access can pass it to something that only reads. | |
Public Attributes | |
| std::span< T > | x |
| std::span< T > | y |
| std::span< T > | z |
A view of three component arrays of equal length.
T is Real for a mutable view and const Real for a read-only one. Like std::span, this is a handle rather than a container: copying it is cheap, it does not own what it points at, and its own constness says nothing about whether the elements can be written.
|
inlinenodiscardconstexprnoexcept |
The number of vectors in the view.
Reported from one component because the three are always the same length. Every view of this kind comes from ParticleData, which grows its arrays together and has no path that could leave them differing.
|
inlineconstexprnoexcept |
Scatter one vector across the three arrays.
A const member for the same reason std::span::operator[] is one: what is const here is the handle, not the elements it refers to.