Calls a closure for each `(flat_point_index, density_value)` tuple in the map
(&self, f: F)
| 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 |