EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
EBGeometry_TreeBVH.hpp File Reference

The pointer-based, host-only BVH used for building: TreeBVH, the partitioners and the leaf predicate, and pack()/packWith() into a PackedBVH. More...

#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iterator>
#include <memory>
#include <type_traits>
#include <utility>
#include <vector>
#include "EBGeometry_Array.hpp"
#include "EBGeometry_BoundingVolumes.hpp"
#include "EBGeometry_Macros.hpp"
#include "EBGeometry_Math.hpp"
#include "EBGeometry_PackedBVH.hpp"
#include "EBGeometry_SFC.hpp"
#include "EBGeometry_Vec.hpp"
#include "EBGeometry_TreeBVHImplem.hpp"
#include "EBGeometry_BVHBuild.hpp"
Include dependency graph for EBGeometry_TreeBVH.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  EBGeometry::BVH::TreeBVH< T, P, BV, K >
 Forward declaration of the tree-structured BVH, defined in EBGeometry_TreeBVH.hpp. Needed by LeafPredicate and by PackedBVH's constructor from a TreeBVH. More...
 

Namespaces

namespace  EBGeometry
 Namespace containing all of EBGeometry's functionality.
 
namespace  EBGeometry::BVH
 Namespace for various bounding volume hierarchy (BVH) functionalities.
 
namespace  EBGeometry::BVH::detail
 Build-phase helpers shared by PackedBVH's constructors and static builds. Not part of the public API.
 

Functions

template<class P >
void EBGeometry::BVH::detail::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 EBGeometry::BVH::detail::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 EBGeometry::BVH::detail::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 EBGeometry::BVH::detail::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.
 
template<class T , class P , class BV >
size_t EBGeometry::BVH::SAH2WaySplit (PrimAndBVList< P, BV > &a_list, const size_t a_begin, const size_t a_end, const bool a_longestAxisOnly=false) noexcept
 Internal helper: 2-way binned SAH split on the sub-range [a_begin, a_end).
 
template<class T , class P , class BV >
void EBGeometry::BVH::SAHKWaySplit (PrimAndBVList< P, BV > &a_list, const size_t a_begin, const size_t a_end, const size_t a_K, std::vector< std::pair< size_t, size_t > > &a_groups, const bool a_longestAxisOnly=false)
 Internal helper: recursively split [a_begin, a_end) into a_K groups via 2-way SAH.
 
template<class T , class P , class BV >
size_t EBGeometry::BVH::Midpoint2WaySplit (PrimAndBVList< P, BV > &a_list, const size_t a_begin, const size_t a_end) noexcept
 Internal helper: 2-way spatial-midpoint split on the sub-range [a_begin, a_end).
 
template<class T , class P , class BV >
void EBGeometry::BVH::MidpointKWaySplit (PrimAndBVList< P, BV > &a_list, const size_t a_begin, const size_t a_end, const size_t a_K, std::vector< std::pair< size_t, size_t > > &a_groups)
 Internal helper: recursively split [a_begin, a_end) into a_K groups via 2-way midpoint splits.
 

Variables

template<class X , size_t K>
auto EBGeometry::BVH::EqualCounts
 Utility: split a vector into K almost-equal contiguous chunks.
 
template<class T , class P , class BV , size_t K>
auto EBGeometry::BVH::PrimitiveCentroidPartitioner
 Partitioner that sorts primitives by centroid along the longest axis and splits into K pieces.
 
template<class T , class P , class BV , size_t K>
auto EBGeometry::BVH::BVCentroidPartitioner
 Partitioner that sorts primitives by bounding-volume centroid along the longest axis and splits into K pieces.
 
template<class T , class P , class BV , size_t K, bool LongestAxisOnly = false>
auto EBGeometry::BVH::BinnedSAHPartitioner
 Partitioner using binned SAH with recursive 2-way subdivision into K groups.
 
template<class T , class P , class BV , size_t K>
auto EBGeometry::BVH::MidpointPartitioner
 Partitioner that recursively bisects primitives by spatial midpoint (no sorting).
 
template<class T , class P , class BV , size_t K>
auto EBGeometry::BVH::DefaultLeafPredicate
 Default stop function: stop partitioning when the node holds fewer than K primitives.
 

Detailed Description

The pointer-based, host-only BVH used for building: TreeBVH, the partitioners and the leaf predicate, and pack()/packWith() into a PackedBVH.

The flexible host builder: TreeBVH partitions a list of (primitive, bounding volume) pairs with any partitioner and leaf predicate, then packs into the device-callable PackedBVH (EBGeometry_PackedBVH.hpp). PackedBVH's static builds that partition a primitive list directly, and the constructors pack() calls, are in EBGeometry_BVHBuild.hpp, which this header includes so that pack() works.

Author
Robert Marskar