style(simulation): cargo fmt on the workshop benches (gate bounce; clippy and tests were green)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 10:59:34 +02:00
co-authored by Claude Fable 5
parent 4e2d56f40f
commit f44f9a2067
3 changed files with 56 additions and 47 deletions
+29 -19
View File
@@ -303,7 +303,8 @@ fn bench_population_survey_all_committed_bodies() {
use rayon::prelude::*;
use settled_reach_server::atlas::hydrology_equilibrium::{BasinOutcome, DownstreamTarget};
let wiki_root = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../wiki/star-systems");
let wiki_root =
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../wiki/star-systems");
// Discover every committed heightmap PNG (deterministic ordering: sort
// by path so the survey's own reporting order is stable run-to-run —
@@ -357,10 +358,11 @@ fn bench_population_survey_all_committed_bodies() {
.unwrap_or("UNKNOWN")
.to_string();
let heightmap = settled_reach_server::atlas::heightmap::load_heightmap_png(
path, &body_id, 0.3,
)
.unwrap_or_else(|e| panic!("decode committed heightmap for {body_id} ({path:?}): {e}"));
let heightmap =
settled_reach_server::atlas::heightmap::load_heightmap_png(path, &body_id, 0.3)
.unwrap_or_else(|e| {
panic!("decode committed heightmap for {body_id} ({path:?}): {e}")
});
let small = heightmap.downsample(512, 256);
let t_solve = Instant::now();
@@ -439,9 +441,7 @@ fn bench_population_survey_all_committed_bodies() {
println!(
" carved-outlet basins (channel_depth_scaled > 0 at spill cell, summed): {total_carved_cells}"
);
println!(
" cliff_edge=true cells (summed across population): {total_cliff_edge_cells}"
);
println!(" cliff_edge=true cells (summed across population): {total_cliff_edge_cells}");
println!(
" bodies with ANY cliff_edge cell: {bodies_with_any_carving} / {body_count} ({:.2}%)",
100.0 * bodies_with_any_carving as f64 / body_count as f64
@@ -474,12 +474,9 @@ fn bench_population_survey_all_committed_bodies() {
== Some(top.body_id.as_str())
})
.expect("outlier body path must exist (found via the same walk above)");
let heightmap = settled_reach_server::atlas::heightmap::load_heightmap_png(
path,
&top.body_id,
0.3,
)
.expect("re-decode outlier heightmap for determinism spot-check");
let heightmap =
settled_reach_server::atlas::heightmap::load_heightmap_png(path, &top.body_id, 0.3)
.expect("re-decode outlier heightmap for determinism spot-check");
let small = heightmap.downsample(512, 256);
let r1 = solve(&small.data, 512, 256, small.sea_level, default_climate());
let r2 = solve(&small.data, 512, 256, small.sea_level, default_climate());
@@ -634,11 +631,24 @@ fn bench_per_basin_size_distribution_real_population() {
println!("\n=== PER-BASIN SIZE DISTRIBUTION: {n} basins, real 267-body population, 512x256 working grid ===");
println!(" total lake cells (cross-check vs population survey's 2,694,012): {total}");
println!(" min={}, max={}, mean={:.1}, median(p50)={}",
sizes[0], sizes[n - 1], total as f64 / n as f64, percentile(50.0));
println!(" percentiles: p10={} p25={} p50={} p75={} p90={} p95={} p99={} p99.9={}",
percentile(10.0), percentile(25.0), percentile(50.0), percentile(75.0),
percentile(90.0), percentile(95.0), percentile(99.0), percentile(99.9));
println!(
" min={}, max={}, mean={:.1}, median(p50)={}",
sizes[0],
sizes[n - 1],
total as f64 / n as f64,
percentile(50.0)
);
println!(
" percentiles: p10={} p25={} p50={} p75={} p90={} p95={} p99={} p99.9={}",
percentile(10.0),
percentile(25.0),
percentile(50.0),
percentile(75.0),
percentile(90.0),
percentile(95.0),
percentile(99.0),
percentile(99.9)
);
println!("\n Histogram (basin cell-count buckets):");
for (i, (_, _, label)) in buckets.iter().enumerate() {