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.
 
Array< T, W > getSeparations (const Vec3T< T > &a_center, T a_radius) const noexcept
 Separations between a sphere and every one of the W lane spheres, |c - c_j| - (r + r_j).
 
void rayIntervals (const Vec3T< T > &a_origin, const Vec3T< T > &a_direction, Array< T, W > &a_entry, Array< T, W > &a_exit) const noexcept
 Where a ray runs through each of the W lane spheres: the distances along it at which it enters and leaves the sphere.
 
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.

◆ getSeparations()

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

Separations between a sphere and every one of the W lane spheres, |c - c_j| - (r + r_j).

Negative where the two overlap. The radii are summed before they are subtracted, so the separation of two spheres is the same whichever of them is in the group. Padded lanes repeat the last real sphere's value.

Parameters
[in]a_centerThe sphere's center. Must be finite.
[in]a_radiusThe sphere's radius. Must be finite.
Returns
Per-lane separations, one per W lanes.

◆ 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.

◆ rayIntervals()

template<class T , size_t W = PointSoA::DefaultWidth<T>()>
void EBGeometry::SphereAoSoA< T, W >::rayIntervals ( const Vec3T< T > &  a_origin,
const Vec3T< T > &  a_direction,
Array< T, W > &  a_entry,
Array< T, W > &  a_exit 
) const
noexcept

Where a ray runs through each of the W lane spheres: the distances along it at which it enters and leaves the sphere.

Over the whole line: an entry or exit may be negative, behind the origin. Computed as SphereSDF's ray form computes them, so a sphere of the group is crossed where the same sphere alone is, to rounding. A ray that misses a sphere gets an entry of +infinity and an exit of -infinity, as do padded lanes; one that only touches it gets an entry equal to its exit.

Parameters
[in]a_originRay origin. Must be finite.
[in]a_directionRay direction, of unit length.
[out]a_entryPer-lane entry distances.
[out]a_exitPer-lane exit distances.

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