fn build_rhs(&mut self) {
        let scale = 1.0 / self.grid_cell_size;

        // Technically, we only need to do this calculation for cells that
        // contain fluid. Since we aren't currently using markers, we just
        // iterate over the entire field.
        for i in 0..self.w {
            for j in 0..self.h {
                // Calculate the divergence of the velocity field at (i, j).
                let div_u_x = self.u.get(i + 1, j) - self.u.get(i, j);
                let div_v_y = self.v.get(i, j + 1) - self.v.get(i, j);
                let div = div_u_x + div_v_y;

                // The negative divergence becomes the right-hand side of the
                // pressure equation.
                self.rhs.set(i, j, -scale * div);
            }
        }
    }
/// Build the right-hand side of pressure equation.
Build the right-hand side of pressure equation.
Build the right - hand side of pressure equation .
fn build_rhs(&mut self) {
        let scale = 1.0 / self.grid_cell_size;
        // Technically, we only need to do this calculation for cells that
        // contain fluid. Since we aren't currently using markers, we just
        // iterate over the entire field.
        for i in 0..self.w {
            for j in 0..self.h {
                // Calculate the divergence of the velocity field at (i, j).
                let div_u_x = self.u.get(i + 1, j) - self.u.get(i, j);
                let div_v_y = self.v.get(i, j + 1) - self.v.get(i, j);
                let div = div_u_x + div_v_y;
                // The negative divergence becomes the right-hand side of the
                // pressure equation.
                self.rhs.set(i, j, -scale * div);
            }
        }
    }
fn build_rhs ( & mut self ) { let scale = 1.0 / self . grid_cell_size ; // Technically, we only need to do this calculation for cells that // contain fluid. Since we aren't currently using markers, we just // iterate over the entire field. for i in 0 .. self . w { for j in 0 .. self . h { // Calculate the divergence of the velocity field at (i, j). let div_u_x = self . u . get ( i + 1 , j ) - self . u . get ( i , j ) ; let div_v_y = self . v . get ( i , j + 1 ) - self . v . get ( i , j ) ; let div = div_u_x + div_v_y ; // The negative divergence becomes the right-hand side of the // pressure equation. self . rhs . set ( i , j , - scale * div ) ; } } }
Build the right-hand side of pressure equation.
Build the right - hand side of pressure equation .
&mut self
&mut self