Compare commits
No commits in common. "72d81439c12f3fad32d714aaaed1ca4b039afa17" and "c3995f572506094758b4c5719db5af5a994e00df" have entirely different histories.
72d81439c1
...
c3995f5725
|
@ -109,23 +109,21 @@ impl TransferRegion {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_destination_wells(&self) -> Vec<(u8, u8)> {
|
pub fn get_destination_wells(&self) -> Vec<(u8, u8)> {
|
||||||
match &self.source_region {
|
let map = self.calculate_map();
|
||||||
Region::Custom(c) => c.dest.clone(),
|
let source_wells = self.get_source_wells();
|
||||||
_ => {
|
|
||||||
let map = self.calculate_map();
|
|
||||||
let source_wells = self.get_source_wells();
|
|
||||||
|
|
||||||
let mut wells = Vec::<(u8, u8)>::new();
|
let mut wells = Vec::<(u8, u8)>::new();
|
||||||
|
|
||||||
for well in source_wells {
|
// log::debug!("GDW:");
|
||||||
if let Some(mut dest_wells) = map(well) {
|
for well in source_wells {
|
||||||
wells.append(&mut dest_wells);
|
if let Some(mut dest_wells) = map(well) {
|
||||||
}
|
// log::debug!("Map {:?} to {:?}", well, dest_wells);
|
||||||
}
|
wells.append(&mut dest_wells);
|
||||||
|
|
||||||
wells
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// log::debug!("GDW END.");
|
||||||
|
|
||||||
|
wells
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::type_complexity)] // Resolving gives inherent associated type error
|
#[allow(clippy::type_complexity)] // Resolving gives inherent associated type error
|
||||||
|
@ -206,16 +204,14 @@ impl TransferRegion {
|
||||||
// How many times can we replicate?
|
// How many times can we replicate?
|
||||||
(1..)
|
(1..)
|
||||||
.position(|n| {
|
.position(|n| {
|
||||||
n * number_used_src_wells.0 * il_dest.0.unsigned_abs()
|
n * number_used_src_wells.0 * il_dest.0.unsigned_abs() - il_dest.0.unsigned_abs()
|
||||||
- il_dest.0.unsigned_abs()
|
|
||||||
+ 1
|
+ 1
|
||||||
> d_dims.0
|
> d_dims.0
|
||||||
})
|
})
|
||||||
.unwrap() as u8,
|
.unwrap() as u8,
|
||||||
(1..)
|
(1..)
|
||||||
.position(|n| {
|
.position(|n| {
|
||||||
n * number_used_src_wells.1 * il_dest.1.unsigned_abs()
|
n * number_used_src_wells.1 * il_dest.1.unsigned_abs() - il_dest.1.unsigned_abs()
|
||||||
- il_dest.1.unsigned_abs()
|
|
||||||
+ 1
|
+ 1
|
||||||
> d_dims.1
|
> d_dims.1
|
||||||
})
|
})
|
||||||
|
@ -246,12 +242,14 @@ impl TransferRegion {
|
||||||
.filter(|(x, y)| {
|
.filter(|(x, y)| {
|
||||||
// How many times have we replicated? < How many are we allowed
|
// How many times have we replicated? < How many are we allowed
|
||||||
// to replicate?
|
// to replicate?
|
||||||
x.checked_sub(d_ul.0).unwrap().div_euclid(
|
x.checked_sub(d_ul.0)
|
||||||
number_used_src_wells.0 * il_dest.0.unsigned_abs(),
|
.unwrap()
|
||||||
) < count.0
|
.div_euclid(number_used_src_wells.0 * il_dest.0.unsigned_abs())
|
||||||
&& y.checked_sub(d_ul.1).unwrap().div_euclid(
|
< count.0
|
||||||
number_used_src_wells.1 * il_dest.1.unsigned_abs(),
|
&& y.checked_sub(d_ul.1)
|
||||||
) < count.1
|
.unwrap()
|
||||||
|
.div_euclid(number_used_src_wells.1 * il_dest.1.unsigned_abs())
|
||||||
|
< count.1
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
pub fn letters_to_num(letters: &str) -> Option<u8> {
|
pub fn letters_to_num(letters: &str) -> Option<u8> {
|
||||||
let mut num: u8 = 0;
|
let mut num: u8 = 0;
|
||||||
for (i, letter) in letters.to_ascii_uppercase().chars().rev().enumerate() {
|
for (i, letter) in letters.to_ascii_uppercase().chars().rev().enumerate() {
|
||||||
|
log::debug!("{}, {}", i, letter);
|
||||||
let n = letter as u8;
|
let n = letter as u8;
|
||||||
if !(65..=90).contains(&n) {
|
if !(65..=90).contains(&n) {
|
||||||
return None;
|
return None;
|
||||||
|
|
Loading…
Reference in New Issue