EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
EBGeometry::CSGDetail Namespace Reference

Internal helpers shared by BVHUnion and BVHSmoothUnion. More...

Classes

struct  ArraysOf
 What a union of several types adds to the one-type layout: its per-type arrays. Empty for one type, whose leaves hold the primitives themselves, so that a union of one type holds nothing but its two BVHs. More...
 
struct  ArraysOf< P >
 A union of one type has no per-type arrays. More...
 
struct  BoxPrecision
 The precision of a primitive type: the T of the box its computeBoundingVolume() returns. More...
 
struct  BoxPrecision< BoundingVolumes::AABBT< T > >
 The precision of an AABBT<T>. More...
 
struct  LeafOf
 What a union's BVH leaves hold: the primitive itself for one type, a MemberRef for several. More...
 
struct  LeafOf< P >
 What a union of one type's BVH leaves hold: the primitive, as stored. More...
 
struct  MemberRef
 A leaf of a union of several primitive types: the primitive's type, and its index in that type's array. More...
 
struct  StoredAs
 How a BVH union stores a primitive of type P: as is, or, for a pool-resident handle, as the handle's layout. More...
 
struct  StoredAs< P, true >
 How a BVH union stores a pool-resident handle: as its layout. More...
 
struct  UnionArrays
 The arrays of a union of several primitive types, one per type in the order given: a recursive list, so that it stays trivially copyable and device-visible. More...
 
struct  UnionArrays< P, Ps... >
 The arrays of a union of several primitive types: the first type's, and the rest. More...
 
struct  UnionParts
 What a BVH union is built into: a BVH over the primitives whose bounding box is bounded, and a single leaf (or nothing) holding those whose box is unbounded in some direction. More...
 

Typedefs

template<class P >
using Stored = typename StoredAs< P >::type
 Shorthand for the type a BVH union stores for a primitive of type P.
 
template<class... Ps>
using Leaf = typename LeafOf< Ps... >::type
 Shorthand for what a union's BVH leaves hold.
 
template<class P >
using PrimitivePrecision = typename BoxPrecision< std::decay_t< decltype(std::declval< const P & >().computeBoundingVolume())> >::type
 The precision of primitive type P, for the unions' deduction guides.
 

Functions

template<class P >
Stored< P > toStored (const P &a_primitive) noexcept
 Convert a primitive to the form a BVH union stores.
 
template<class P >
P fromStored (const Stored< P > &a_stored, const PoolLocation &a_location) noexcept
 The primitive a stored entry stands for, resolving against a_location.
 
template<class F , class P , class... Ps>
auto visitArrays (const UnionArrays< P, Ps... > &a_arrays, const uint32_t a_type, const uint32_t a_index, const PoolLocation &a_location, F &&a_f) noexcept
 Call a_f with the primitive a MemberRef stands for, testing its type against the arrays' types in order (the last is taken without a test).
 

Variables

template<class T , class... Ps>
constexpr bool hasContainers = (hasSurfaces<Ps, T> || ...)
 Whether a union holds members that are containers themselves (see hasSurfaces), whose surfaces it numbers through a table of first surfaces.
 
