Problem
Follows the discussion in #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
Problem
Follows the discussion in #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
PointLocatorclass to centralize all spatial searches.From looking at the code, I believe the following are all the instances where a spatial search is performed
match_faces,match_nodes(read_msh.cpp),face_match(read_files.cpp),distrn, remesh face loop (remesh.cpp),find_vtp_point_index(BoundaryCondition.cpp)uris_find_closest_face_centroid,find_closest_element_centroid(uris.cpp)uris_find_tetra(uris.cpp),find_n(remesh.cpp)contact.cpp)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