feat(simulation): lakes from settled hydrology (D-227, T-1184)
Productionizes the T-1177 equilibrium solver: run_layer1 now solves hydrology once per body (~24ms, mirrors drainage::analyze) and carries it as TerrainAnalysis.hydrology; run_layer1_with_moisture threads the real body moisture ceiling (extracted derive_moisture_ceiling_q), with the T-1177 population-survey default as fallback. The resident rung-0 global tier does not exist yet (T-1181's scope) — hydrology rides TerrainAnalysis and lands in that tier for free when it is built (deviation recorded on the ticket). MorphologyZone::Lake is now sourced from the settled solver at derive time: a gridunit is Lake when bilinear-sampled filled surface exceeds bilinear-sampled original elevation at the sample's own (px, py) — the continuous comparison, so lake edges refine with rung like coastlines; never a discrete basin-cell projection. The gate sits strictly between OpenOcean (>= 80) and the old ocean_fraction heuristic (>= 60), which survives as the derive-fresh fallback when no solve is attached — byte-identical to pre-T-1184 output in that case. Static classification, distinct from the sim-state flooded plane; no endorheic bit (the drains-vs-closed cue is T-1185's outlet-course presence, per the D-227 amendment (4) sequencing). Zero new wire bytes. Acceptance: lake_classification_cache_hit_equals_cache_miss (solve twice independently, byte-identical zones, non-vacuous Lake hit) plus hydrology determinism tests. Golden fidelity: the window golden fixture now builds TerrainAnalysis through the production entry point (run_layer1_with_moisture, per-body), and a dedicated lake_bowl golden body pins the hydrology-sourced Lake path (morphology 1 at ocean_fraction_q 0 — provably not the heuristic); the 108 pre-existing golden rows are byte-identical (pure append). believability.json moved by one lake-shaped line (GJ338Bd voxel_relief_m 27->28, a correctly reclassified lake district leaving the dry-relief sample set). river_course and derivation-harness goldens unchanged. Full suite: 2114 passed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -252,8 +252,22 @@ pub fn run_cascade_from_heightmap(
|
||||
// run_layer1 now returns (Layer1Output, TerrainAnalysis); the TerrainAnalysis
|
||||
// is carried transiently on the snapshot so DistrictProfile + RoadGraph can
|
||||
// reuse it without the former ~45 ms redundant drainage re-run (T-1044).
|
||||
//
|
||||
// T-1184: settled-equilibrium hydrology solves inside run_layer1 as part
|
||||
// of this same pass (D-227 amendment (4), the AnalyzeBody cascade populate
|
||||
// point). When real BodyParams are available, derive the body's actual
|
||||
// moisture ceiling (hydrosphere/atmosphere) for the endorheic-vs-overflow
|
||||
// split rather than falling back to run_layer1's body-agnostic default —
|
||||
// this cascade entry point always has body_params in scope when the
|
||||
// caller supplied one, so there is no reason to leave it on the fallback.
|
||||
if up_to >= CascadeLayer::Topography {
|
||||
let (mut l1, ta) = layer1::run_layer1(&snapshot.heightmap);
|
||||
let (mut l1, ta) = match body_params {
|
||||
Some(params) => layer1::run_layer1_with_moisture(
|
||||
&snapshot.heightmap,
|
||||
district_profile::derive_moisture_ceiling_q(params),
|
||||
),
|
||||
None => layer1::run_layer1(&snapshot.heightmap),
|
||||
};
|
||||
// Stamp the province TerritorialStatus (D-212) onto each basin.
|
||||
for basin in &mut l1.drainage_basins {
|
||||
basin.territorial_status = territorial_status.clone();
|
||||
|
||||
Reference in New Issue
Block a user