EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
EBGeometry::BVH::SharedPtrStorage< P > Struct Template Reference

Default storage policy for PackedBVH: primitives stored as std::shared_ptr<const P>, exactly as PackedBVH has always stored them. More...

#include <EBGeometry_BVH.hpp>

Public Types

using StorageType = std::shared_ptr< const P >
 Storage representation: a shared pointer to a const primitive, as PackedBVH has always stored it.
 

Static Public Member Functions

static const Pget (const StorageType &a_stored) noexcept
 Dereference stored element to the primitive it refers to.
 
static void appendTreeLeaf (std::vector< StorageType > &a_dst, const PrimitiveList< P > &a_leafPrims)
 Append one TreeBVH leaf's primitives to PackedBVH's flat primitive array.
 
static void appendAliased (std::vector< StorageType > &a_dst, const std::shared_ptr< std::vector< P > > &a_block)
 Materialise a converting packWith() constructor's single contiguous conversion buffer into PackedBVH's flat primitive array.
 

Detailed Description

template<class P>
struct EBGeometry::BVH::SharedPtrStorage< P >

Default storage policy for PackedBVH: primitives stored as std::shared_ptr<const P>, exactly as PackedBVH has always stored them.

A storage policy is a stateless struct bundling an associated storage representation (StorageType) with the handful of operations PackedBVH needs to build and read it: get() (per-element access, used by every leaf-visit callback), appendTreeLeaf() (copying a TreeBVH leaf's primitives into PackedBVH's flat array during the identity pack() constructor), and appendAliased() (appending a converting packWith() constructor's single contiguous conversion buffer to PackedBVH's flat array). Both appendTreeLeaf() and appendAliased() are appenders: they add to whatever a_dst already holds rather than replacing it, so every policy behaves identically no matter how many times PackedBVH calls them. Swapping the policy changes nothing about tree construction or traversal – TreeBVH itself always stores primitives as shared_ptr, regardless of which policy the PackedBVH built from it uses – only what PackedBVH's own primitive array holds.

Template Parameters
PPrimitive type.

Member Function Documentation

◆ appendAliased()

template<class P >
static void EBGeometry::BVH::SharedPtrStorage< P >::appendAliased ( std::vector< StorageType > &  a_dst,
const std::shared_ptr< std::vector< P > > &  a_block 
)
inlinestatic

Materialise a converting packWith() constructor's single contiguous conversion buffer into PackedBVH's flat primitive array.

Uses the shared_ptr aliasing constructor so every element shares one control block (one allocation for the whole buffer) while still presenting as an independent shared_ptr<const P> per element.

Parameters
[in,out]a_dstPackedBVH's flat primitive array.
[in]a_blockSingle contiguous buffer holding every converted primitive.

◆ appendTreeLeaf()

template<class P >
static void EBGeometry::BVH::SharedPtrStorage< P >::appendTreeLeaf ( std::vector< StorageType > &  a_dst,
const PrimitiveList< P > &  a_leafPrims 
)
inlinestatic

Append one TreeBVH leaf's primitives to PackedBVH's flat primitive array.

Used by PackedBVH's identity pack() constructor. Trivial for this policy: the source leaf's shared_ptrs are copied in as-is.

Parameters
[in,out]a_dstPackedBVH's flat primitive array.
[in]a_leafPrimsOne TreeBVH leaf's primitive list.

◆ get()

template<class P >
static const P & EBGeometry::BVH::SharedPtrStorage< P >::get ( const StorageType a_stored)
inlinestaticnoexcept

Dereference stored element to the primitive it refers to.

Parameters
[in]a_storedStored element.
Returns
Reference to the underlying primitive.

The documentation for this struct was generated from the following file: