MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/splashsurf / for_each

Method for_each

splashsurf_lib/src/density_map.rs:302–311  ·  view source on GitHub ↗

Calls a closure for each `(flat_point_index, density_value)` tuple in the map

(&self, f: F)

Source from the content-addressed store, hash-verified

300
301 /// Calls a closure for each `(flat_point_index, density_value)` tuple in the map
302 pub fn for_each<F: FnMut(I, R)>(&self, f: F) {
303 let mut f = f;
304 match self {
305 DensityMap::Standard(map) => map.iter().for_each(|(&i, &r)| f(i, r)),
306 DensityMap::DashMap(map) => map.iter().for_each(|(&i, &r)| f(i, r)),
307 DensityMap::Dense(values) => values.iter().copied().enumerate().for_each(|(i, r)| {
308 f(I::from_usize(i).unwrap(), r);
309 }),
310 }
311 }
312}
313
314/// Computes a sparse density map for the fluid based on the specified background grid

Calls 1

iterMethod · 0.45

Tested by 1

test_half_edge_meshFunction · 0.64