Repository navigation
Apply max_volume to the default phases in 2D - #118
Merged
Merged
Conversation
Without phases, TriMesh.from_polymesh uses one default phase per phase
number, and those carried 'max_volume': inf. The 2D meshers read the
area limit of each region as phase.get('max_volume', max_volume), so
the infinite default always won. The global limit is no longer passed
to Triangle under the regional ones (the periodic mesher needs
different limits for the cells and their copies), so the max_volume
argument was ignored: a square meshed with max_volume=0.4 kept two
triangles of area 8. On master the global limit applied underneath.
The default phases no longer have a max_volume, so the argument applies
to their regions, in the bounded and the periodic 2D meshers and in
_facet_sizes. An explicit infinite max_volume of a phase still means no
limit for that phase, as the changelog now says.
The new test meshes a single cell without phases, bounded and periodic,
and checks the largest triangle against the limit. The example digest
of the documentation is updated for the change of the library.
Reported by Kip Hart in the review of PR #114.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kip-hart
approved these changes
Oct 16, 2026
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.
Fixes the regression you found in the review of #114: in 2D,
max_volumewas ignored whenTriMesh.from_polymeshgot no phases._default_phasesno longer sets an infinitemax_volume, as you suggested, so themax_volumeargument applies to the default phases. This covers the three places that read it: the bounded and periodic 2D meshers and_facet_sizes.max_volumein a phase still means no limit for that phase. The changelog says so, in the existing entry on per-phase limits.EXAMPLES_DIGESTis updated withdocs/example_digest.py --write, since the library changed.The full suite passes locally (224 tests).
🤖 Generated with Claude Code