Add the capability to specify subdomain IDs for boundary elements#4484
Add the capability to specify subdomain IDs for boundary elements#4484lindsayad wants to merge 4 commits into
Conversation
90ca91f to
ac47af5
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ac47af5 to
815a2e4
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| @@ -182,10 +182,18 @@ class BoundaryInfo : public ParallelObject | |||
| * generates a mesh with elements of mixed dimension. | |||
| * | |||
| * Only boundary elements with the specified ids are created. | |||
There was a problem hiding this comment.
It's not part of your original diff, but I'd change this comment line to something like "Only boundary element sides with boundary ids in the requested_boundary_ids set are considered for addition."
Since now there are two different "sets" of ids that one can "specify" for the function, I think it would be good to be more specific.
| auto it = requested_boundary_ids.find(triggering_bcid); | ||
| libmesh_assert(it != requested_boundary_ids.end()); | ||
| new_elem->subdomain_id() = | ||
| new_subdomain_ids[std::distance(requested_boundary_ids.begin(), it)]; |
There was a problem hiding this comment.
Minor comment, although I can't imagine it ever showing up in profiling, computing the std::distance between std::set iterators is O(N) complexity, so a potential improvement would be to create a requested_boundary_ids_vec from the original set passed in by the user. You can still look up items quickly in it using Utility::binary_find() and the subsequent std::distance check will also be O(1) in the vector.
- Make it clear that we'll only create lower-dimensional elements for the requested *boundary* ids - Switch to doing lookup for boundary-subdomain pairing in a vector container of the boundary ids instead of a set. This allows O(1) index lookup (via std::distance) as opposed to O(N) in a set Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This will make it easier to make these APIs direct replacements for downstream lower-d block mesh generators