Skip to content

Conversation

@roystgnr
Copy link
Member

@roystgnr roystgnr commented Jan 4, 2024

I'm still trying to figure out how to make this easy to use, but I'd like to at least test that what I've got so far still passes CI.

@lindsayad
Copy link
Member

Does "do not merge" also mean "do not review"?

@moosebuild
Copy link

Job Coverage on 7c8c1d1 wanted to post the following:

Coverage

ffa3a3 #3759 7c8c1d
Total Total +/- New
Rate 62.35% 62.36% +0.02% 98.67%
Hits 68275 68328 +53 74
Misses 41235 41236 +1 1

Diff coverage report

Full coverage report

This comment will be updated on new commits.

@roystgnr
Copy link
Member Author

roystgnr commented Jan 4, 2024

Does "do not merge" also mean "do not review"?

It's already bad enough to need fixing, huh? ;-)

Nah, please jump in as you see fit. I've got more I'm wanting to add here, but if there's flaws in the foundation then it's probably better to fix them before I put more layers on top.

Copy link
Member

@lindsayad lindsayad left a comment

Choose a reason for hiding this comment

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

Just looking at the header this seems like a great foundation to me

@roystgnr roystgnr force-pushed the mesh_preparation_finer branch from 7c8c1d1 to fc6ee94 Compare June 21, 2024 15:16
@roystgnr roystgnr force-pushed the mesh_preparation_finer branch from fc6ee94 to e39fc75 Compare December 5, 2025 21:17
@roystgnr
Copy link
Member Author

roystgnr commented Dec 5, 2025

This might actually be in shape to merge soon. My remaining concerns:

  1. The additional internal testing I've added might trigger dbg and/or devel failures downstream, in tests of code that doesn't properly prepare a mesh before solving (so it'll fail the new assertions) but either doesn't rely on the unprepared data or just compares to a gold solution that mis-relied on it (so it's not already failing tests). I'll add every recipe I think might be affected to the CI here.

  2. The additional internal testing I've added might be too expensive in dbg mode, where it tests preparation validity before every assembly. I think we can afford that (prepare_for_use() is much cheaper if we don't repartition, which we don't when checking validity). If we see CI timeouts then I'll try moving my testing from assembly methods to solve() methods. If we still see timeouts after that then I'll remove the intensive testing entirely for now.

@moosebuild
Copy link

moosebuild commented Dec 11, 2025

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

Coverage

Inconsistent report tags were found between the head and base reports.
This can happen when reports are missing from either the head or the base.

Inconsistent tags:
32bit-np2_threads2
Full coverage report

This comment will be updated on new commits.

We need things like neighbor pointers, and in general we'd like to
assert that we're never assembling or solving on unprepared meshes.
We can rebuild point locators or element caches, but we don't want to
use an already-built invalid cache by accident.
If we're skipping partitioning, we shouldn't mark ourselves as
partitioned if we're not, and we shouldn't expect that we're marked as
partitioned.
@roystgnr
Copy link
Member Author

I'm moving the "incredibly careful assertions" part of this PR to a new branch, https://github.com/roystgnr/libmesh/tree/mesh_preparation_assertions, which I'll put into a new PR for after this one goes in. That (plus the other PRs I've just factored out, plus one more bugfix PR that'll wait on #4394 because it requires a commit there) should get this PR down to just the functionality promised in the title, and should leave it in a ready-to-review state.

@roystgnr roystgnr force-pushed the mesh_preparation_finer branch from 6febe53 to b0367ec Compare February 11, 2026 20:35
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 @roystgnr and I discussed changing the names of the new APIs, e.g. set_hasnt_neighbor_ptrs() -> unset_has_neighbor_ptrs(), which I preferred. This would also include eventually deprecating set_isnt_prepared() in favor of unset_is_prepared().

/**
* Flags indicating in what ways a mesh has been prepared for use.
*/
struct Preparation {
Copy link
Member

Choose a reason for hiding this comment

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

We usually do all opening curly brace on next line.

@roystgnr
Copy link
Member Author

I feel like 90% of the work on this PR has been fixes, not for bugs in the PR, but for bugs exposed by the PR.

Along with the API name changes I figured I'd throw in a couple more unit tests, despite the fact that they would surely be redundant with all the test coverage I got in the branch I'm following this one with ... and, long story short, there'll be a couple more non-trivial commits coming along with the name changes and the new tests: a bug fix in the MeshBase copy constructor, and some changes to allow copying and cloning of some types of badly-unprepared meshes.

Not sure how we missed this for so long.
My unit tests (in an upcoming commit) uncovered that it was impossible
to copy a mesh with orphaned nodes that have boundary conditions,
because copy_nodes_and_elements would helpfully delete them despite
BoundaryInfo expecting to find them.  But we do want to be able to copy
even unprepared meshes without throwing an error.

Instead of whining that it would be hard to break backwards
compatibility here, I should have just added an option to drop backwards
compatibility here.
If we have a parallel-inconsistent partitioning then we may have a real
problem, but we might temporarily have nodes that need to be
repartitioned, and we'd like to be able to copy them anyway.
This hits the easiest-to-set-up partially-unprepared cases, and even
that was enough to expose a subtle bug or two.
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.

4 participants