How firelab/wfips works
WFIPS is a C++ wildfire planning and simulation codebase with three major layers: a geospatial/visual analysis front end, a simulation and resource-modeling core, and embedded fire-behavior / weather-model libraries.
1. Overall shape
The repository is not a single app; it is a multi-target workspace built with CMake. The main functional areas are irs/ (core WFIPS logic and GUI), fig/ (fire investment geometry/raster support), common/ (shared utilities), flammap/ (integrated FlamMap fire behavior code), nfdrs/ (fire danger rating calculations), and sqlite/ (vendored SQLite).
2. Core WFIPS simulation engine
irs/src is the heart of the system. It contains the WFIPS domain model, scenario runner, result objects, and the main simulation pipeline. Key roles here are RunScenario, Results, wfips_result, irs_result, irs_export_result, wfips_data, and wfips.cpp. This layer is responsible for turning planning inputs into computed outcomes.
3. Resource, dispatch, and containment modeling
A large part of irs/src models wildfire response resources and suppression behavior. Classes such as Airtanker, Helicopter, Smokejumper, Crew, Engine, WaterTender, Helitack, LocalDispatcher, GACCDispatcher, NatDispatcher, Contain, ContainSim, ContainForce, and ContainResource show that the simulation includes dispatch logic, resource arrival/production rates, and fire containment progression.
4. Wildfire planning / investment domain objects
WFIPS-specific concepts are represented by classes like FWA, Fire, Escape, FPU, DispLoc, DispatchBase, DispLogic, CRescType, RescWorkYear, and ProdRates. These encode planning structures such as fire planning units, dispatch locations, and resource capability/cost assumptions.
5. Data ingestion and persistence
The workflow appears to load planning data into a SQLite-backed model. wfips_data_load, data_load, wfips_sqlite, and wfips_data_test indicate structured import and validation of scenario data. The vendored SQLite library and the presence of wfips_sqlite.h/.cpp suggest local file-based persistence rather than a remote database service.
6. Geospatial and raster analysis layer
fig/src provides the geometry-heavy side of the application: fig, fig_load, fig2scenario, raster_access, and frisk. This layer likely translates spatial datasets into scenario inputs, accesses raster layers, and supports analysis areas or treatment polygons. The top-level doc/ files such as analysisarea.md, dispatchlocations.md, and fueltreatment.md reinforce that GIS layers are first-class inputs.
7. User interface boundary
The interactive UI lives in irs/src/gui and is built with Qt, with additional QGIS integration implied by the build modules. The GUI includes main-window orchestration, dialogs for adding layers, editing dispatch/resource data, identifying features, exporting results, and map tools for selection and inspection. This UI layer sits on top of the core engine and geospatial model; it does not appear to implement the simulation itself.
8. Fire behavior and environment libraries
The repository embeds two major model families: flammap/ and nfdrs/. FlamMap is included as a substantial, platform-specific codebase for fire behavior / spread calculations, with separate Windows and Linux sources. nfdrs/ contains the National Fire Danger Rating System implementation. These libraries are supporting computational engines consumed by the WFIPS core rather than user-facing components.
9. Shared utilities and math/time support
common/src contains reusable helpers such as conversions, random-number utilities, time utilities, tree structures, masking, and sunrise/sunset calculations. These are low-level dependencies used across the simulation and analysis code, especially where time, geometry, or stochastic behavior needs to be consistent across modules.
10. Build and platform boundaries
The build is CMake-driven, with custom FindQGIS, FindGEOS, FindSPATIALITE, and FindSqlite3 modules showing external dependency integration. The flammap subtree has both Windows and Linux variants, which is a clear architectural boundary for platform-specific legacy code. The presence of vendored sqlite/ and older flammap sources suggests the repo packages its computational dependencies directly rather than relying entirely on system installs.
11. Testing structure
autotest/ contains C++ unit/integration tests for the core IRS/WFIPS logic and related components. There are tests for containment, result handling, tree structures, load paths, and conversion logic, indicating that most verification is focused on the simulation engine and data model rather than the UI.
12. Documentation and scenario semantics
The doc/ directory is not just project prose; it documents the domain objects and outputs the system expects, including agencies, management objectives, large fires, prepositioning, dispatch locations, and simulation parameters. For an architecture diagram, this is useful because it confirms the conceptual pipeline: spatial and agency inputs feed scenario construction, which feeds simulation, which produces results for analysis and export.
In short, the architectural boundary is: spatial/planning data and GIS layers enter through the GUI and data loaders, are normalized into WFIPS domain objects, passed into the simulation/containment engine, enriched by FlamMap/NFDRS computations, and then returned as result/export objects for analysis and visualization.
Main entry points: wfipsmainwindow.cpp Main window · wfips.cpp WFIPS engine · RunScenario.cpp Scenario run · wfips_data.cpp WFIPS data
Components 23
WFIPS core
Scenario, resource, containment, and persistence logic in the main simulation engine.
- WFIPS engine · Top-level WFIPS orchestration and domain entry point.
irs/src/wfips.cpp - Scenario run · Builds and executes planning scenarios.
irs/src/RunScenario.cpp - Results · Simulation outputs and result aggregation.
irs/src/Results.cpp - WFIPS result · WFIPS-specific result representation.
irs/src/wfips_result.cpp - WFIPS data · Normalized planning inputs and domain data objects.
irs/src/wfips_data.cpp - Data load · Scenario and model data loading routines.
irs/src/data_load.cpp - SQLite bridge · Local SQLite-backed persistence and scenario storage.
irs/src/wfips_sqlite.cpp - Dispatch logic · Dispatch-base and dispatcher coordination for response resources.
irs/src/DispLogic.cpp - Containment · Containment simulation and fire progression modeling.
irs/src/ContainSim.cpp - Resources · Aircraft, crews, engines, and work-year/resource capability models.
irs/src/Rescbase.cpp
Geospatial ingest
Geometry, raster access, and scenario-building boundary.
- FIG load · Geometry and raster loading for analysis inputs.
fig/src/fig_load.cpp - FIG to scenario · Converts spatial inputs into WFIPS scenarios.
fig/src/fig2scenario.cpp - Raster access · Raster and spatial layer access helpers.
fig/src/raster_access.cpp
GUI
Qt/QGIS-facing interactive boundary for map and data workflows.
- Main window · Primary GUI shell and map-oriented application orchestration.
irs/src/gui/wfipsmainwindow.cpp - Layer dialog · Adds and manages GIS layers and inputs.
irs/src/gui/wfipsaddlayerdialog.cpp - Dispatch editor · Edits dispatch, resource, and planning parameters.
irs/src/gui/wfipsdispatcheditdialog.cpp - Identify tool · Feature identification and inspection on the map canvas.
irs/src/gui/wfipsidentifymaptool.cpp - Export dialog · Exports simulation outputs for analysis and reporting.
irs/src/gui/wfipsexportdialog.cpp
Embedded models
Fire-behavior and fire-danger libraries bundled into the workspace.
Shared/platform
Reusable utilities, vendored database, build integration, and docs/tests.
- Common utils · Conversions, randomness, time, masking, and tree utilities.
common/src/omffr_conv.cpp - SQLite · Bundled SQLite engine used for local persistence.
sqlite/sqlite3.c - Docs · Domain semantics and scenario/result documentation.
doc/index.md
Connections 24
- Main window → WFIPS engine: runs · GUI drives the core WFIPS engine.
- Main window → Layer dialog: manages · Main window opens layer/input dialogs.
- Main window → Dispatch editor: edits · Main window exposes dispatch/resource editing.
- Main window → Identify tool: inspects · Main window uses map identify tools.
- Main window → Export dialog: exports · Main window triggers result export.
- FIG load → Raster access: reads · Spatial ingestion depends on raster access.
- FIG load → FIG to scenario: builds · Geometry inputs are transformed into scenarios.
- FIG to scenario → WFIPS data: feeds · Spatial analysis contributes normalized scenario data.
- Data load → WFIPS data: loads · Loader materializes WFIPS domain objects.
- WFIPS data → Scenario run: configures · Domain data parameterize scenario execution.
- Scenario run → Dispatch logic: uses · Scenario execution invokes dispatch logic.
- Scenario run → Containment: simulates · Scenario execution advances containment outcomes.
- Dispatch logic → Resources: allocates · Dispatch selects and schedules response resources.
- Containment → Resources: consumes · Containment simulation uses resource capabilities.
- WFIPS engine → Results: produces · Core engine aggregates simulation results.
- Results → WFIPS result: specializes · WFIPS result is a domain-specific result form.
- SQLite bridge → SQLite: stores · WFIPS persistence is backed by SQLite.
- Data load → SQLite bridge: persists · Loaded scenario data can be written/read locally.
- WFIPS engine → FlamMap: calls · WFIPS core uses fire-behavior computations.
- WFIPS engine → NFDRS: calls · WFIPS core uses fire-danger calculations.
- Common utils → Scenario run: supports · Shared utilities underpin execution and modeling.
- Common utils → FIG load: supports · Common helpers support spatial processing.
- Docs → WFIPS data: describes · Documentation defines planning inputs and semantics.
- Docs → Results: describes · Documentation defines result concepts.