|
chombo-discharge
|
Class that represents a set of triangles. More...
#include <CD_TriangleCollection.H>
Public Types | |
| using | Vec3 = Triangle::Vec3 |
| 3D vector type, re-exported from Triangle for convenience. | |
| using | BV = EBGeometry::BoundingVolumes::AABBT< Real > |
| Bounding volume type. | |
Public Member Functions | |
| TriangleCollection () noexcept | |
| Default constructor. | |
| TriangleCollection (const std::vector< std::shared_ptr< Triangle > > &a_triangles) noexcept | |
| Full constructor. Takes the input triangles and stores them in a BVH-tree. | |
| TriangleCollection (const std::string &a_filename, const std::string &a_vertexDataIdentifier) | |
| File-reading constructor. Reads a PLY or VTK mesh file and builds the BVH. | |
| virtual | ~TriangleCollection () noexcept |
| Destructor (does nothing). | |
| virtual void | define (const std::vector< std::shared_ptr< Triangle > > &a_triangles) noexcept |
| Build the BVH tree from a set of triangles. | |
| virtual std::vector< std::pair< std::shared_ptr< const Triangle >, Real > > | getClosestTriangles (const Vec3 &a_point) const noexcept |
| Hierarchical BVH search that returns candidate closest triangles to a query point. | |
Static Public Attributes | |
| static constexpr int | K = 4 |
| Branching factor for BVH tree. | |
Protected Attributes | |
| bool | m_isDefined = false |
| Is defined or not. | |
| std::shared_ptr< EBGeometry::BVH::LinearBVH< Real, Triangle, BV, K > > | m_bvh |
| Triangle collection – stored in a BVH-tree for faster lookup. | |
Class that represents a set of triangles.
This class uses the bounding volume hierarchies supplied by EBGeometry to organize and query a collection of Triangle objects.
Interpolation.** Each Triangle carries a scalar value at each of its three vertices. Given a query point, the typical workflow is:
Triangle::interpolate() uses two different strategies depending on where the query point falls:
The outside-triangle path is therefore a bounded, range-preserving extrapolation rather than an unconstrained linear extrapolation. Degenerate triangles (zero area) always return zero.
|
noexcept |
Default constructor.
Leaves the object in an undefined state (m_isDefined = false). define() must be called before getClosestTriangles() can be used.
|
noexcept |
Full constructor. Takes the input triangles and stores them in a BVH-tree.
Calls define(). The object is ready for use immediately after construction.
| [in] | a_triangles | Input triangles. Must be non-empty and must already have their vertex positions and meta-data set. |
| TriangleCollection::TriangleCollection | ( | const std::string & | a_filename, |
| const std::string & | a_vertexDataIdentifier | ||
| ) |
File-reading constructor. Reads a PLY or VTK mesh file and builds the BVH.
Calls DataParser::readTriangles() to parse the file and populate Triangle vertex positions and metadata, then calls define() to build the BVH. Equivalent to constructing with the default constructor and then calling define(DataParser::readTriangles(a_filename, a_vertexDataIdentifier)). Issues a fatal error for unsupported file types and a warning if the vertex data identifier is not found in the file (vertex data defaults to zero in that case).
| [in] | a_filename | Path to the input mesh file (.ply or .vtk). |
| [in] | a_vertexDataIdentifier | Name of the per-vertex scalar property to read as Triangle vertex metadata. |
|
virtualnoexcept |
Build the BVH tree from a set of triangles.
Packs each triangle into an axis-aligned bounding box, constructs a K-ary BVH using top-down partitioning, and flattens it into a linear layout for cache-friendly traversal. Sets m_isDefined to true on success. This is the same operation performed by the full constructor; use it to (re-)initialize an object that was default-constructed or needs to be rebuilt.
| [in] | a_triangles | Input triangles. Must be non-empty and must already have their vertex positions and meta-data set. |
|
virtualnoexcept |
Hierarchical BVH search that returns candidate closest triangles to a query point.
Traverses the BVH closest-node-first, pruning any node whose bounding volume distance exceeds the shortest triangle distance found so far. At each leaf the pruning threshold is tightened as each closer triangle is encountered, so the returned list contains every triangle that was the shortest-distance-so-far at the moment it was evaluated. As a result the list may include triangles that are not among the globally closest once the full traversal is complete; callers should use the first entry (index 0) as the definitive closest triangle. Requires define() to have been called first.
| [in] | a_point | Query point in 3D space. |