Skip to main content

step_scratch_store

Function step_scratch_store 

Source
pub fn step_scratch_store<M, S>(
    model: &M,
    store: &mut S,
    walls: &[WallSegment],
    params: &M::Params,
    dt: f64,
    scratch: &mut Scratch,
    peds_buf: &mut Vec<Pedestrian>,
)
Expand description

Zero-allocation AgentStore adapter for any 2-D crowd model.

Unpacks every agent’s Pedestrian into peds_buf (which the caller owns and reuses across ticks), runs one model tick via CrowdStep::step, and writes the updated state back into the store. peds_buf is cleared at the start of every call; its capacity is retained, so after the first tick this function does not allocate.

The AgentId → pedestrian ordering is stable across the extract and write-back phases because both iterate store.iter_ids().