|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
The state and build of a linear BVH over a cloud of primitives (points or spheres), built where its pool is; the base of PointCloudBVH and SphereCloudBVH. More...
#include <EBGeometry_CloudBVH.hpp>


Classes | |
| struct | Scratch |
| The scratch arrays of a build: in the BVH's pool for a BVH with room for a rebuild, and in a pool of their own, released after the build, otherwise. More... | |
| struct | Sizes |
| The largest array sizes any cloud of a given size can need; see PointCloudBVH's build steps. More... | |
Public Types | |
| using | Item = typename Prim::Item |
| What a source of the primitives returns. | |
| using | Group = typename Prim::Group |
| The SoA leaf primitive: a group of up to W primitives carrying their cloud indices. | |
| using | Packed = BVH::PackedBVH< T, Group, K > |
| The packed BVH over the groups. | |
| using | Node = typename Packed::Node |
| Flat node type of the held BVH. | |
| using | AABB = BoundingVolumes::AABBT< T > |
| Axis-aligned bounding box type. | |
Protected Member Functions | |
| CloudBVH () noexcept=default | |
| An empty BVH, to be reserved and filled. | |
| template<class Source > | |
| void | initialize (Pool &a_pool, const Source &a_source, uint32_t a_numItems, std::size_t a_targetLeafSize, uint32_t a_maxItems, const char *a_who) |
| Build over the primitives of a source, where the pool's memory is: the body of PointCloudBVH::build(). | |
| void | initialize (Pool &a_pool, const std::vector< Item > &a_items, std::size_t a_targetLeafSize, uint32_t a_maxItems, const char *a_who) |
| Build over the primitives of a host array, where the pool's memory is: for a pool in device memory, the primitives are checked on the host and copied to scratch there first. | |
| template<class Source > | |
| void | reinitialize (const Source &a_source, uint32_t a_numItems, const char *a_who) |
| Build again in the arrays initialize() reserved: the body of PointCloudBVH::rebuild(). | |
| void | rebase (const Pool &a_pool) noexcept |
Resolve this object against a_pool: the body of PointCloudBVH::rebasedView(), on a copy. | |
| void | copyInto (CloudBVH &a_copy, Pool &a_dstPool) const |
Duplicate this object's storage into a_dstPool, for a_copy, a copy of this object: the body of PointCloudBVH::deepCopy(). | |
| void | reserveArrays (Pool &a_pool, const Sizes &a_sizes, uint32_t a_numItems) |
Reserve the BVH's and the cloud's arrays from a_pool. | |
| template<class Source > | |
| Sizes | shape (const Scratch &a_scratch, void *a_base, const Source &a_source, uint32_t a_numItems, const char *a_who) |
| Build steps 1 to 5 (see PointCloudBVH): the box, the sorted keys, the tree's levels, the subtree sizes, boxes and depth-first indices, and the scans that place the rows and the groups. | |
| template<class Source > | |
| void | write (const Scratch &a_scratch, void *a_base, const Sizes &a_sizes, const Source &a_source, uint32_t a_numItems) |
| Build step 6 (see PointCloudBVH): write the arrays reserved for the tree shape() gave. | |
| template<class F > | |
| void | run (std::size_t a_count, const F &a_f) const |
| Run a build step: through GPU::parallelFor() for a build there, and in a host loop otherwise. | |
| std::uint32_t | scan (std::uint32_t *a_values, std::uint32_t a_count, std::uint32_t *a_scratch) const |
| An exclusive scan, where the build runs; see GPU::exclusiveScan(). | |
Protected Member Functions inherited from EBGeometry::PoolHandle | |
| PoolHandle () noexcept=default | |
| An unset location; the first reservation attaches it. | |
| PoolHandle (const PoolLocation &a_location) noexcept | |
| Adopt a location, as a handle rebuilt from a stored layout does. | |
| PoolHandle (const PoolHandle &) noexcept=default | |
| Copy a handle, as a derived handle's copy does. | |
| PoolHandle (PoolHandle &&) noexcept=default | |
| Move a handle; the same as a copy. | |
| PoolHandle & | operator= (const PoolHandle &) noexcept=default |
| Copy-assign a handle, as a derived handle's assignment does. | |
| PoolHandle & | operator= (PoolHandle &&) noexcept=default |
| Move-assign a handle; the same as a copy. | |
| ~PoolHandle () noexcept=default | |
| Destructor; protected, since a PoolHandle exists only as the base of a handle. | |
| void * | base () noexcept |
| The base address this handle's offsets resolve against; see PoolLocation::base(). | |
| const void * | base () const noexcept |
| The base address this handle's offsets resolve against, for read-only access. | |
| void | attach (const Pool &a_pool, const char *a_who, const bool a_deviceWritten=false) noexcept |
Follow a_pool, as the first reservation does; see PoolLocation::attach(). | |
| PoolLocation | rebasedLocation (const Pool &a_pool, uint64_t a_endByte, const char *a_who) const noexcept |
| The location of this handle's arrays in another pool of its mirror chain; see PoolLocation::rebasedOnto(). | |
| void | setLocation (const PoolLocation &a_location) noexcept |
| Replace the location, for a view or a copy made by a derived handle. | |
Static Protected Member Functions | |
| static Sizes | sizesFor (uint32_t a_numItems, uint32_t a_leafSize, const char *a_who) noexcept |
Bounds on the array sizes of a build over a_numItems primitives. | |
| static Scratch | reserveScratch (Pool &a_pool, uint32_t a_numItems, uint32_t a_leafSize, const char *a_who) |
Reserve a build's scratch from a_pool, for up to a_numItems primitives. | |
| template<class U > | |
| static std::vector< U > | toHost (const PODVector< U > &a_array, const void *a_base) |
| Copy one pool-resident array back into a host std::vector. | |
Protected Attributes | |
| Packed::Layout | m_bvhLayout |
| The packed BVH over the groups, as a layout: it shares this object's location. | |
| PODVector< Item > | m_items |
| The primitives, indexed by cloud index. | |
| PODVector< std::uint32_t > | m_leafOff |
| Per-primitive own-leaf group offset (for seeding). | |
| PODVector< std::uint32_t > | m_leafCnt |
| Per-primitive own-leaf group count (for seeding). | |
| PODVector< std::uint32_t > | m_order |
| Cloud indices in leaf (build) order; the spatially coherent batch-query order. | |
| Scratch | m_scratch |
| The scratch arrays a rebuild uses; empty for a BVH without room for one. | |
| std::uint32_t | m_maxItems = 0 |
| The most primitives a rebuild can take, 0 for none. | |
| std::uint32_t | m_leafSize = 0 |
| The largest leaf, max(a_targetLeafSize, K): a node of more primitives is cut. | |
| std::uint32_t | m_depth = 0 |
| The tree's depth in node levels (the root is level 1), 0 for an empty cloud. | |
| bool | m_parallel = false |
| Whether the build runs through GPU::parallelFor() (the pool's memory is device-accessible). | |
Additional Inherited Members | |
Public Member Functions inherited from EBGeometry::PoolHandle | |
| PoolLocation | location () const noexcept |
| Where this handle's arrays live. | |
| bool | isAttachedTo (const Pool &a_pool) const noexcept |
Check whether this handle's arrays were reserved from a_pool. | |
The state and build of a linear BVH over a cloud of primitives (points or spheres), built where its pool is; the base of PointCloudBVH and SphereCloudBVH.
Internal; not part of the public API. The build is the one PointCloudBVH describes, step by step: the Morton keys and the cuts come from each primitive's center (Prim::center()), the boxes hold the primitives (Prim::grow()), and the leaves are packed into Prim::Group groups of W.
| T | Floating-point precision. |
| K | BVH branching factor. |
| W | Primitives per leaf group. |
| Prim | The primitive type; see PointPrimitive. |
|
inlineprotected |
Duplicate this object's storage into a_dstPool, for a_copy, a copy of this object: the body of PointCloudBVH::deepCopy().
| [out] | a_copy | The copy, whose arrays are reserved and written. |
| [in,out] | a_dstPool | Pool to reserve the copy's arrays from. |
|
inlineprotected |
Build over the primitives of a source, where the pool's memory is: the body of PointCloudBVH::build().
| Source | The primitives' source. |
| [in,out] | a_pool | Pool the arrays are reserved from. |
| [in] | a_source | The primitives. |
| [in] | a_numItems | Number of primitives. |
| [in] | a_targetLeafSize | Target primitives per leaf. |
| [in] | a_maxItems | Most primitives a rebuild may have; 0 for none. |
| [in] | a_who | The calling function, for the messages. |
|
inlineprotected |
Build over the primitives of a host array, where the pool's memory is: for a pool in device memory, the primitives are checked on the host and copied to scratch there first.
| [in,out] | a_pool | Pool the arrays are reserved from. |
| [in] | a_items | The primitives. |
| [in] | a_targetLeafSize | Target primitives per leaf. |
| [in] | a_maxItems | Most primitives a rebuild may have; 0 for none. |
| [in] | a_who | The calling function, for the messages. |
|
inlineprotectednoexcept |
Resolve this object against a_pool: the body of PointCloudBVH::rebasedView(), on a copy.
| [in] | a_pool | The pool to resolve against. |
|
inlineprotected |
Build again in the arrays initialize() reserved: the body of PointCloudBVH::rebuild().
| Source | The primitives' source. |
| [in] | a_source | The primitives. |
| [in] | a_numItems | Number of primitives, at most m_maxItems. |
| [in] | a_who | The calling function, for the messages. |
|
inlineprotected |
|
inlinestaticprotected |
Reserve a build's scratch from a_pool, for up to a_numItems primitives.
| [in,out] | a_pool | Pool to reserve from. |
| [in] | a_numItems | Most primitives. |
| [in] | a_leafSize | The largest leaf. |
| [in] | a_who | The calling function, for the messages. |
|
inlineprotected |
Run a build step: through GPU::parallelFor() for a build there, and in a host loop otherwise.
| F | The step's functor. |
| [in] | a_count | Number of indices. |
| [in] | a_f | The functor. |
|
inlineprotected |
An exclusive scan, where the build runs; see GPU::exclusiveScan().
| [in,out] | a_values | The values. |
| [in] | a_count | Number of values. |
| [out] | a_scratch | GPU::exclusiveScanScratchSize(a_count) elements, for a build through GPU::parallelFor(). |
|
inlineprotected |
Build steps 1 to 5 (see PointCloudBVH): the box, the sorted keys, the tree's levels, the subtree sizes, boxes and depth-first indices, and the scans that place the rows and the groups.
| Source | The primitives' source. |
| [in] | a_scratch | The scratch arrays. |
| [in] | a_base | Base address of the scratch arrays' pool. |
| [in] | a_source | The primitives. |
| [in] | a_numItems | Number of primitives. |
| [in] | a_who | The calling function, for the messages. |
|
inlinestaticprotectednoexcept |
Bounds on the array sizes of a build over a_numItems primitives.
| [in] | a_numItems | Number of primitives. |
| [in] | a_leafSize | The largest leaf, max(a_targetLeafSize, K). |
| [in] | a_who | The calling function, for the messages. |
|
inlinestaticprotected |
Copy one pool-resident array back into a host std::vector.
| U | Element type. |
| [in] | a_array | Array to read. |
| [in] | a_base | Base address of the pool holding a_array. |
|
inlineprotected |
Build step 6 (see PointCloudBVH): write the arrays reserved for the tree shape() gave.
| Source | The primitives' source. |
| [in] | a_scratch | The scratch arrays, as shape() left them. |
| [in] | a_base | Base address of the scratch arrays' pool. |
| [in] | a_sizes | The tree's array sizes. |
| [in] | a_source | The primitives. |
| [in] | a_numItems | Number of primitives. |