[SNAPPY] Enable only selected shapes of UniformRefinement#1846
[SNAPPY] Enable only selected shapes of UniformRefinement#1846piotrkluba wants to merge 10 commits intomainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| "UniformRefinement for snappy accepts only Boxes with axes aligned" | ||
| + " with the global coordinate system (angle_of_rotation=0)." | ||
| ) | ||
| if isinstance(entity, Cylinder) and entity.inner_radius.to("m") != 0 * u.m: |
There was a problem hiding this comment.
Cylinder with None inner_radius causes AttributeError in validator
Medium Severity
Cylinder.inner_radius is Optional[LengthType.NonNegative] (with default 0 * u.m), so it can be explicitly None. The expression entity.inner_radius.to("m") on line 23 will raise an AttributeError when inner_radius is None, instead of correctly treating it as a full cylinder (equivalent to inner_radius=0). This is now reachable through the newly added _check_snappy_uniform_refinement_entities validator in VolumeMeshingParams, expanding the blast radius of this crash path.


Note
Medium Risk
Introduces stricter validation rules for snappy workflows and changes when/where validation runs (especially for volume refinements projected to surface), which may break previously-accepted configs but is otherwise localized to meshing parameter validation/translation.
Overview
snappyHexMesh UniformRefinement validation is tightened and made consistent across surface/volume workflows.
UniformRefinementnow rejects unsupported entity types under snappy (onlyBox,Cylinder,Sphereare allowed), and additional constraints are enforced: boxes must be axis-aligned and cylinders must be non-hollow.The snappy-specific entity checks were refactored into a shared helper (
meshing_validators.py) and are now applied not only insnappy.SurfaceMeshingParams, but also inVolumeMeshingParamswhenever aUniformRefinementis projected to the surface mesh (project_to_surfacedefault/True; skipped when explicitlyFalse). Tests and translator golden output were extended to cover these cases, including new sphere-based snappy coupled-refinement translation coverage.Written by Cursor Bugbot for commit 54e4437. This will update automatically on new commits. Configure here.