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::SphereAoSoA< T, W > Struct Template Reference

A group of up to W spheres carrying their cloud indices: a PointAoSoA<T, W> of the centers, and one more lane array of the radii. More...

#include <EBGeometry_SphereAoSoA.hpp>

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

Public Member Functions

void pack (const SphereCloud::Sphere< T > *a_spheres, const uint32_t *a_sphereIds, uint32_t a_count) noexcept
 Pack a_count (sphere, id) pairs into this group.
 
void packUnchecked (const SphereCloud::Sphere< T > *a_spheres, const uint32_t *a_sphereIds, uint32_t a_count) noexcept
 pack() without its always-on checks, for a build that runs on a device.
 
Array< T, W > getSignedDistances (const Vec3T< T > &a_point) const noexcept
 Signed distances from a_point to the surface of every one of the W lane spheres, |p - c| - r.
 
uint32_t getSphereId (size_t a_lane) const noexcept
 Get the id of the sphere in one lane of this group.
 
uint32_t numValid () const noexcept
 Number of real (non-padded) spheres in this group.
 
template<class BV >
BV computeBoundingVolume () const noexcept
 Compute the bounding volume enclosing all valid spheres in this group, each grown by its radius.
 

Protected Attributes

PointAoSoA< T, W > m_centers
 The centers and ids. It also holds the valid-sphere count.
 
Array< T, W > m_radii
 Per-lane radii. m_radii[j] = radius of sphere j.
 

Detailed Description

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

A group of up to W spheres carrying their cloud indices: a PointAoSoA<T, W> of the centers, and one more lane array of the radii.

The leaf primitive of SphereCloudBVH. The centers and ids are a PointAoSoA, so the distance to every center is PointSoAT's SIMD-wide computation, and the radii sit in their own array beside it.

Template Parameters
TFloating-point precision.
WSIMD width; see PointSoAT. Defaults to PointSoA::DefaultWidth<T>().

Member Function Documentation

◆ computeBoundingVolume()

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

Compute the bounding volume enclosing all valid spheres in this group, each grown by its radius.

Template Parameters
BVBounding volume type; must be constructible from a low and a high corner (AABBT<T>, say).
Returns
Bounding volume enclosing every valid sphere.

◆ getSignedDistances()

template<class T , size_t W = PointSoA::DefaultWidth<T>()>
Array< T, W > EBGeometry::SphereAoSoA< T, W >::getSignedDistances ( const Vec3T< T > &  a_point) const
noexcept

Signed distances from a_point to the surface of every one of the W lane spheres, |p - c| - r.

Negative inside a sphere. Padded lanes repeat the last real sphere's value.

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

◆ getSphereId()

template<class T , size_t W = PointSoA::DefaultWidth<T>()>
uint32_t EBGeometry::SphereAoSoA< T, W >::getSphereId ( size_t  a_lane) const
noexcept

Get the id of the sphere in one lane of this group.

Parameters
[in]a_laneLane index. Must satisfy 0 <= a_lane < W (padded lanes return the last real sphere's id; see pack()).
Returns
The id of the sphere at a_lane.

◆ numValid()

template<class T , size_t W = PointSoA::DefaultWidth<T>()>
uint32_t EBGeometry::SphereAoSoA< T, W >::numValid ( ) const
inlinenoexcept

Number of real (non-padded) spheres in this group.

Returns
The count passed to pack(), 1..W (0 before pack()).

◆ pack()

template<class T , size_t W = PointSoA::DefaultWidth<T>()>
void EBGeometry::SphereAoSoA< T, W >::pack ( const SphereCloud::Sphere< T > *  a_spheres,
const uint32_t *  a_sphereIds,
uint32_t  a_count 
)
noexcept

Pack a_count (sphere, id) pairs into this group.

Pads lanes a_count..W-1 by repeating the last real sphere and id, as PointAoSoA::pack() does, so all W lanes hold valid data.

Parameters
[in]a_spheresSource sphere array with at least a_count elements. Must not be null; every center and radius finite, every radius at least 0.
[in]a_sphereIdsSource id array (typically cloud indices), same order and length as a_spheres. Must not be null.
[in]a_countNumber of valid (sphere, id) pairs to pack. Must satisfy 1 <= a_count <= W.

◆ packUnchecked()

template<class T , size_t W = PointSoA::DefaultWidth<T>()>
void EBGeometry::SphereAoSoA< T, W >::packUnchecked ( const SphereCloud::Sphere< T > *  a_spheres,
const uint32_t *  a_sphereIds,
uint32_t  a_count 
)
noexcept

pack() without its always-on checks, for a build that runs on a device.

The caller guarantees what pack() checks (checked here only with assertions on).

Parameters
[in]a_spheresSource sphere array with at least a_count elements.
[in]a_sphereIdsSource id array, same order and length as a_spheres.
[in]a_countNumber of valid (sphere, id) pairs to pack.

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