11#ifndef EBGEOMETRY_TRIANGLEAOSOA_HPP
12#define EBGEOMETRY_TRIANGLEAOSOA_HPP
48template <class T, size_t W = TriangleSoA::DefaultWidth<T>()>
51 static_assert(W > 0,
"W must be positive");
52 static_assert(std::is_floating_point_v<T>,
"TriangleAoSoA requires a floating-point type T");
118 return m_triangles.signedDistanceAt(a_lane, a_point);
154 const Vec3T<T>& a_origin,
const Vec3T<T>& a_direction, T a_tMin, T a_tMax, T* a_crossings)
const noexcept;
184 getVertex(
size_t a_lane,
size_t a_vertex)
const noexcept
229#include "EBGeometry_TriangleAoSoAImplem.hpp"
A fixed-size array that compiles for both host and device.
#define EBGEOMETRY_HOST_DEVICE
Mark a function as callable from both host and device code (no-op on host compilers).
Definition EBGeometry_GPU.hpp:80
#define EBGEOMETRY_HOST
Mark a function as callable from host code only (no-op on host compilers).
Definition EBGeometry_GPU.hpp:83
Declaration of SoA triangle group for SIMD signed-distance evaluation.
Declaration of a triangle class with signed distance functionality.
Declaration of 2D and 3D point/vector classes with templated precision, and free functions on them.
Triangle class with signed distance functionality.
Definition EBGeometry_Triangle.hpp:52
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:258
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
Fixed-size array with host- and device-callable members.
Definition EBGeometry_Array.hpp:33
Face-id-carrying wrapper around a single TriangleSoAT<T, W>.
Definition EBGeometry_TriangleAoSoA.hpp:50
Vec3T< T > getVertex(size_t a_lane, size_t a_vertex) const noexcept
Vertex a_vertex of the triangle in lane a_lane (padded lanes repeat the last real triangle).
Definition EBGeometry_TriangleAoSoA.hpp:184
uint32_t m_validCount
Number of valid (non-padded) triangles in this group (1..W).
Definition EBGeometry_TriangleAoSoA.hpp:221
T rayCrossing(const Vec3T< T > &a_origin, const Vec3T< T > &a_direction, T a_tMin, T a_tMax, uint32_t &a_faceId, Vec3T< T > &a_normal) const noexcept
Where a ray first crosses a triangle in this group, with that triangle's face id and normal.
Array< uint32_t, W > m_faceIds
Per-lane face ids, physically separate from m_triangles. m_faceIds[j] = face id of triangle j....
Definition EBGeometry_TriangleAoSoA.hpp:211
T signedDistanceAt(uint32_t a_lane, const Vec3T< T > &a_point) const noexcept
One lane's signed distance (TriangleSoAT::signedDistanceAt()).
Definition EBGeometry_TriangleAoSoA.hpp:116
TriangleSoAT< T, W > m_triangles
The wrapped, coordinate-only SoA block. SIMD-hot: this is all signedDistance() touches.
Definition EBGeometry_TriangleAoSoA.hpp:205
BV computeBoundingVolume() const noexcept
Compute the bounding volume enclosing all valid triangles in this group.
T signedDistance(const Vec3T< T > &a_point, uint32_t &a_closestFaceId) const noexcept
Evaluate signed distance from a_point to the closest triangle and report that triangle's face id.
void pack(const Triangle< T > *a_triangles, uint32_t a_count) noexcept
Pack a_count triangles from a_triangles[0..a_count-1] into this group.
void rayCrossings(const Vec3T< T > &a_origin, const Vec3T< T > &a_direction, T a_tMin, T a_tMax, T *a_crossings) const noexcept
Where a ray crosses each triangle in this group.
Vec3T< T > getNormal(size_t a_lane) const noexcept
The unit normal of one lane's triangle.
uint32_t getFaceId(size_t a_lane) const noexcept
Get the face id for one lane of this group.
uint32_t nearestLane(const Vec3T< T > &a_point, T &a_d2) const noexcept
The lane nearest a point and its squared unsigned distance (TriangleSoAT::nearestLane()).
Definition EBGeometry_TriangleAoSoA.hpp:103
T signedDistance(const Vec3T< T > &a_point) const noexcept
Evaluate signed distance from a_point to the closest triangle in this group.
SoA (Structure of Arrays) layout for W triangles, enabling SIMD evaluation.
Definition EBGeometry_TriangleSoA.hpp:142