pub fn weight(density: &[f64],
              voxel_map: &VoxelMap,
              index: &[usize],
              progress_bar: Bar,
              threads: usize,
              weight_tolerance: f64) {
    let counter = RelaxedCounter::new(0);
    thread::scope(|s| {
        // Assign the remaining voxels to Bader maxima
        for _ in 0..threads {
            s.spawn(|_| loop {
                 let p = {
                     let i = counter.inc();
                     if i >= index.len() {
                         break;
                     };
                     index[i] as isize
                 };
                 match weight_step(p, density, voxel_map, weight_tolerance) {
                     WeightResult::Maxima => {
                         panic!("Found new maxima in voxel assigning.")
                     }
                     WeightResult::Interier(maxima) => {
                         voxel_map.maxima_store(p, maxima as isize);
                     }
                     WeightResult::Boundary(weights) => {
                         let i = {
                             let mut weight = voxel_map.lock();
                             let i = weight.len();
                             (*weight).push(weights);
                             i
                         };
                         voxel_map.weight_store(p, i);
                     }
                 }
                 progress_bar.tick();
             });
        }
    }).unwrap();
    {
        let mut weights = voxel_map.lock();
        weights.shrink_to_fit();
    }
}
/// Assigns a maxima to the points within index.
///
/// Note: This function will deadlock if the points above it have no associated
/// maxima in [`VoxelMap.voxel_map`]. As such make sure index is sorted.
Assigns a maxima to the points within index.
Note: This function will deadlock if the points above it have no associated
maxima in [`VoxelMap.voxel_map`]. As such make sure index is sorted.
Assigns a maxima to the points within index . Note : This function will deadlock if the points above it have no associated maxima in [ ` VoxelMap . voxel_map ` ] . As such make sure index is sorted .
pub fn weight(density: &[f64],
              voxel_map: &VoxelMap,
              index: &[usize],
              progress_bar: Bar,
              threads: usize,
              weight_tolerance: f64) {
    let counter = RelaxedCounter::new(0);
    thread::scope(|s| {
        // Assign the remaining voxels to Bader maxima
        for _ in 0..threads {
            s.spawn(|_| loop {
                 let p = {
                     let i = counter.inc();
                     if i >= index.len() {
                         break;
                     };
                     index[i] as isize
                 };
                 match weight_step(p, density, voxel_map, weight_tolerance) {
                     WeightResult::Maxima => {
                         panic!("Found new maxima in voxel assigning.")
                     }
                     WeightResult::Interier(maxima) => {
                         voxel_map.maxima_store(p, maxima as isize);
                     }
                     WeightResult::Boundary(weights) => {
                         let i = {
                             let mut weight = voxel_map.lock();
                             let i = weight.len();
                             (*weight).push(weights);
                             i
                         };
                         voxel_map.weight_store(p, i);
                     }
                 }
                 progress_bar.tick();
             });
        }
    }).unwrap();
    {
        let mut weights = voxel_map.lock();
        weights.shrink_to_fit();
    }
}
pub fn weight ( density : & [ f64 ] , voxel_map : & VoxelMap , index : & [ usize ] , progress_bar : Bar , threads : usize , weight_tolerance : f64 ) { let counter = RelaxedCounter :: new ( 0 ) ; thread :: scope ( | s | { // Assign the remaining voxels to Bader maxima for _ in 0 .. threads { s . spawn ( | _ | loop { let p = { let i = counter . inc ( ) ; if i >= index . len ( ) { break ; } ; index [ i ] as isize } ; match weight_step ( p , density , voxel_map , weight_tolerance ) { WeightResult :: Maxima => { panic ! ( " " ) } WeightResult :: Interier ( maxima ) => { voxel_map . maxima_store ( p , maxima as isize ) ; } WeightResult :: Boundary ( weights ) => { let i = { let mut weight = voxel_map . lock ( ) ; let i = weight . len ( ) ; ( * weight ) . push ( weights ) ; i } ; voxel_map . weight_store ( p , i ) ; } } progress_bar . tick ( ) ; } ) ; } } ) . unwrap ( ) ; { let mut weights = voxel_map . lock ( ) ; weights . shrink_to_fit ( ) ; } }
Assigns a maxima to the points within index.
Assigns a maxima to the points within index .
density
&[f64]
voxel_map
&VoxelMap
index
&[usize]
progress_bar
Bar
threads
usize
weight_tolerance
f64
density
&[f64]
voxel_map
&VoxelMap
index
&[usize]
progress_bar
Bar
threads
usize
weight_tolerance
f64