pub fn cell_ids(&mut self, plot: &mut Plot, mesh: &Mesh) -> Result<(), StrError> {
        // auxiliary
        let mut x = Vector::new(mesh.ndim);

        // loop over all cells
        for cell_id in 0..mesh.cells.len() {
            // compute coordinates at the center of cell
            let cell = &mesh.cells[cell_id];
            x.fill(0.0);
            for m in 0..cell.points.len() {
                for i in 0..mesh.ndim {
                    x[i] += mesh.points[cell.points[m]].coords[i];
                }
            }
            for i in 0..mesh.ndim {
                x[i] /= cell.points.len() as f64;
            }

            // add label
            if mesh.ndim == 2 {
                self.canvas_cell_ids
                    .draw(x[0], x[1], format!("{}({})", cell.id, cell.attribute_id).as_str());
            } else {
                self.canvas_cell_ids
                    .draw_3d(x[0], x[1], x[2], format!("{}({})", cell.id, cell.attribute_id).as_str());
            }
        }

        // add to plot
        plot.add(&self.canvas_cell_ids);
        Ok(())
    }
/// Draws ids and attributes of cells
///
/// # Input
///
/// * `plot` -- the plot instance (to be updated)
/// * `mesh` -- the mesh
Draws ids and attributes of cells
Draws ids and attributes of cells
pub fn cell_ids(&mut self, plot: &mut Plot, mesh: &Mesh) -> Result<(), StrError> {
        // auxiliary
        let mut x = Vector::new(mesh.ndim);
        // loop over all cells
        for cell_id in 0..mesh.cells.len() {
            // compute coordinates at the center of cell
            let cell = &mesh.cells[cell_id];
            x.fill(0.0);
            for m in 0..cell.points.len() {
                for i in 0..mesh.ndim {
                    x[i] += mesh.points[cell.points[m]].coords[i];
                }
            }
            for i in 0..mesh.ndim {
                x[i] /= cell.points.len() as f64;
            }
            // add label
            if mesh.ndim == 2 {
                self.canvas_cell_ids
                    .draw(x[0], x[1], format!("{}({})", cell.id, cell.attribute_id).as_str());
            } else {
                self.canvas_cell_ids
                    .draw_3d(x[0], x[1], x[2], format!("{}({})", cell.id, cell.attribute_id).as_str());
            }
        }
        // add to plot
        plot.add(&self.canvas_cell_ids);
        Ok(())
    }
pub fn cell_ids ( & mut self , plot : & mut Plot , mesh : & Mesh ) -> Result < ( ) , StrError > { // auxiliary let mut x = Vector :: new ( mesh . ndim ) ; // loop over all cells for cell_id in 0 .. mesh . cells . len ( ) { // compute coordinates at the center of cell let cell = & mesh . cells [ cell_id ] ; x . fill ( 0.0 ) ; for m in 0 .. cell . points . len ( ) { for i in 0 .. mesh . ndim { x [ i ] += mesh . points [ cell . points [ m ] ] . coords [ i ] ; } } for i in 0 .. mesh . ndim { x [ i ] /= cell . points . len ( ) as f64 ; } // add label if mesh . ndim == 2 { self . canvas_cell_ids . draw ( x [ 0 ] , x [ 1 ] , format ! ( " " cell id cell attribute_id ) . as_str ( ) ) ; } else { self . canvas_cell_ids . draw_3d ( x [ 0 ] , x [ 1 ] , x [ 2 ] , format ! ( " " cell id cell attribute_id ) . as_str ( ) ) ; } } // add to plot plot . add ( & self . canvas_cell_ids ) ; Ok ( ( ) ) }
Draws ids and attributes of cells
Draws ids and attributes of cells
&mut self
plot
&mut Plot
mesh
&Mesh
&mut self
plot
&mut Plot
mesh
&Mesh
input
`plot` -- the plot instance (to be updated)
`mesh` -- the mesh
` plot ` -- the plot instance ( to be updated ) ` mesh ` -- the mesh