tighten interpolation bounds

This commit is contained in:
Magnus Ulimoen 2020-04-16 21:35:59 +02:00
parent cfff49107c
commit 74c6e41ea0
1 changed files with 6 additions and 6 deletions

View File

@ -54,21 +54,21 @@ pub(crate) fn test_interpolation_operator<IO: InterpolationOperator>(op: IO, h2:
let nc = 101; let nc = 101;
let (x_c, x_f) = if h2 { let (x_c, x_f) = if h2 {
( (
crate::utils::h2linspace(0.0, 1.0, nc), crate::utils::h2linspace(20.0, 50.0, nc),
crate::utils::h2linspace(0.0, 1.0, 2 * (nc - 1)), crate::utils::h2linspace(20.0, 50.0, 2 * (nc - 1)),
) )
} else { } else {
( (
ndarray::Array1::linspace(0.0, 1.0, 101), ndarray::Array1::linspace(20.0, 50.0, 101),
ndarray::Array1::linspace(0.0, 1.0, 2 * nc - 1), ndarray::Array1::linspace(20.0, 50.0, 2 * nc - 1),
) )
}; };
let mut ix_f = ndarray::Array1::zeros(x_f.raw_dim()); let mut ix_f = ndarray::Array1::zeros(x_f.raw_dim());
op.coarse2fine(x_c.view(), ix_f.view_mut()); op.coarse2fine(x_c.view(), ix_f.view_mut());
approx::assert_abs_diff_eq!(ix_f, x_f, epsilon = 1e-5); approx::assert_abs_diff_eq!(ix_f, x_f, epsilon = 1e-11);
let mut ix_c = ndarray::Array1::zeros(x_c.raw_dim()); let mut ix_c = ndarray::Array1::zeros(x_c.raw_dim());
op.fine2coarse(x_f.view(), ix_c.view_mut()); op.fine2coarse(x_f.view(), ix_c.view_mut());
approx::assert_abs_diff_eq!(ix_c, x_c, epsilon = 1e-5); approx::assert_abs_diff_eq!(ix_c, x_c, epsilon = 1e-11);
} }