Skip to content

Simple mesh fixes#4380

Merged
roystgnr merged 16 commits intolibMesh:develfrom
roystgnr:simple_mesh_fixes
Feb 4, 2026
Merged

Simple mesh fixes#4380
roystgnr merged 16 commits intolibMesh:develfrom
roystgnr:simple_mesh_fixes

Conversation

@roystgnr
Copy link
Member

Okay, "simple" might be overselling a couple commits here, but this is at least the largest collection of the most straightforward bugfixes that I could pull out of #3759.

Other than the new InfElem::is_child_on_* unit testing, I'm not able to strip out the test coverage for these fixes; I'm afraid that depends on the refactoring in #3759, and I'm hoping to merge the refactoring last, after it's been decluttered via this and another PR.

This wasn't failing the test, because the kernel here didn't need the
unprepared data, but we'd like to simply assert that we're not
assembling or solving on unprepared meshes.
Otherwise the mesh still thinks its fully prepared even when it isn't
and we can't assert valid_is_prepared() on it.
We've added some tricky interior_mesh options that our
copy_nodes_and_elements code wasn't handling correctly, and it was
possible for a clone() of such a mesh to fail its operator== assertion.
This must have been an atavism from a previous refactoring.
We never caught this before because we were never doing much subsequent
mesh modification to the output, but as soon as we start heavier testing
we run into code that screams about the inconsistent parent/child id
ordering.
This was supposed to be a pure virtual function eventually, and it's
time to start moving that way.
We're making that pure virtual in non-deprecated builds now.
2008.  This has been buggy since I wrote it in 2008.  And yet it took a
double-refinement test on a distributed mesh plus an extra layer of
dbg-mode internal consistency checks to catch the bug.
I went to double-check that this was the macro I wanted, and the
behavior did match my recollection but didn't match my comment
@moosebuild
Copy link

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

Coverage

1a475b #4380 da90cb
Total Total +/- New
Rate 65.31% 65.31% -0.00% 74.47%
Hits 77592 77614 +22 35
Misses 41215 41227 +12 12

Diff coverage report

Full coverage report

Warnings

  • New new line coverage rate 74.47% is less than the suggested 90.0%

This comment will be updated on new commits.

@roystgnr
Copy link
Member Author

Test failures unrelated

Copy link
Member

@jwpeterson jwpeterson left a comment

Choose a reason for hiding this comment

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

This looks good to me, but it seems like I might need to add

mesh.get_boundary_info().regenerate_id_sets();

and

mesh.cache_elem_data();

calls in some of my own code? I'm curious how you figured out where those calls were missing/needed?

@roystgnr
Copy link
Member Author

roystgnr commented Feb 4, 2026

Forcing downstream users to change their mesh generation code right away would probably be a deal-breaker, right? But IMHO there are two situations we should disallow in the long-term: leaving a mesh in a state where it thinks it's prepared (i.e. mesh->is_prepared() returns true) but it really isn't (i.e. it's missing pointers or cache updates or something that another prepare_for_use() call would have fixed, or trying to do assembly on a mesh that doesn't even think it's prepared. #3759 adds assertions demanding that neither thing happens, but for the former case (which is the tricky one, hence all the fixes here) I only activate those assertions for --disable-deprecated builds. I suppose I should probably do the same for the latter case too, just to give everyone the smoothest on-ramp possible!

Right now (in #3759) if you fail such an assertion, you get a message with some explanation of which data doesn't match between your mesh and a properly-prepared copy of your mesh ... but I should probably also make the explanation more fine-grained than it is now; I lumped every failure of Elem::topologically_equal() into a single message.

@roystgnr roystgnr merged commit d9f0ddd into libMesh:devel Feb 4, 2026
19 of 21 checks passed
@roystgnr roystgnr deleted the simple_mesh_fixes branch February 4, 2026 20:57
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