Simplify assertions

This commit is contained in:
tygyh 2022-07-15 14:53:00 +02:00
parent 5e5698249b
commit 997a572647
2 changed files with 7 additions and 7 deletions

View File

@ -421,7 +421,7 @@ pub fn tridag(a: &[f64], b: &[f64], c: &[f64], r: &[f64], u: &mut [f64], n: usiz
gam = vec![Default::default(); n];
assert!(b[0] != 0.0);
assert_ne!(b[0], 0.0);
/*
! first pass
@ -443,7 +443,7 @@ pub fn tridag(a: &[f64], b: &[f64], c: &[f64], r: &[f64], u: &mut [f64], n: usiz
for j in 1..n {
gam[j] = c[j - 1] / bet;
bet = b[j] - a[j] * gam[j];
assert!(bet != 0.0);
assert_ne!(bet, 0.0);
// Round 0: u[0] = r[0] / b[0]
// = r'[0] / b'[0]
// Round j: u[j] = (r[j] - a[j] * u'[j - 1]) / b'[j]

View File

@ -1063,9 +1063,9 @@ fn erode(
let mut h_stack = vec![Zero::zero(); dh.len()];
let mut b_stack = vec![Zero::zero(); dh.len()];
let mut area_stack = vec![Zero::zero(); dh.len()];
assert!(mstack.len() == dh.len());
assert!(b.len() == dh.len());
assert!(h_t.len() == dh.len());
assert_eq!(mstack.len(), dh.len());
assert_eq!(b.len(), dh.len());
assert_eq!(h_t.len(), dh.len());
let mstack_inv = &mut *mstack_inv;
mstack.iter().enumerate().for_each(|(stacki, &posi)| {
let posi = posi as usize;
@ -1472,7 +1472,7 @@ fn erode(
.into_par_iter()
.enumerate()
.for_each(|(posi, (&stacki, h))| {
assert!(posi == mstack[stacki] as usize);
assert_eq!(posi, mstack[stacki] as usize);
*h = h_stack[stacki];
});
@ -2270,7 +2270,7 @@ pub fn get_lakes<F: Float>(
_ => {},
}
});
assert!(rcv != -1);
assert_ne!(rcv, -1);
downhill[node] = rcv;
tag[node] = Tag::WithRcv;
}