pub(crate) fn extract_all_2d_edges(mesh: &Mesh) -> MapEdge2dToCells {
    assert_eq!(mesh.ndim, 2);
    let mut edges = HashMap::new();
    mesh.cells.iter().for_each(|cell| {
        if cell.kind.ndim() == 2 {
            for e in 0..cell.kind.nedge() {
                let mut edge_key: EdgeKey = (
                    cell.points[cell.kind.edge_node_id(e, 0)],
                    cell.points[cell.kind.edge_node_id(e, 1)],
                );
                sort2(&mut edge_key);
                let data = edges.entry(edge_key).or_insert(Vec::new());
                data.push((cell.id, e));
            }
        }
    });
    edges
}
/// Extracts all 2d edges (internal and boundary)
///
/// # Output
///
/// * Returns a map relating edge keys to `Vec<(cell_id, e)>` where:
///     - `cell_id` -- is the id of the cell sharing the edge
///     - `e` -- is the cell's local edge index
///
/// # Panics
///
/// 1. It panics if `shapes.len() != mesh.cells.len()` (i.e., the shapes vector and the mesh must be compatible)
/// 2. It panics if `mesh.ndim != 2` (i.e., this function works in 2D only)
Extracts all 2d edges (internal and boundary)
Extracts all 2d edges ( internal and boundary )
pub(crate) fn extract_all_2d_edges(mesh: &Mesh) -> MapEdge2dToCells {
    assert_eq!(mesh.ndim, 2);
    let mut edges = HashMap::new();
    mesh.cells.iter().for_each(|cell| {
        if cell.kind.ndim() == 2 {
            for e in 0..cell.kind.nedge() {
                let mut edge_key: EdgeKey = (
                    cell.points[cell.kind.edge_node_id(e, 0)],
                    cell.points[cell.kind.edge_node_id(e, 1)],
                );
                sort2(&mut edge_key);
                let data = edges.entry(edge_key).or_insert(Vec::new());
                data.push((cell.id, e));
            }
        }
    });
    edges
}
pub ( crate ) fn extract_all_2d_edges ( mesh : & Mesh ) -> MapEdge2dToCells { assert_eq ! ( mesh ndim 2 ) ; let mut edges = HashMap :: new ( ) ; mesh . cells . iter ( ) . for_each ( | cell | { if cell . kind . ndim ( ) == 2 { for e in 0 .. cell . kind . nedge ( ) { let mut edge_key : EdgeKey = ( cell . points [ cell . kind . edge_node_id ( e , 0 ) ] , cell . points [ cell . kind . edge_node_id ( e , 1 ) ] , ) ; sort2 ( & mut edge_key ) ; let data = edges . entry ( edge_key ) . or_insert ( Vec :: new ( ) ) ; data . push ( ( cell . id , e ) ) ; } } } ) ; edges }
Extracts all 2d edges (internal and boundary)
Extracts all 2d edges ( internal and boundary )
mesh
&Mesh
mesh
&Mesh
output
Returns a map relating edge keys to `Vec<(cell_id, e)>` where:
`cell_id` -- is the id of the cell sharing the edge
`e` -- is the cell's local edge index
Returns a map relating edge keys to ` Vec< ( cell_id e ) > ` where : ` cell_id ` -- is the id of the cell sharing the edge ` e ` -- is the cell ' s local edge index
panics
1. It panics if `shapes.len() != mesh.cells.len()`
2. It panics if `mesh.ndim != 2`
1 . It panics if ` shapes . len () ! = mesh . cells . len () ` 2 . It panics if ` mesh . ndim ! = 2 `