EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
EBGeometry::PointAoSoA< T, Meta, W > Struct Template Reference

Metadata-carrying wrapper around a single PointSoAT<T, W>. More...

#include <EBGeometry_PointAoSoA.hpp>

Collaboration diagram for EBGeometry::PointAoSoA< T, Meta, W >:
Collaboration graph
[legend]

Public Member Functions

void pack (const Vec3T< T > *a_positions, const Meta *a_metaData, uint32_t a_count) noexcept
 Pack a_count (position, metadata) pairs into this group.
 
std::array< T, WgetDistances2 (const Vec3T< T > &a_point) const noexcept
 Squared unsigned distances from a_point to every one of the W lane points.
 
std::array< T, WgetDistances (const Vec3T< T > &a_point) const noexcept
 Unsigned distances from a_point to every one of the W lane points.
 
getMinimumDistance2 (const Vec3T< T > &a_point) const noexcept
 Shortest squared unsigned distance from a_point to the closest point in this group.
 
getMinimumDistance (const Vec3T< T > &a_point) const noexcept
 Shortest unsigned distance from a_point to the closest point in this group.
 
getMaximumDistance2 (const Vec3T< T > &a_point) const noexcept
 Largest squared unsigned distance from a_point to the farthest point in this group.
 
getMaximumDistance (const Vec3T< T > &a_point) const noexcept
 Largest unsigned distance from a_point to the farthest point in this group.
 
const MetagetMetaData (size_t a_lane) const noexcept
 Get the metadata for one lane of this group.
 
template<class BV >
BV computeBoundingVolume () const noexcept
 Compute the bounding volume enclosing all valid points in this group.
 

Protected Attributes

PointSoAT< T, Wm_positions
 The wrapped, position-only SoA block. SIMD-hot: this is all getDistance()/ getDistance2() ever touch.
 
std::array< Meta, Wm_metaData
 Per-lane metadata, physically separate from m_positions. m_metaData[j] = metadata of point j. Never read by getDistance()/getDistance2().
 
uint32_t m_validCount = 0
 Number of valid (non-padded) points in this group (1..W).
 

Detailed Description

template<class T, class Meta, size_t W = PointSoA::DefaultWidth<T>()>
struct EBGeometry::PointAoSoA< T, Meta, W >

Metadata-carrying wrapper around a single PointSoAT<T, W>.

Structurally this is an AoSoA (Array of Structures of Arrays): PointSoAT<T, W> itself is true SoA (one flat array per coordinate, no per-point structure at all), and PointAoSoA adds exactly one more member – a std::array<Meta, W> – alongside it. The two are never merged or interleaved: the distance queries (getMinimumDistance2(), getMaximumDistance2(), getDistances2(), and their sqrt forms – all delegated straight through to the embedded PointSoAT) never read m_metaData at all, so a pure position-only distance traversal over PointAoSoA-packed leaves touches exactly the same bytes it would touch over bare PointSoAT-packed leaves – metadata is only ever read afterward, once a query already knows which lane (and therefore which point) it cares about, via getMetaData().

Template Parameters
TFloating-point precision.
MetaUser-defined metadata type stored with each point.
WSIMD width; see PointSoAT. Defaults to PointSoA::DefaultWidth<T>(), matching PointSoAT's own default.

Member Function Documentation

◆ computeBoundingVolume()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
template<class BV >
BV EBGeometry::PointAoSoA< T, Meta, W >::computeBoundingVolume ( ) const
noexcept

Compute the bounding volume enclosing all valid points in this group.

Delegates entirely to the embedded PointSoAT<T, W>.

Template Parameters
BVBounding volume type (e.g. AABBT<T>); must be constructible from a std::vector<Vec3T<T>> of point positions.
Returns
Bounding volume enclosing all valid point positions.

◆ getDistances()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
std::array< T, W > EBGeometry::PointAoSoA< T, Meta, W >::getDistances ( const Vec3T< T > &  a_point) const
noexcept

Unsigned distances from a_point to every one of the W lane points.

Delegates to PointSoAT<T, W>::getDistances(); the sqrt of each getDistances2() lane.

Parameters
[in]a_pointQuery point. Must be finite.
Returns
Per-lane distances, one per W lanes.

