Open kennyweiss opened 4 years ago
We have code that is doing this in a naive way, probably O(n^2). It would certainly be nice to have a spatially accelerated version.
Talk to @wnissen to discuss needs/priorities.
One idea would be to take in a blueprint mesh and return a blueprint mesh.
Just thinking about this, would it be necessary to return a mesh? Seems like it would be more work to round-trip a mesh than to create a mapping of node ids. The coordinates wouldn't be involved in the return as long as the welding doesn't change any of them, which I think is a desirable property. So the result would be an
array<int>
of old->new vertex ids, same size as the original number of vertices.
Quest provides a function to "weld" vertices in a triangle mesh that are closer than a user- provided distance threshold. This function identifies sets of vertices at the same location, removes duplicate vertices and updates the vertex indices in the mesh's connectivity array.
https://github.com/LLNL/axom/blob/975fc516e6b4dfd4bb82f9c8495db90a7150f8fc/src/axom/quest/MeshTester.hpp#L120-L122
We've had requests from several users to generalize this capability to more types of meshes. Specifically, this should handle unstructured quad meshes in 2D and 3D.
Based on discussions with these users, something along the lines of the following interface would be ideal:
where the
weldMeshVertices()
function would take an array of vertex positions and the connectivity array of the mesh, and return the resultant welded mesh vertices and connectivity using the provided input arrays.Note that the welding operation does not require knowledge of the cell types since it is merely relabeling the vertex indices.