pub fn vacuum_index(density: &[f64],
                    index: &[usize],
                    tolerance: Option<f64>)
                    -> Result<usize> {
    match tolerance {
        Some(tol) => {
            for (i, p) in index.iter().rev().enumerate() {
                if density[*p] > tol {
                    return Ok(index.len() - i);
                }
            }
            bail!(
                "Vacuum tolerance ({}) is higher than maximum value of density ({}).",
                tol,
                density[index[0]]
            )
        }
        None => Ok(index.len()),
    }
}
/// returns the first index that is not vacuum from a sorted index list
returns the first index that is not vacuum from a sorted index list
returns the first index that is not vacuum from a sorted index list
pub fn vacuum_index(density: &[f64],
                    index: &[usize],
                    tolerance: Option<f64>)
                    -> Result<usize> {
    match tolerance {
        Some(tol) => {
            for (i, p) in index.iter().rev().enumerate() {
                if density[*p] > tol {
                    return Ok(index.len() - i);
                }
            }
            bail!(
                "Vacuum tolerance ({}) is higher than maximum value of density ({}).",
                tol,
                density[index[0]]
            )
        }
        None => Ok(index.len()),
    }
}
pub fn vacuum_index ( density : & [ f64 ] , index : & [ usize ] , tolerance : Option < f64 > ) -> Result < usize > { match tolerance { Some ( tol ) => { for ( i , p ) in index . iter ( ) . rev ( ) . enumerate ( ) { if density [ * p ] > tol { return Ok ( index . len ( ) - i ) ; } } bail ! ( " " tol density [ index [ 0 ] ] ) } None => Ok ( index . len ( ) ) , } }
returns the first index that is not vacuum from a sorted index list
returns the first index that is not vacuum from a sorted index list
density
&[f64]
index
&[usize]
tolerance
Option<f64>
density
&[f64]
index
&[usize]
tolerance
Option<f64>