Add configurable spread neighborhood radius (SpreadRad)#232
Open
DLWoodruff wants to merge 1 commit into
Open
Conversation
Port of the SpreadRad feature from cell2fire/Cell2Fire#136 and fire2a/C2FK#3, adapted to C2F-W. A new --SpreadRad option controls how far a burning cell can send spread messages: 1 (default) is the legacy immediate neighborhood; n includes (2n+1)^2 - 1 candidate neighbors. adjacentCells() takes a radius and returns the box of in-bounds neighbors. Because a radius greater than 1 makes several neighbors share an integer bearing, the per-cell spread bookkeeping (ROSAngleDir, angleDict, fireProgress, distToCenter) is rekeyed from angle to neighbor id, the angleToNb map is removed, and a new selectHeadCell() picks the neighbor closest to the wind azimuth for the slope calculation. The cleaning step in Cell2Fire.cpp erases the burnt cell from each neighbor's maps by id. SpreadRad 1 reproduces legacy results exactly; SpreadRad >= 2 spreads further. Adds test/spreadrad_test.sh and a CI step in build-debian.yml. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a
--SpreadRadoption that controls how far a burning cell can send spread messages in one neighborhood-layer definition. This ports the SpreadRad feature already merged in cell2fire/Cell2Fire#136 and proposed in fire2a/C2FK#3, adapted to C2F-W's code.--SpreadRad 1(default): immediate neighborhood — identical to current behavior--SpreadRad 2: one extra ring; in general(2n+1)² − 1candidate neighbors for radiusnThe model keeps the original assumption that outgoing spread from a source cell
iuses the ROS computed at source cellifor all candidate destinations.Implementation notes
adjacentCells()takes aradiusand returns the in-bounds neighbor box. Because a radius > 1 makes several neighbors share the same integer bearing, the old angle-keyed bookkeeping had to change:ROSAngleDir,angleDict,fireProgress,distToCenterare now keyed by neighbor id (previously some were keyed by integer angle).angleToNbmap is removed; a newselectHeadCell(windAzimuth)picks the neighbor closest to the wind azimuth for the slope calculation (replacingangleToNb[waz]).Cell2Fire.cppremoves a burnt cell from each neighbor's maps by cell id.initializeFireFields()andadjacentCells()gain the radius parameter;--SpreadRadis parsed inReadArgs(default 1, clamped to ≥ 1) and echoed in the run output.Verification
Built with g++ (c++14) and run on
test/model/kitral-asc(--sim K, seed 123):--SpreadRad 1reproduces the pre-change binary's burned-cell counts exactly (e.g.2,18,21,8,9,…), so the default path is unchanged.--SpreadRad 2spreads further (total burned ~403 → ~748 over 30 sims on the kitral instance).test/spreadrad_test.sh(asserts default ==--SpreadRad 1, that--SpreadRad 2is reported, and that radius 2 burns ≥ radius 1) and wires it intobuild-debian.yml. The script passes locally.I have not looked at the effect on any high-wind fires, which someone should do before you merge this.
🤖 Generated with Claude Code