Skip to content

Apply max_volume to the default phases in 2D - #118

Merged
rimoli merged 1 commit into
developfrom
fix-2d-max-volume-default
Oct 17, 2026
Merged

rimoli merged 1 commit into
developfrom
fix-2d-max-volume-default

Conversation

@rimoli

@rimoli rimoli commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes the regression you found in the review of #114: in 2D, max_volume was ignored when TriMesh.from_polymesh got no phases.

  • _default_phases no longer sets an infinite max_volume, as you suggested, so the max_volume argument applies to the default phases. This covers the three places that read it: the bounded and periodic 2D meshers and _facet_sizes.
  • An explicit infinite max_volume in a phase still means no limit for that phase. The changelog says so, in the existing entry on per-phase limits.
  • A new test meshes one cell without phases, bounded and periodic, and checks the largest triangle against the limit. Without the fix, the bounded case keeps two triangles of area 8 under a limit of 0.4, and the periodic one reaches 0.83.
  • EXAMPLES_DIGEST is updated with docs/example_digest.py --write, since the library changed.

The full suite passes locally (224 tests).

🤖 Generated with Claude Code

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>
@rimoli
rimoli requested a review from kip-hart October 16, 2026 18:33
@rimoli
rimoli merged commit 176d2a0 into develop Oct 17, 2026
23 checks passed
@kip-hart
kip-hart deleted the fix-2d-max-volume-default branch October 17, 2026 16:55
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.

2 participants