pub fn get_lakes<F: Float>(
    map_size_lg: MapSizeLg,
    h: impl Fn(usize) -> F,
    downhill: &mut [isize]
) -> (usize, Box<[i32]>, Box<[u32]>, F)
Expand description

Algorithm for finding and connecting lakes. Assumes newh and downhill have already been computed. When a lake’s value is negative, it is its own lake root, and when it is 0, it is on the boundary of Ω.

Returns a 4-tuple containing:

  • The first indirection vector (associating chunk indices with their lake’s root node).
  • A list of chunks on the boundary (non-lake egress points).
  • The second indirection vector (associating chunk indices with their lake’s adjacency list).
  • The adjacency list (stored in a single vector), indexed by the second indirection vector.