27#ifndef EBGEOMETRY_PODVECTOR_HPP
28#define EBGEOMETRY_PODVECTOR_HPP
107static_assert(std::is_trivially_copyable_v<PODSpan<float>>,
"PODSpan<float> must be trivially copyable");
108static_assert(std::is_trivially_copyable_v<PODSpan<double>>,
"PODSpan<double> must be trivially copyable");
120 static_assert(std::is_trivially_copyable_v<T>,
"PODVector<T>: T must be trivially copyable (device-visible storage)");
122 "PODVector<T>: T's alignment exceeds the Pool's base alignment, so no reservation can align it");
156 data(
void* a_base)
const noexcept
158 return reinterpret_cast<T*
>(
static_cast<unsigned char*
>(a_base) +
m_offset);
168 data(
const void* a_base)
const noexcept
170 return reinterpret_cast<const T*
>(
static_cast<const unsigned char*
>(a_base) +
m_offset);
181 at(
void* a_base, uint32_t a_i)
const noexcept
185 return this->
data(a_base)[a_i];
196 at(
const void* a_base, uint32_t a_i)
const noexcept
200 return this->
data(a_base)[a_i];
268 assign(
void* a_base,
const T* a_src, uint32_t a_count)
271 "PODVector::assign: the element count must not exceed the reserved capacity (%u > %u)",
279 std::memcpy(this->
data(a_base), a_src,
static_cast<size_t>(a_count) *
sizeof(T));
293 bind(
void* a_base)
const noexcept
306 bind(
const void* a_base)
const noexcept
312static_assert(
sizeof(PODVector<float>) == 16,
"PODVector layout must be 8 (offset) + 4 (size) + 4 (capacity)");
313static_assert(
sizeof(PODVector<double>) == 16,
"PODVector layout must be 8 (offset) + 4 (size) + 4 (capacity)");
314static_assert(std::is_trivially_copyable_v<PODVector<float>>,
"PODVector<float> must be trivially copyable");
315static_assert(std::is_trivially_copyable_v<PODVector<double>>,
"PODVector<double> must be trivially copyable");
GPU portability layer: host/device decoration macros and backend detection.
#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
Utility macros for EBGeometry.
#define EBGEOMETRY_REQUIRE(cond,...)
Always-on check of user input and one-time host setup.
Definition EBGeometry_Macros.hpp:84
#define EBGEOMETRY_EXPECT(cond)
Runtime precondition assertion for EBGeometry.
Definition EBGeometry_Macros.hpp:155
Growable bump arena for the GPU memory foundation.
Growable bump arena over a MemoryResource.
Definition EBGeometry_Pool.hpp:183
uint64_t reserve(size_t a_count, size_t a_elemSize, size_t a_alignment)
Bump-reserve a_count * a_elemSize bytes aligned to a_alignment.
Namespace containing all of EBGeometry's functionality.
Definition EBGeometry_Affine.hpp:26
constexpr size_t PoolBaseAlign
Block-base alignment for every Pool, in bytes.
Definition EBGeometry_MemoryResource.hpp:52
Raw pointer + size view into a Pool block, for hot inner loops.
Definition EBGeometry_PODVector.hpp:52
T * begin() const noexcept
Iterator to the first element.
Definition EBGeometry_PODVector.hpp:79
T * m_ptr
Raw pointer to element 0 inside the pool's block, as resolved when the span was bound.
Definition EBGeometry_PODVector.hpp:54
uint32_t size() const noexcept
Number of elements.
Definition EBGeometry_PODVector.hpp:101
uint32_t m_size
Number of elements.
Definition EBGeometry_PODVector.hpp:57
T * end() const noexcept
Iterator past the last element.
Definition EBGeometry_PODVector.hpp:90
T & operator[](uint32_t a_i) const noexcept
Element access.
Definition EBGeometry_PODVector.hpp:66
Placement-independent descriptor of a POD array inside a Pool.
Definition EBGeometry_PODVector.hpp:119
void assign(void *a_base, const T *a_src, uint32_t a_count)
Bulk-fill the array from a contiguous host source.
Definition EBGeometry_PODVector.hpp:268
void reserveFrom(Pool &a_pool, uint32_t a_capacity)
Reserve a_capacity slots from a_pool, aligned to alignof(T).
Definition EBGeometry_PODVector.hpp:142
uint64_t endByte() const noexcept
One past the last byte this array occupies, measured from the pool base.
Definition EBGeometry_PODVector.hpp:225
T & at(void *a_base, uint32_t a_i) const noexcept
Mutable element access against a_base.
Definition EBGeometry_PODVector.hpp:181
uint64_t m_offset
Byte offset of element 0 from Pool::base.
Definition EBGeometry_PODVector.hpp:125
PODSpan< const T > bind(const void *a_base) const noexcept
Bind a const raw-pointer view for a hot loop.
Definition EBGeometry_PODVector.hpp:306
PODSpan< T > bind(void *a_base) const noexcept
Bind a mutable raw-pointer view for a hot loop.
Definition EBGeometry_PODVector.hpp:293
uint32_t m_capacity
Reserved element slots (fixed after reserveFrom; never reallocates).
Definition EBGeometry_PODVector.hpp:131
T * data(void *a_base) const noexcept
Mutable pointer to element 0 against a_base.
Definition EBGeometry_PODVector.hpp:156
const T & at(const void *a_base, uint32_t a_i) const noexcept
Const element access against a_base.
Definition EBGeometry_PODVector.hpp:196
bool empty() const noexcept
Whether the array is empty.
Definition EBGeometry_PODVector.hpp:236
uint32_t size() const noexcept
Number of constructed elements.
Definition EBGeometry_PODVector.hpp:209
void push_back(void *a_base, const T &a_value)
Append one element into the pre-reserved capacity.
Definition EBGeometry_PODVector.hpp:250
uint32_t m_size
Number of constructed elements.
Definition EBGeometry_PODVector.hpp:128
const T * data(const void *a_base) const noexcept
Const pointer to element 0 against a_base.
Definition EBGeometry_PODVector.hpp:168