|
| | MeshT () noexcept=default |
| | Default constructor. Leaves the mesh empty (no vertices, edges, faces) and attached to no Pool, so it cannot yet resolve anything.
|
| |
| | MeshT (const Layout &a_layout, const PoolLocation &a_location) noexcept |
| | Rebuild a handle from a stored layout and the location of the pool that holds it.
|
| |
| Layout | layout () const noexcept |
| | The mesh's arrays without its location, for storing it inside another pool-resident object.
|
| |
| | MeshT (const Mesh &a_otherMesh) noexcept=default |
| | Copy constructor.
|
| |
| | MeshT (Mesh &&a_otherMesh) noexcept=default |
| | Move constructor.
|
| |
|
| ~MeshT () noexcept=default |
| | Destructor (does nothing; MeshT owns no resources).
|
| |
| Mesh & | operator= (const Mesh &a_otherMesh) noexcept=default |
| | Copy assignment operator.
|
| |
| Mesh & | operator= (Mesh &&a_otherMesh) noexcept=default |
| | Move assignment operator.
|
| |
| Mesh | deepCopy (Pool &a_dstPool) const |
| | Create an independent, fully-decoupled copy of this mesh's data in another Pool.
|
| |
| void | sanityCheck (const std::string a_id) const |
| | Perform a sanity check.
|
| |
| void | setSearchAlgorithm (const SearchAlgorithm a_algorithm) noexcept |
| | Search algorithm for direct signed distance computations.
|
| |
| void | setInsideOutsideAlgorithm (InsideOutsideAlgorithm a_algorithm) noexcept |
| | Set the inside/outside algorithm to use when computing the signed distance to polygon faces.
|
| |
| void | reconcile () |
| | Reconcile function which computes the internal parameters in vertices, edges, and faces for use with signed distance functionality.
|
| |
| void | flip () noexcept |
| | Flip the mesh, making all the normals change direction.
|
| |
| void | reserveVertices (Pool &a_pool, uint32_t a_capacity) |
| | Reserve storage for a_capacity vertices.
|
| |
| void | reserveEdges (Pool &a_pool, uint32_t a_capacity) |
| | Reserve storage for a_capacity half-edges.
|
| |
| void | reserveFaces (Pool &a_pool, uint32_t a_capacity) |
| | Reserve storage for a_capacity faces.
|
| |
| uint32_t | addVertex (Pool &a_pool, const Vertex &a_vertex) |
| | Append a vertex into the pre-reserved capacity (see reserveVertices()).
|
| |
| uint32_t | addEdge (Pool &a_pool, const Edge &a_edge) |
| | Append a half-edge into the pre-reserved capacity (see reserveEdges()).
|
| |
| uint32_t | addFace (Pool &a_pool, const Face &a_face) |
| | Append a face into the pre-reserved capacity (see reserveFaces()).
|
| |
| Vertex & | getVertex (uint32_t a_index) noexcept |
| | Get modifiable vertex by index.
|
| |
| const Vertex & | getVertex (uint32_t a_index) const noexcept |
| | Get immutable vertex by index.
|
| |
| Edge & | getEdge (uint32_t a_index) noexcept |
| | Get modifiable half-edge by index.
|
| |
| const Edge & | getEdge (uint32_t a_index) const noexcept |
| | Get immutable half-edge by index.
|
| |
| Face & | getFace (uint32_t a_index) noexcept |
| | Get modifiable face by index.
|
| |
| const Face & | getFace (uint32_t a_index) const noexcept |
| | Get immutable face by index.
|
| |
| uint32_t | numVertices () const noexcept |
| | Number of vertices in this mesh.
|
| |
| uint32_t | numEdges () const noexcept |
| | Number of half-edges in this mesh.
|
| |
| uint32_t | numFaces () const noexcept |
| | Number of faces in this mesh.
|
| |
| std::vector< Vec3T< T > > | getAllVertexCoordinates () const |
| | Return all vertex coordinates in the mesh.
|
| |
| T | signedDistance (const Vec3 &a_x0) const noexcept |
| | Compute the signed distance from a point to this mesh.
|
| |
| T | signedDistance (const Vec3 &a_x0, SearchAlgorithm a_algorithm) const noexcept |
| | Compute the signed distance from a point to this mesh, using an explicit search algorithm.
|
| |
| T | unsignedDistance2 (const Vec3 &a_x0) const noexcept |
| | Compute the unsigned square distance from a point to this mesh.
|
| |
| Mesh | rebasedView (const Pool &a_pool) const noexcept |
| | Produce a copy of this mesh's descriptor that resolves against a mirror of this mesh's Pool, rather than against the Pool the mesh was built in.
|
| |
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.
|
| |
|
| void | attachTo (const Pool &a_pool) noexcept |
| | Attach this mesh to a_pool, or check that it is already attached to it.
|
| |
| void | reconcileFaces () noexcept |
| | Function which computes internal things for the polygon faces.
|
| |
| void | reconcileEdges () noexcept |
| | Function which computes internal things for the half-edges.
|
| |
| void | reconcileVertices () |
| | Compute each vertex's angle-weighted pseudonormal.
|
| |
|
void | flipFaceNormals () noexcept |
| | Flip all face normals.
|
| |
|
void | flipEdgeNormals () noexcept |
| | Flip all edge normals.
|
| |
|
void | flipVertexNormals () noexcept |
| | Flip all vertex normals.
|
| |
| T | DirectSignedDistance (const Vec3 &a_point) const noexcept |
| | Implementation of signed distance function which iterates through all faces.
|
| |
| T | DirectSignedDistance2 (const Vec3 &a_point) const noexcept |
| | Implementation of signed distance function which iterates through all faces, comparing squared unsigned distances.
|
| |
| void | incrementWarning (std::map< std::string, size_t > &a_warnings, const std::string &a_warn) const |
| | Increment a warning. This is used in sanityCheck() for locating holes or bad inputs in the mesh.
|
| |
| void | printWarnings (const std::map< std::string, size_t > &a_warnings, const std::string &a_id) const |
| | Print all warnings to std::cerr.
|
| |
| bool | faceLoopCloses (uint32_t a_faceIndex, uint32_t &a_lastEdge, uint32_t &a_steps) const noexcept |
| | Walk a face's half-edge loop, bounded by the number of half-edges.
|
| |
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) 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.
|
| |
template<class T>
class EBGeometry::DCEL::MeshT< T >
DCEL mesh class - stores a doubly-connected edge mesh.
Mesh class which stores a full DCEL mesh (with signed distance functions)
- Template Parameters
-
| T | Floating-point precision type. |
This encapsulates a full DCEL mesh, and also includes DIRECT signed distance functions. The mesh consists of a set of vertices, half-edges, and polygon faces, stored as PODVectors; every cross-reference between them (vertex-to-outgoing-edge, edge-to-vertex/pair edge/next edge/face, face-to-half-edge) is an index into these arrays rather than a pointer – see the class-level notes on VertexT/EdgeT/FaceT. The signed distance functions DIRECT, which means that they go through ALL of the polygon faces and compute the signed distance to them. This is extremely inefficient, which is why this class is almost always embedded into a bounding volume hierarchy.
- Note
- MeshT owns no resources: every member (three PODVectors, the search-algorithm enum, and the PoolLocation held by its PoolHandle base) is a plain value, so MeshT is trivially copyable – a bytewise copy is meaningful in any address space, since it never needs to dereference anything beyond its own bytes. This is what makes a mesh built and reconciled on the host mirror-safe: its Pool can be mirrored to a device and the mesh rebased onto the mirror (see rebasedView()), with zero pointer patching inside the mesh itself.
A mesh resolves its PODVector offsets through its PoolLocation (see PoolHandle and PoolLocation::base()), which takes one of two forms:
- it follows the control block of the Pool the mesh was reserved from, from the first reserveVertices/Edges/Faces() call on. Because the base is re-read from the control block on every access, a mesh is queryable at any point during the build, including across a Pool::reserve that grows and moves the block – there is no freeze, and nothing to re-bind.
- it holds a snapshot of a plain base address, made only by rebasedView() and only for a device-accessible target, since a kernel cannot follow a control block. Host code may use the snapshot only if that memory is host-accessible (Managed, Mapped). A location that still follows a control block on a device means a host descriptor was copied into a kernel without rebasedView(), which EBGEOMETRY_EXPECT catches.
- Warning
- A reference returned by getVertex()/getEdge()/getFace() is a raw address resolved at the moment of the call, and Pool::reserve may deallocate the block it points into (see the warning on Pool::reserve). Resolve, use, discard: to carry an element across a reserve, copy it by value and write it back through a fresh accessor call.
Build-phase mutators (reserveVertices/Edges/Faces, addVertex/Edge/Face) take an explicit Pool&, since reserving can grow (and move) the Pool's block; building only happens on the host, with a live Pool in hand. - Note
- Everything that resolves purely through base(), the PODVectors, and VertexT/EdgeT/FaceT methods that are themselves EBGEOMETRY_HOST_DEVICE (getVertex/getEdge/getFace, numVertices/ numEdges/numFaces, setSearchAlgorithm, setInsideOutsideAlgorithm, reconcileEdges, flipFaceNormals/flipEdgeNormals/flipVertexNormals, flip, DirectSignedDistance/ DirectSignedDistance2, every signedDistance overload, unsignedDistance2) is annotated EBGEOMETRY_HOST_DEVICE – signedDistance's algorithm-selecting switch deliberately relies on EBGEOMETRY_EXPECT() alone (not std::cerr) to flag a corrupted SearchAlgorithm, specifically so it stays device-callable; see the implementation. The rest stays EBGEOMETRY_HOST because it touches a Pool directly (rebasedView, deepCopy, reserveVertices/Edges/Faces, addVertex/Edge/Face), returns a host container (getAllVertexCoordinates), logs diagnostics to std::cerr (sanityCheck and its incrementWarning/printWarnings helpers), or delegates to a VertexT/EdgeT/FaceT method that itself allocates a std::vector or can log a diagnostic the same way (reconcileFaces calls FaceT::reconcile; reconcileVertices builds a transient per-vertex face list and aborts with a message on a face that visits a vertex twice) – reconcile/reconcileFaces/reconcileVertices therefore remain EBGEOMETRY_HOST.
- Template Parameters
-
| T | Floating-point precision type. |