Skip to content

EB: use a finite marker instead of NaN for edges with no intercept - #5668

Merged
WeiqunZhang merged 2 commits into
AMReX-Codes:developmentfrom
WeiqunZhang:eb_intercept_sentinel
Sep 12, 2026
Merged

EB: use a finite marker instead of NaN for edges with no intercept#5668
WeiqunZhang merged 2 commits into
AMReX-Codes:developmentfrom
WeiqunZhang:eb_intercept_sentinel

Conversation

@WeiqunZhang

Copy link
Copy Markdown
Member

The edge intercept arrays used a quiet NaN to mark an edge that is entirely regular or entirely covered, and updateIntercept read it back with amrex::isnan. That test is not reliable: under -ffinite-math-only, which -ffast-math implies, both gcc and clang fold std::isnan to false, so the marker becomes undetectable. Cray builds add -ffast-math unconditionally in non-debug mode, and GeometryShop.H is a header, so it also picks up the flags of an application built that way.

Replace the marker with EB2::no_intercept, a large finite value that cannot be mistaken for a physical coordinate, and test it with an ordinary comparison.

The marker never escapes geometry construction: build_faces reads an intercept only for irregular edges, and intercept_to_edge_centroid then overwrites every entry, so no user-visible data changes.

The edge intercept arrays used a quiet NaN to mark an edge that is entirely
regular or entirely covered, and updateIntercept read it back with
amrex::isnan.  That test is not reliable: under -ffinite-math-only, which
-ffast-math implies, both gcc and clang fold std::isnan to false, so the
marker becomes undetectable.  Cray builds add -ffast-math unconditionally in
non-debug mode, and GeometryShop.H is a header, so it also picks up the flags
of an application built that way.

Replace the marker with EB2::no_intercept, a large finite value that cannot be
mistaken for a physical coordinate, and test it with an ordinary comparison.

The marker never escapes geometry construction: build_faces reads an intercept
only for irregular edges, and intercept_to_edge_centroid then overwrites every
entry, so no user-visible data changes.
@WeiqunZhang
WeiqunZhang requested a review from atmyers September 3, 2026 17:57
@WeiqunZhang
WeiqunZhang merged commit 3c8c50c into AMReX-Codes:development Sep 12, 2026
80 checks passed
@WeiqunZhang
WeiqunZhang deleted the eb_intercept_sentinel branch September 12, 2026 03:31
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