SimVascular / SimVascular/svMultiPhysics
Encapsulate spatial searches into class
@javijv4 is already working on this.
Since Aug 27, 2026.
- Dominant language
- C++
- Stars
- 45
- Forks
- 61
- Avg merge
- 5d 23h
- Merged PRs (30d)
- 11
Description
Problem
Follows the discussion in https://github.com/SimVascular/svMultiPhysics/discussions/609
Right now, there are several instances in the code performing spatial search to match vertices to vertices, vertices to faces, or faces to faces between different meshes. Ideally, all these spatial search are encapsulated into classes that the different applications call. This will make the code easier to read, easier to optimize, and make it easier to implement features that require this type of search.
Solution
Create a PointLocator class to centralize all spatial searches.
From looking at the code, I believe the following are all the instances where a spatial search is performed
| Query type | Current implementations |
|---|---|
| Nearest neighbor | match_faces, match_nodes (read_msh.cpp), face_match (read_files.cpp), distrn, remesh face loop (remesh.cpp), find_vtp_point_index (BoundaryCondition.cpp) |
| Closest centroid | uris_find_closest_face_centroid, find_closest_element_centroid (uris.cpp) |
| Containing element | uris_find_tetra (uris.cpp), find_n (remesh.cpp) |
| Nodes within distance | contact neighbor search (contact.cpp) |
| Point in region | uris_point_in_bbox (uris.cpp), SpatialBounds::inside_* (CepMod.cpp) |
I am not sure whether all this code is currently maintained (like the functions in contact.cpp), but these applications seem easy to implement, so replacing them shouldn't be complicated.
Additional context
In #609, alternatives for using specialized packages to accelerate spatial queries were proposed. Depending on implementation complexity, we can implement them now or leave optimization of these routines for a future issue.
Code of Conduct
- I agree to follow this project's Code of Conduct and Contributing Guidelines
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.