pub fn check_2d_edge_normals(
    mesh: &Mesh,
    edges: &HashMap<EdgeKey, Edge>,
    solutions: &HashMap<EdgeKey, [f64; 2]>,
    tolerance: f64,
) -> Result<(), StrError> {
    let ksi = &[0.0, 0.0];
    let mut normal = Vector::new(mesh.ndim);
    for (edge_key, solution) in solutions {
        let edge = edges.get(edge_key).ok_or("cannot find edge_key in edges map")?;
        let mut pad = Scratchpad::new(mesh.ndim, edge.kind)?;
        set_pad_coords(&mut pad, &edge.points, mesh);
        op::calc_normal_vector(&mut normal, &mut pad, ksi)?;
        // shape.calc_boundary_normal(&mut normal, &mut state, ksi)?;
        for i in 0..mesh.ndim {
            if f64::abs(normal[i] - solution[i]) > tolerance {
                return Err("wrong 2d edge normal vector found");
            }
        }
    }
    Ok(())
}
/// Checks if normal vectors of some 2D edges are correct
Checks if normal vectors of some 2D edges are correct
Checks if normal vectors of some 2D edges are correct
pub fn check_2d_edge_normals(
    mesh: &Mesh,
    edges: &HashMap<EdgeKey, Edge>,
    solutions: &HashMap<EdgeKey, [f64; 2]>,
    tolerance: f64,
) -> Result<(), StrError> {
    let ksi = &[0.0, 0.0];
    let mut normal = Vector::new(mesh.ndim);
    for (edge_key, solution) in solutions {
        let edge = edges.get(edge_key).ok_or("cannot find edge_key in edges map")?;
        let mut pad = Scratchpad::new(mesh.ndim, edge.kind)?;
        set_pad_coords(&mut pad, &edge.points, mesh);
        op::calc_normal_vector(&mut normal, &mut pad, ksi)?;
        // shape.calc_boundary_normal(&mut normal, &mut state, ksi)?;
        for i in 0..mesh.ndim {
            if f64::abs(normal[i] - solution[i]) > tolerance {
                return Err("wrong 2d edge normal vector found");
            }
        }
    }
    Ok(())
}
pub fn check_2d_edge_normals ( mesh : & Mesh , edges : & HashMap < EdgeKey , Edge > , solutions : & HashMap < EdgeKey , [ f64 ; 2 ] > , tolerance : f64 , ) -> Result < ( ) , StrError > { let ksi = & [ 0.0 , 0.0 ] ; let mut normal = Vector :: new ( mesh . ndim ) ; for ( edge_key , solution ) in solutions { let edge = edges . get ( edge_key ) . ok_or ( " " ) ? ; let mut pad = Scratchpad :: new ( mesh . ndim , edge . kind ) ? ; set_pad_coords ( & mut pad , & edge . points , mesh ) ; op :: calc_normal_vector ( & mut normal , & mut pad , ksi ) ? ; // shape.calc_boundary_normal(&mut normal, &mut state, ksi)?; for i in 0 .. mesh . ndim { if f64 :: abs ( normal [ i ] - solution [ i ] ) > tolerance { return Err ( " " ) ; } } } Ok ( ( ) ) }
Checks if normal vectors of some 2D edges are correct
Checks if normal vectors of some 2D edges are correct
mesh
&Mesh
edges
&HashMap<EdgeKey, Edge>
solutions
&HashMap<EdgeKey, [f64; 2]>
tolerance
f64
mesh
&Mesh
edges
&HashMap<EdgeKey, Edge>
solutions
&HashMap<EdgeKey, [f64; 2]>
tolerance
f64