BoxTreeBuilder
The build of an axis-aligned box tree over primitives, apart from what a node carries (field-presentation §FVS-2, matrix FVW-51).
template <typename Node> class mesh::spatial::BoxTreeBuilder
In the namespace mesh::spatial. Declared in src/libs/libmesh/mesh/spatial/BoxTreeBuilder.hpp.
Detailed description
A median split on the longest side of the node's box, at the centroids of its primitives, down to leaves of at most leafSize. The first serialDepth levels are built one level at a time, the nodes of a level on several threads; each subtree below them is built on a worker of its own. A tie of two centroids breaks by the primitive index. So the tree is the same, bit for bit, for every thread count.
TriangleBvh and TetLocator build with it. A tree's node type gives the payload: TriangleBvh's node carries the far-field terms of the winding number, TetLocator's node a float box. The builder reads only the box.
Node needs: - `lo` and `hi`: three numbers each, by `[k]`, which `fill` sets; - `void setChildren(qint32 left, qint32 right)` and `void setLeaf(qint32 first, qint32 count)`; - a default constructor.
Fill is called as `fill(node, first, count, order, threads)` for each node: the node's primitives are `order[first]` to `order[first + count - 1]`. It sets the box and the payload. It runs on the worker that builds the node, with a share of threads at the serial levels and 1 below them, and its answer must not depend on that count.