fn determine_time_step(&self) -> f64 {
        // Find the length of the largest velocity vector.
        let mut velocity_norm_max = f64::NEG_INFINITY;

        for i in 0..self.w {
            for j in 0..self.h {
                // Get the velocity vector at the center of cell (i, j).
                let velocity_x = self.get_interpolated_quantity(&self.u, i as f64, j as f64);
                let velocity_y = self.get_interpolated_quantity(&self.v, i as f64, j as f64);
                let length = (velocity_x * velocity_x + velocity_y * velocity_y).sqrt();

                if length > velocity_norm_max {
                    velocity_norm_max = length;
                }
            }
        }

        let delta_t = (self.max_grid_cell_traversal as f64 * self.grid_cell_size) / velocity_norm_max;

        delta_t
    }
/// Determines an appropriate timestep, given the current
/// state of the velocity field.
Determines an appropriate timestep, given the current
state of the velocity field.
Determines an appropriate timestep given the current state of the velocity field .
fn determine_time_step(&self) -> f64 {
        // Find the length of the largest velocity vector.
        let mut velocity_norm_max = f64::NEG_INFINITY;
        for i in 0..self.w {
            for j in 0..self.h {
                // Get the velocity vector at the center of cell (i, j).
                let velocity_x = self.get_interpolated_quantity(&self.u, i as f64, j as f64);
                let velocity_y = self.get_interpolated_quantity(&self.v, i as f64, j as f64);
                let length = (velocity_x * velocity_x + velocity_y * velocity_y).sqrt();
                if length > velocity_norm_max {
                    velocity_norm_max = length;
                }
            }
        }
        let delta_t = (self.max_grid_cell_traversal as f64 * self.grid_cell_size) / velocity_norm_max;
        delta_t
    }
fn determine_time_step ( & self ) -> f64 { // Find the length of the largest velocity vector. let mut velocity_norm_max = f64 :: NEG_INFINITY ; for i in 0 .. self . w { for j in 0 .. self . h { // Get the velocity vector at the center of cell (i, j). let velocity_x = self . get_interpolated_quantity ( & self . u , i as f64 , j as f64 ) ; let velocity_y = self . get_interpolated_quantity ( & self . v , i as f64 , j as f64 ) ; let length = ( velocity_x * velocity_x + velocity_y * velocity_y ) . sqrt ( ) ; if length > velocity_norm_max { velocity_norm_max = length ; } } } let delta_t = ( self . max_grid_cell_traversal as f64 * self . grid_cell_size ) / velocity_norm_max ; delta_t }
Determines an appropriate timestep, given the current
state of the velocity field.
Determines an appropriate timestep given the current state of the velocity field .
&self
&self