Skip to content

refactor(plot): better shared face finding for HFB plotting#2682

Merged
wpbonelli merged 6 commits into
modflowpy:developfrom
wpbonelli:shared-faces
Jan 31, 2026
Merged

refactor(plot): better shared face finding for HFB plotting#2682
wpbonelli merged 6 commits into
modflowpy:developfrom
wpbonelli:shared-faces

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Jan 16, 2026

Copy link
Copy Markdown
Member

Improve the shared face finding algorithm for HFB (Horizontal Flow Barrier) plotting. Factor out @jlarsen-usgs's index-based approach from #2671 into reusable function(s) and use it instead of floating point comparisons as before. Should be faster.

I moved the new face-related functions to a new module faceutil.py instead of plotutil.py as they are used not only for plotting but for export, and may be useful in other cases. I considered putting them in gridutil.py but that is used by the grid classes, while the face functions use the grid classes, so it would have created a circular import.

I also changed the name of is_vertical_barrier -> is_vertical and inverted the semantics so it works on faces, not barriers (a face between horizontally adjacent cells is a vertical polygon, and a face between vertically adjacent cells is a horizontal polygon, but we call the former a "horizontal" flow barrier and the latter a "vertical" flow barrier). I figure writing these utils in terms of faces for the general case makes sense, and just interpreting the results for the specific case of HFBs.

This PR builds on

Some ad hoc cell ID -> node number conversion utilities are removed and get_node() used instead.

I am classifying all this a refactor though it introduces a new utility module, as the new utils are in service of the refactor.

@wpbonelli wpbonelli added the refactor Non-functional changes label Jan 16, 2026
@codecov

codecov Bot commented Jan 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.51351% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.3%. Comparing base (556c088) to head (663aceb).
⚠️ Report is 122 commits behind head on develop.

Files with missing lines Patch % Lines
flopy/utils/faceutil.py 62.5% 52 Missing ⚠️
flopy/mf6/mfpackage.py 0.0% 1 Missing ⚠️
flopy/modflow/mfhfb.py 0.0% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2682      +/-   ##
===========================================
+ Coverage     55.5%    72.3%   +16.8%     
===========================================
  Files          644      669      +25     
  Lines       124135   130180    +6045     
===========================================
+ Hits         68947    94221   +25274     
+ Misses       55188    35959   -19229     
Files with missing lines Coverage Δ
flopy/plot/crosssection.py 64.5% <100.0%> (-2.6%) ⬇️
flopy/plot/map.py 81.5% <100.0%> (-0.6%) ⬇️
flopy/plot/plotutil.py 51.2% <100.0%> (-5.6%) ⬇️
flopy/mf6/mfpackage.py 67.3% <0.0%> (-14.3%) ⬇️
flopy/modflow/mfhfb.py 84.2% <0.0%> (-0.3%) ⬇️
flopy/utils/faceutil.py 62.5% <62.5%> (ø)

... and 559 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wpbonelli wpbonelli force-pushed the shared-faces branch 3 times, most recently from 124ebd5 to 2a769cd Compare January 17, 2026 01:19
@wpbonelli wpbonelli added this to the 3.10 milestone Jan 17, 2026
@wpbonelli wpbonelli marked this pull request as ready for review January 23, 2026 13:20
@wpbonelli wpbonelli merged commit 41f1840 into modflowpy:develop Jan 31, 2026
31 of 32 checks passed
@wpbonelli wpbonelli deleted the shared-faces branch January 31, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement refactor Non-functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants