EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_TriangleAoSoA.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Robert Marskar <robert.marskar@sintef.no>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
11#ifndef EBGEOMETRY_TRIANGLEAOSOA_HPP
12#define EBGEOMETRY_TRIANGLEAOSOA_HPP
13
14// Std includes
15#include <array>
16#include <cstddef>
17#include <cstdint>
18#include <type_traits>
19
20// Our includes
23#include "EBGeometry_Vec.hpp"
24
25namespace EBGeometry {
26
50template <class T, class Meta, size_t W = TriangleSoA::DefaultWidth<T>()>
52{
53 static_assert(W > 0, "W must be positive");
54 static_assert(std::is_floating_point_v<T>, "TriangleAoSoA requires a floating-point type T");
55
56public:
66 void
68
76 [[nodiscard]] T
77 signedDistance(const Vec3T<T>& a_point) const noexcept;
78
91 [[nodiscard]] T
93
101 [[nodiscard]] const Meta&
102 getMetaData(size_t a_lane) const noexcept;
103
111 template <class BV>
112 [[nodiscard]] BV
114
120
125 std::array<Meta, W> m_metaData;
126
136};
137
138} // namespace EBGeometry
139
140#include "EBGeometry_TriangleAoSoAImplem.hpp"
141
142#endif
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. Used with DCEL tools.
Three-dimensional vector class with arithmetic operators.
Definition EBGeometry_Vec.hpp:225
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_AnalyticDistanceFunctions.hpp:31
Metadata-carrying wrapper around a single TriangleSoAT<T, W>.
Definition EBGeometry_TriangleAoSoA.hpp:52
std::array< Meta, W > m_metaData
Per-lane metadata, physically separate from m_triangles. m_metaData[j] = metadata of triangle j....
Definition EBGeometry_TriangleAoSoA.hpp:125
T signedDistance(const Vec3T< T > &a_point) const noexcept
Evaluate signed distance from a_point to the closest triangle in this group.
void pack(const Triangle< T, Meta > *a_triangles, uint32_t a_count) noexcept
Pack a_count triangles from a_triangles[0..a_count-1] into this group.
const Meta & getMetaData(size_t a_lane) const noexcept
Get the metadata for one lane of this group.
T signedDistance(const Vec3T< T > &a_point, Meta &a_closestMeta) const noexcept
Evaluate signed distance from a_point to the closest triangle and report that triangle's metadata.
BV computeBoundingVolume() const noexcept
Compute the bounding volume enclosing all valid triangles in this group.
TriangleSoAT< T, W > m_triangles
The wrapped, coordinate-only SoA block. SIMD-hot: this is all signedDistance() touches.
Definition EBGeometry_TriangleAoSoA.hpp:119
uint32_t m_validCount
Number of valid (non-padded) triangles in this group (1..W).
Definition EBGeometry_TriangleAoSoA.hpp:135
SoA (Structure of Arrays) layout for W triangles, enabling SIMD evaluation.
Definition EBGeometry_TriangleSoA.hpp:102