◆ getDistances2()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
std::array< T, W > EBGeometry::PointAoSoA< T, Meta, W >::getDistances2 ( const Vec3T< T > &  a_point) const
noexcept

Squared unsigned distances from a_point to every one of the W lane points.

Delegates entirely to the embedded PointSoAT<T, W>; never touches m_metaData. Padded lanes repeat the last real point's value – pair each lane with getMetaData() to identify (and de-duplicate) it, e.g. for a k-nearest-neighbor scan. See PointSoAT::getDistances2().

Parameters
[in]a_pointQuery point. Must be finite.
Returns
Per-lane squared distances, one per W lanes.

◆ getMaximumDistance()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
T EBGeometry::PointAoSoA< T, Meta, W >::getMaximumDistance ( const Vec3T< T > &  a_point) const
noexcept

Largest unsigned distance from a_point to the farthest point in this group.

Delegates to PointSoAT<T, W>::getMaximumDistance(); the sqrt of getMaximumDistance2().

Parameters
[in]a_pointQuery point. Must be finite.
Returns
Distance from a_point to the farthest valid point in this group.

◆ getMaximumDistance2()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
T EBGeometry::PointAoSoA< T, Meta, W >::getMaximumDistance2 ( const Vec3T< T > &  a_point) const
noexcept

Largest squared unsigned distance from a_point to the farthest point in this group.

Delegates entirely to the embedded PointSoAT<T, W>; never touches m_metaData.

Parameters
[in]a_pointQuery point. Must be finite.
Returns
Squared distance from a_point to the farthest valid point in this group.

◆ getMetaData()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
const Meta & EBGeometry::PointAoSoA< T, Meta, W >::getMetaData ( size_t  a_lane) const
noexcept

Get the metadata for one lane of this group.

Requires the group to have already been packed via pack() (1 <= m_validCount <= W).

Parameters
[in]a_laneLane index. Must satisfy 0 <= a_lane < W (padded lanes return the last real point's metadata – see pack()).
Returns
Metadata for the point at a_lane.

◆ getMinimumDistance()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
T EBGeometry::PointAoSoA< T, Meta, W >::getMinimumDistance ( const Vec3T< T > &  a_point) const
noexcept

Shortest unsigned distance from a_point to the closest point in this group.

Delegates to PointSoAT<T, W>::getMinimumDistance(); the sqrt of getMinimumDistance2().

Parameters
[in]a_pointQuery point. Must be finite.
Returns
Distance from a_point to the closest valid point in this group.

◆ getMinimumDistance2()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
T EBGeometry::PointAoSoA< T, Meta, W >::getMinimumDistance2 ( const Vec3T< T > &  a_point) const
noexcept

Shortest squared unsigned distance from a_point to the closest point in this group.

Delegates entirely to the embedded PointSoAT<T, W>; never touches m_metaData. Avoids the sqrt that getMinimumDistance() pays – prefer it whenever the caller only needs the distance for comparison, not its actual magnitude.

Parameters
[in]a_pointQuery point. Must be finite.
Returns
Squared distance from a_point to the closest valid point in this group.

◆ pack()

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
void EBGeometry::PointAoSoA< T, Meta, W >::pack ( const Vec3T< T > *  a_positions,
const Meta a_metaData,
uint32_t  a_count 
)
noexcept

Pack a_count (position, metadata) pairs into this group.

Pads lanes a_count..W-1 by repeating the last real position and metadata, matching PointSoAT::pack()'s own padding convention, so all W lanes hold valid data.

Parameters
[in]a_positionsSource position array with at least a_count elements. Must not be null.
[in]a_metaDataSource metadata array with at least a_count elements, same order and length as a_positions. Must not be null.
[in]a_countNumber of valid (position, metadata) pairs to pack. Must satisfy 1 <= a_count <= W.

Member Data Documentation

◆ m_validCount

template<class T , class Meta , size_t W = PointSoA::DefaultWidth<T>()>
uint32_t EBGeometry::PointAoSoA< T, Meta, W >::m_validCount = 0
protected

Number of valid (non-padded) points 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 getMetaData(), rather than reading whatever indeterminate value happened to be there. (getDistance()/getDistance2() get the same protection for free from the embedded PointSoAT's own m_validCount.)


The documentation for this struct was generated from the following file: