Skip to content

Add the capability to specify subdomain IDs for boundary elements#4484

Open
lindsayad wants to merge 4 commits into
libMesh:develfrom
lindsayad:subdomain-ids-for-boundary-elements
Open

Add the capability to specify subdomain IDs for boundary elements#4484
lindsayad wants to merge 4 commits into
libMesh:develfrom
lindsayad:subdomain-ids-for-boundary-elements

Conversation

@lindsayad

Copy link
Copy Markdown
Member

This will make it easier to make these APIs direct replacements for downstream lower-d block mesh generators

@lindsayad lindsayad force-pushed the subdomain-ids-for-boundary-elements branch from 90ca91f to ac47af5 Compare June 16, 2026 17:44
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lindsayad lindsayad force-pushed the subdomain-ids-for-boundary-elements branch from ac47af5 to 815a2e4 Compare June 16, 2026 17:49
@moosebuild

moosebuild commented Jun 17, 2026

Copy link
Copy Markdown

Job Coverage, step Generate coverage on f791cd5 wanted to post the following:

Coverage

862243 #4484 f791cd
Total Total +/- New
Rate 65.60% 65.61% +0.01% 100.00%
Hits 78626 78651 +25 20
Misses 41235 41234 -1 0

Diff coverage report

Full coverage report

This comment will be updated on new commits.

Comment thread include/mesh/boundary_info.h Outdated
@@ -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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/mesh/boundary_info.C Outdated
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)];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants