EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
EBGeometry_PointAoSoA.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_POINTAOSOA_HPP
12#define EBGEOMETRY_POINTAOSOA_HPP
13
14// Std includes
15#include <array>
16#include <cstddef>
17#include <cstdint>
18#include <type_traits>
19
20// Our includes
22#include "EBGeometry_Vec.hpp"
23
24namespace EBGeometry {
25
42template <class T, class Meta, size_t W = PointSoA::DefaultWidth<T>()>
44{
45 static_assert(W > 0, "W must be positive");
46 static_assert(std::is_floating_point_v<T>, "PointAoSoA requires a floating-point type T");
47
48public:
59 void
61
70 [[nodiscard]] std::array<T, W>
71 getDistances2(const Vec3T<T>& a_point) const noexcept;
72
79 [[nodiscard]] std::array<T, W>
80 getDistances(const Vec3T<T>& a_point) const noexcept;
81
90 [[nodiscard]] T
91 getMinimumDistance2(const Vec3T<T>& a_point) const noexcept;
92
99 [[nodiscard]] T
100 getMinimumDistance(const Vec3T<T>& a_point) const noexcept;
101
108 [[nodiscard]] T
109 getMaximumDistance2(const Vec3T<T>& a_point) const noexcept;
110
117 [[nodiscard]] T
118 getMaximumDistance(const Vec3T<T>& a_point) const noexcept;
119
127 [[nodiscard]] const Meta&
128 getMetaData(size_t a_lane) const noexcept;
129
137 template <class BV>
138 [[nodiscard]] BV
140
147
152 std::array<Meta, W> m_metaData;
153
162};
163
164} // namespace EBGeometry
165
166#include "EBGeometry_PointAoSoAImplem.hpp"
167
168#endif
Declaration of a true SoA point-position group for SIMD nearest-neighbor evaluation.
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 PointSoAT<T, W>.
Definition EBGeometry_PointAoSoA.hpp:44
BV computeBoundingVolume() const noexcept
Compute the bounding volume enclosing all valid points in this group.
T getMaximumDistance(const Vec3T< T > &a_point) const noexcept
Largest unsigned distance from a_point to the farthest point in this group.
std::array< Meta, W > m_metaData
Per-lane metadata, physically separate from m_positions. m_metaData[j] = metadata of point j....
Definition EBGeometry_PointAoSoA.hpp:152
const Meta & getMetaData(size_t a_lane) const noexcept
Get the metadata for one lane of this group.
std::array< T, W > getDistances(const Vec3T< T > &a_point) const noexcept
Unsigned distances from a_point to every one of the W lane points.
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.
uint32_t m_validCount
Number of valid (non-padded) points in this group (1..W).
Definition EBGeometry_PointAoSoA.hpp:161
T getMinimumDistance(const Vec3T< T > &a_point) const noexcept
Shortest unsigned distance from a_point to the closest point in this group.
T getMinimumDistance2(const Vec3T< T > &a_point) const noexcept
Shortest squared unsigned distance from a_point to the closest point in this group.
T getMaximumDistance2(const Vec3T< T > &a_point) const noexcept
Largest squared unsigned distance from a_point to the farthest point in this group.
PointSoAT< T, W > m_positions
The wrapped, position-only SoA block. SIMD-hot: this is all getDistance()/ getDistance2() ever touch.
Definition EBGeometry_PointAoSoA.hpp:146
std::array< T, W > getDistances2(const Vec3T< T > &a_point) const noexcept
Squared unsigned distances from a_point to every one of the W lane points.
True SoA (Structure of Arrays) layout for W point positions, enabling SIMD distance evaluation agains...
Definition EBGeometry_PointSoA.hpp:104