Merged
Conversation
Backporting of fixes in 64c7d97 and bc3d8be. Here, we use the cross product to determine if a point is inside or not. If there is uncertainty about this, the caller must decide (i.e. if the point is too close to the boundary to reliably tell). We assume an uncertain point is inside if the caller is checking if a grid corner is inside a triangle, but outside if the caller is checking if a triangle vertex is inside a grid cell.
A backport of e494fbd, which says: A comparison with zero is not very useful on a finite-precision machine! Using 1e-6 seems to work well.
A backport of d391780, which says: checkIfIntersecting now ignores intersections that are exactly on the vertex. It never should have included those, and doing it like this is very marginally better in terms of total error.
A backport of 90855a1, which says: I was fiddling with it ans saw that I had already done something similar in ConservativeRemappingFromMeshToMesh. It probably won't have much of an effect. Putting it here, since these functions have been massively rewritten anyway.
It's a good thing, and helped catching two very minor bugs.
This is just to make comparison with the work in PR #684 easier.
Propably not very useful, but helps with comparing with the work in PR
It doesn't make very much difference, but using continue is correct.
tdcwilliams
approved these changes
Mar 19, 2026
Contributor
tdcwilliams
left a comment
There was a problem hiding this comment.
Thanks @einola, it works for the mesh I was having trouble with (ps_25km.msh in the gnu environment).
I also checked a couple of restart files from before and after regridding and the interpolation looked fine.
There is a minor typo to fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A backport of the fixes I did to the conservative remapping scheme in PR #684.
An important difference is that this code uses bamg's previous numbering feature to determine whether the element has changed. In PR #684, I had to use the element's drift speed, which is a far less accurate approach.
Some testing still required, but it seems to work ok.