Skip to content

fix(core): crashes without a domain or after clear[], and the arrival-time exports - #229

Merged
filippi merged 4 commits into
forefireAPI:devfrom
HugoFara:fix/no-domain-and-grid-exports
Oct 29, 2026
Merged

filippi merged 4 commits into
forefireAPI:devfrom
HugoFara:fix/no-domain-and-grid-exports

Conversation

@HugoFara

Copy link
Copy Markdown
Collaborator

Four kernel bugs found while building the ensembles of #228, one commit each:

  • No domain: FireNode, FireFront, startFire, goTo, save[], trigger[fuel], trigger[fuelIndice], @t/@nowplus scheduling and FireDomain[...] with missing options segfaulted. A failed loadData followed by startFire was enough. They now print an error.
  • clear[] then a new domain crashed on the first startFire: the static DataBroker layer shortcuts kept pointing at the deleted layers, so the new domain had no altitude layer.
  • BMap was all zeros: its recomputation was commented out in 6f83d42. This is a separate commit, so it is easy to drop if that was on purpose.
  • plot[...;filename=*.asc] wrote one row per x at 6 significant digits. It now writes a valid ESRI grid (rows = y, north first) at full precision.

Tested: new commands unit suite (crashes on dev), ctest 10/10 at every commit, runff matches its references, Python suites pass. Not run under ASan locally; the CI sanitizer job covers it.

Drafted with Claude Opus 5.5.

FireNode, FireFront, startFire, goTo, save[], trigger[fuel] and
trigger[fuelIndice] dereferenced the domain before checking it, so a
script whose loadData had failed segfaulted on its next startFire. So did
any command scheduled with @t or @nowplus, whose time table only exists
with a domain, and a FireDomain[...] with missing options, whose error
message printed the ID of the domain it had failed to create.

They now print an error and return. clear[] without a domain does nothing.
The DataBroker shortcuts (altitudeLayer, windULayer, ...) are static, and
the destructor deleted the layers they point to without resetting them.
The next domain's broker found them set, skipped creating its altitude
and wind layers, and the first startFire dereferenced a null altitude
layer. The destructor now resets the shortcuts that point into its own
layers, so a second domain alive at the same time keeps its own.
BurningMapLayer::getMatrix() has returned an all-zero map since its
recomputation was commented out in 6f83d42, so getDoubleArray("BMap")
from Python never held the arrival times. Nothing else reads the layer
through getMatrix(), so recomputing it costs only when it is asked for,
and at most once per simulation time.
writeASCII() wrote one row per x, south to north, with ncols and nrows
swapped, so a GIS read the map transposed and flipped. It now writes one
row per y from the north edge, as the format requires. It also wrote the
default six significant digits, which rounds arrival times beyond
100000 s to 10 s; values are now written at full precision.
HugoFara added a commit to HugoFara/forefire that referenced this pull request Oct 28, 2026
…PI#229)

forefireAPI#229 makes plot[...;filename=*.asc] write a valid ESRI grid, one row per
y from the north edge, so arrival_time flips it instead of transposing it.
@filippi
filippi merged commit 5d1b8bf into forefireAPI:dev Oct 29, 2026
6 checks passed
HugoFara added a commit to HugoFara/forefire that referenced this pull request Oct 29, 2026
…PI#229)

forefireAPI#229 makes plot[...;filename=*.asc] write a valid ESRI grid, one row per
y from the north edge, so arrival_time flips it instead of transposing it.
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