|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
True SoA (Structure of Arrays) layout for W point positions, enabling SIMD distance evaluation against the whole group at once. More...
#include <EBGeometry_PointSoA.hpp>

Public Member Functions | |
| void | pack (const Vec3T< T > *a_positions, uint32_t a_count) noexcept |
| Pack a_count positions from a_positions[0..a_count-1] into this SoA group. | |
| std::array< T, W > | getDistances2 (const Vec3T< T > &a_point) const noexcept |
| Squared unsigned distances from a_point to every one of the W lane positions. | |
| std::array< T, W > | getDistances (const Vec3T< T > &a_point) const noexcept |
| Unsigned distances from a_point to every one of the W lane positions. | |
| T | getMinimumDistance2 (const Vec3T< T > &a_point) const noexcept |
| Shortest squared unsigned distance from a_point to the closest position in this group. | |
| T | getMinimumDistance (const Vec3T< T > &a_point) const noexcept |
| Shortest unsigned distance from a_point to the closest position in this group. | |
| T | getMaximumDistance2 (const Vec3T< T > &a_point) const noexcept |
| Largest squared unsigned distance from a_point to the farthest position in this group. | |
| T | getMaximumDistance (const Vec3T< T > &a_point) const noexcept |
| Largest unsigned distance from a_point to the farthest position in this group. | |
| template<class BV > | |
| BV | computeBoundingVolume () const noexcept |
| Compute the bounding volume enclosing all valid positions in this group. | |
Protected Attributes | |
| T | m_x [W] |
| x-coordinates of point positions. m_x[j] = x-coord of point j. | |
| T | m_y [W] |
| y-coordinates of point positions. | |
| T | m_z [W] |
| z-coordinates of point positions. | |
| uint32_t | m_validCount = 0 |
| Number of valid (non-padded) positions in this group (1..W). | |
True SoA (Structure of Arrays) layout for W point positions, enabling SIMD distance evaluation against the whole group at once.
Deliberately carries positions only – no metadata, no orientation. A point has no inside/outside notion, so there is no signedDistance() here, only unsigned distance queries. The one SIMD kernel computes the squared distance from the query point to all W lane positions simultaneously; everything the class exposes is a thin wrapper over it – getDistances2()/ getDistances() return the whole W-lane array, and getMinimumDistance2()/getMaximumDistance2() (and their sqrt counterparts) horizontally reduce it. Metadata, when needed, is carried by the separate PointAoSoA<T, Meta, W> wrapper (see EBGeometry_PointAoSoA.hpp) rather than as a member here, so that a pure position-only distance traversal never has metadata bytes anywhere near its hot data – not merely unused, but physically absent from this type.
new, a container with a custom/pre-C++17-style allocator, placement-new into externally-owned storage, or a malloc'd buffer – you are responsible for ensuring the memory is aligned to alignof(PointSoAT<T, W>); nothing in this class enforces or checks that. | T | Floating-point precision. |
| W | SIMD width: 4 for SSE (128-bit), 8 for AVX (256-bit float) or AVX-512F (512-bit double), 16 for AVX-512F (512-bit float). Defaults to PointSoA::DefaultWidth<T>(), the width that fills one SIMD register exactly for T on the current target ISA – note this default is itself different for float and double (see the table above), so PointSoAT<float> and PointSoAT<double> do not, in general, share a width even both left at their defaults. |
|
noexcept |
Compute the bounding volume enclosing all valid positions in this group.
Requires the group to have already been packed via pack() (1 <= m_validCount <= W).
| BV | Bounding volume type (e.g. AABBT<T>); must be constructible from a std::vector<Vec3T<T>> of positions. |
|
noexcept |
Unsigned distances from a_point to every one of the W lane positions.
The sqrt of each getDistances2() lane; see it for the padding convention. Prefer getDistances2() when only comparisons are needed.
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Squared unsigned distances from a_point to every one of the W lane positions.
This is the group's one SIMD kernel; every other distance query is a wrapper over it. Squared, so sqrt-free – prefer it (and getMinimumDistance2()/getMaximumDistance2()) whenever the caller only needs distances for comparison, not their actual magnitude. All W lanes are returned: padded lanes (indices m_validCount..W-1) repeat the last real position's squared distance, matching pack()'s padding, so a caller iterating lanes should stop at the real count (or, if it lacks that count, de-duplicate – e.g. PointAoSoA pairs each lane with getMetaData()). Requires the group to have already been packed via pack() (1 <= m_validCount <= W).
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Largest unsigned distance from a_point to the farthest position in this group.
The sqrt of getMaximumDistance2(); prefer that when only comparisons are needed.
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Largest squared unsigned distance from a_point to the farthest position in this group.
Horizontal maximum over the real lanes of getDistances2(). Requires the group to have already been packed via pack() (1 <= m_validCount <= W).
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Shortest unsigned distance from a_point to the closest position in this group.
The sqrt of getMinimumDistance2(); prefer that when only comparisons are needed.
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Shortest squared unsigned distance from a_point to the closest position in this group.
Horizontal minimum over the real lanes of getDistances2(). Requires the group to have already been packed via pack() (1 <= m_validCount <= W).
| [in] | a_point | Query point. Must be finite. |
|
noexcept |
Pack a_count positions from a_positions[0..a_count-1] into this SoA group.
Pads lanes a_count..W-1 by repeating the last real position so that all W lanes hold valid data and SIMD loads never read uninitialised memory.
| [in] | a_positions | Source position array with at least a_count elements. Must not be null. |
| [in] | a_count | Number of valid positions to pack. Must satisfy 1 <= a_count <= W. |
|
protected |
Number of valid (non-padded) positions in this group (1..W).
Zero-initialized so that a default-constructed (not-yet-packed) group reliably fails the EBGEOMETRY_EXPECT(m_validCount >= 1) precondition in getDistance()/getDistance2()/ computeBoundingVolume(), rather than reading whatever indeterminate value happened to be there.