Repository navigation
Description
Status: done
Part of #3228. Depends on #3239. The words of #3228 apply.
TL;DR
Goal: The preparation of the profiles uses flat 32-bit working columns, and the terrain keeps a bounded number of decoded squares. The Switzerland preparation then peaks at about 3 GB instead of 7.3 GB (target), and the package keeps the same bytes.
Problem: For each profile, the preparation keeps the full cost curve of every road and 64-bit cost arrays, the spatial index is a map of sets, connectivity builds its own copy of the topology, and the routing step decodes every terrain square of the region at once (see the Facts of #3228).
Decision: The preparation keeps cost totals and cost-basis indices, 32-bit working columns, one topology, a sorted list for the spatial index, and closures that it computes road by road. obc-dem decodes a terrain square when a height needs it, and keeps at most 12 squares.
Systems: routing, source-preparation
Contracts: none
Size: M (two systems, about 600 changed lines)
Plan
cost.rs:Costing::newtakes the cost-basis dictionary (&mut base::Dictionary) and keeps two columns per road: the total cost and the dictionary index of its cost basis. It drops each cost curve after it takes the total;roads: Vec<Option<RoadCost>>goes.base::metrictakes the indices instead of the bases.lib.rsandbase.rs: the bake builds the topology (first,head) once from the sorted edges.write_topology, the turn costs andconnectivity::Statesread it, andconnectivitybuilds only the reverse arcs.lib.rs: the road totals and the turn costs areu32working columns. The all-ones value means "unavailable", as in the stored columns, and a finite value that does not fit is an error. All the consumers take these columns:base::metric,landmarks::Junctions::prepareandconnectivity::States::snappable.planner_router::base::write_columntakes its values as an iterator ofu64; the bake mapsu32::MAXtou64::MAXon the way in. So the writer picks the stored width from the largest finite value as today, and the bytes stay the same.lib.rs, spatial index: the bake collects (cell, road) pairs, sorts them, and removes repeated pairs, as theBTreeSetdoes today. Then it walks the sorted list once: each run of one cell gives the road list of that cell, and each run of one one-degree key gives one directory object. The objects are the same as today.lib.rs, closures:Doubts.roadsstays one byte per road, and the bake computes it before the costing. The closure sets of a road are computed again from its tags whileClosures::buildreads them, so no road keeps aVecof closures.host/obc-dem/src/planner.rs: the GLO-30 files are indexed by square (latitude and longitude).Terrain::heightkeeps its&selfsignature. AMutexholds the decoded squares, asdecodeddoes for the reference tiles. When a height needs a square that is not decoded,heightdecodes it and drops the oldest square beyond 12. With at most 52 MB per square, the squares take at most about 0.6 GB, and with the 1 GiB of reference tiles the terrain stays under 2 GB.loadstays for the terrain tile sweep ofterrarium.rs, and loaded squares count toward the same bound only whenheightdecoded them.step.rsno longer loads the terrain of the whole region.terrain::applysorts the roads by the GLO-30 square of their first point (latitude, then longitude), then by fine cell. A height near the edge of a square reads at most the four squares around it.- New test in
host/obc-dem/tests/planner.rs: heights withoutloadequal the heights afterload, and the number of decoded squares stays at or below the bound.
Done when
obc test -p planner-router-build,obc test -p obc-demand clippy on both crates pass.- A Switzerland bake gives the same manifest ID as before.
- The pull request records the peak of each stage of a Switzerland bake, before and after.
Generated by Claude Code
Activity