EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Functions
EBGeometry::BVH::detail Namespace Reference

Build-phase helpers shared by PackedBVH's constructors and static builds. Not part of the public API. More...

Functions

template<class P >
void appendTreeLeaf (std::vector< P > &a_dst, const PrimitiveList< P > &a_leafPrims)
 Append one TreeBVH leaf's primitives to a flat primitive array under construction.
 
template<class List , size_t K>
void requireNonEmptyPartitions (const Array< List, K > &a_partitions, const size_t a_numInput, const char *a_who)
 Abort unless every partition a partitioner returned holds at least one primitive.
 
template<class P >
void appendAliased (std::vector< P > &a_dst, const std::shared_ptr< std::vector< P > > &a_block)
 Materialise a single contiguous buffer into a flat primitive array under construction.
 
void requireLeafSetting (const char *a_who, const Construction a_construction, const ConstructionOptions &a_options) noexcept
 Abort unless the leaf-size setting that a_construction reads is positive.
 

Detailed Description

Build-phase helpers shared by PackedBVH's constructors and static builds. Not part of the public API.

Function Documentation

◆ appendAliased()

template<class P >
void EBGeometry::BVH::detail::appendAliased ( std::vector< P > &  a_dst,
const std::shared_ptr< std::vector< P > > &  a_block 
)
inline

Materialise a single contiguous buffer into a flat primitive array under construction.

Appends a_block to a_dst, so the contract holds regardless of how many times it is called. When a_dst is still empty – the case for PackedBVH's single-call direct builds and its converting constructor – it takes the fast path of stealing the already-contiguous buffer wholesale, with no per-element move; otherwise it move-appends each element.

Template Parameters
PPrimitive type.
Parameters
[in,out]a_dstFlat primitive array under construction.
[in]a_blockSingle contiguous buffer holding every element to append.

◆ appendTreeLeaf()

template<class P >
void EBGeometry::BVH::detail::appendTreeLeaf ( std::vector< P > &  a_dst,
const PrimitiveList< P > &  a_leafPrims 
)
inline

Append one TreeBVH leaf's primitives to a flat primitive array under construction.

Used by PackedBVH's identity pack() constructor and by buildTopDown(), both of which read TreeBVH leaves holding shared_ptr<const P>; this dereferences and copies each one by value. Appends to whatever a_dst already holds, so the contract is the same no matter how many leaves are packed.

Template Parameters
PPrimitive type.
Parameters
[in,out]a_dstFlat primitive array under construction.
[in]a_leafPrimsOne TreeBVH leaf's primitive list.

◆ requireLeafSetting()

void EBGeometry::BVH::detail::requireLeafSetting ( const char *  a_who,
const Construction  a_construction,
const ConstructionOptions &  a_options 
)
inlinenoexcept

Abort unless the leaf-size setting that a_construction reads is positive.

Each preset construction method reads one field of ConstructionOptions; this checks that one, in every build. ClusterSAH's ClusterSpec is checked by PackedBVH::buildClusterSAH() itself, and a value outside Construction is left to the caller's own check.

Parameters
[in]a_whoClass being built, for the message.
[in]a_constructionPreset construction method.
[in]a_optionsLeaf-size settings.

◆ requireNonEmptyPartitions()

template<class List , size_t K>
void EBGeometry::BVH::detail::requireNonEmptyPartitions ( const Array< List, K > &  a_partitions,
const size_t  a_numInput,
const char *  a_who 
)
inline

Abort unless every partition a partitioner returned holds at least one primitive.

An empty partition would become a leaf with no primitives, which the packed layout cannot represent: a node with no primitives reads as an interior node. The built-in partitioners never return one; a caller-supplied partitioner might, and this catches it at build time, in every build, where it is cheap and the message can say which call produced it.

Template Parameters
ListPartition type (a list of primitives with their bounding volumes).
KNumber of partitions.
Parameters
[in]a_partitionsPartitions returned by the partitioner.
[in]a_numInputNumber of primitives the partitioner was given.
[in]a_whoName of the calling builder, for the message.