template<class P , class T , class = void>
constexpr bool hasPrecision = true
 Whether a primitive type is of precision T: true if its computeBoundingVolume() returns an AABBT<T>, and for a type without one (a one-type union given the caller's boxes), which says nothing.
 
template<class X >
constexpr bool isBox = false
 Whether X is a box, which an array of primitives never holds: keeps the deduction guide for several types from taking a one-type union's box array for a second type.
 
template<class X >
constexpr bool isVector = false
 Whether X is a std::vector: keeps the smooth unions' deduction guides that take a blend from taking the first array for one.
 
template<class... Ps>
constexpr DistanceQuality unionQuality
 The weakest distance quality among primitive types: not a distance if any is not, else a bound.
 

Detailed Description

Internal helpers shared by BVHUnion and BVHSmoothUnion.

Typedef Documentation

◆ Leaf

template<class... Ps>
using EBGeometry::CSGDetail::Leaf = typedef typename LeafOf<Ps...>::type

Shorthand for what a union's BVH leaves hold.

Template Parameters
PsPrimitive types.

◆ PrimitivePrecision

template<class P >
using EBGeometry::CSGDetail::PrimitivePrecision = typedef typename BoxPrecision<std::decay_t<decltype(std::declval<const P&>().computeBoundingVolume())> >::type

The precision of primitive type P, for the unions' deduction guides.

Template Parameters
PPrimitive type.

◆ Stored

template<class P >
using EBGeometry::CSGDetail::Stored = typedef typename StoredAs<P>::type

Shorthand for the type a BVH union stores for a primitive of type P.

Template Parameters
PPrimitive type.

Function Documentation

◆ fromStored()

template<class P >
P EBGeometry::CSGDetail::fromStored ( const Stored< P > &  a_stored,
const PoolLocation &  a_location 
)
inlinenoexcept

The primitive a stored entry stands for, resolving against a_location.

A pool-resident primitive is rebuilt from its layout and the union's own location, so it resolves against the same pool the union does: the host pool, a host mirror or a device mirror. Any other primitive is returned as stored.

Template Parameters
PPrimitive type.
Parameters
[in]a_storedPrimitive as stored in the union's BVH.
[in]a_locationThe union's pool location.
Returns
The primitive.

◆ toStored()

template<class P >
Stored< P > EBGeometry::CSGDetail::toStored ( const P &  a_primitive)
inlinenoexcept

Convert a primitive to the form a BVH union stores.

Template Parameters
PPrimitive type.
Parameters
[in]a_primitivePrimitive.
Returns
The primitive, or its layout if it is a pool-resident handle.

◆ visitArrays()

template<class F , class P , class... Ps>
auto EBGeometry::CSGDetail::visitArrays ( const UnionArrays< P, Ps... > &  a_arrays,
const uint32_t  a_type,
const uint32_t  a_index,
const PoolLocation &  a_location,
F &&  a_f 
)
inlinenoexcept

Call a_f with the primitive a MemberRef stands for, testing its type against the arrays' types in order (the last is taken without a test).

Internal helper; not part of the public API.

Template Parameters
FCallable on each primitive type, returning the same type for all.
PFirst primitive type of the arrays.
PsThe others.
Parameters
[in]a_arraysThe arrays, from the type a_type counts from.
[in]a_typeThe type's index among these arrays.
[in]a_indexThe primitive's index in its type's array.
[in]a_locationThe union's location, which its arrays and any pool-resident primitive resolve against.
[in]a_fWhat to call.
Returns
What a_f returns.

Variable Documentation

◆ hasContainers

template<class T , class... Ps>
constexpr bool EBGeometry::CSGDetail::hasContainers = (hasSurfaces<Ps, T> || ...)
inlineconstexpr

Whether a union holds members that are containers themselves (see hasSurfaces), whose surfaces it numbers through a table of first surfaces.

Internal helper; not part of the public API.

Template Parameters
TFloating-point precision.
PsPrimitive types.

◆ hasPrecision

template<class P , class T , class = void>
constexpr bool EBGeometry::CSGDetail::hasPrecision = true
inlineconstexpr

Whether a primitive type is of precision T: true if its computeBoundingVolume() returns an AABBT<T>, and for a type without one (a one-type union given the caller's boxes), which says nothing.

Template Parameters
PPrimitive type.
TFloating-point precision.

◆ isBox

template<class X >
constexpr bool EBGeometry::CSGDetail::isBox< BoundingVolumes::AABBT< T > > = false
inlineconstexpr

Whether X is a box, which an array of primitives never holds: keeps the deduction guide for several types from taking a one-type union's box array for a second type.

An AABBT is a box.

Template Parameters
XType to inspect.
TFloating-point precision.

◆ isVector

template<class X >
constexpr bool EBGeometry::CSGDetail::isVector = false
inlineconstexpr

Whether X is a std::vector: keeps the smooth unions' deduction guides that take a blend from taking the first array for one.

Template Parameters
XType to inspect.

◆ unionQuality

template<class... Ps>
constexpr DistanceQuality EBGeometry::CSGDetail::unionQuality
inlineconstexpr
Initial value:
=
((distanceQualityOf<Ps> == DistanceQuality::NotADistance) || ...) ? DistanceQuality::NotADistance
: DistanceQuality::Bound

The weakest distance quality among primitive types: not a distance if any is not, else a bound.

Template Parameters
PsPrimitive types.