change restriction on h2 grid interpolation
This commit is contained in:
		@@ -55,7 +55,7 @@ pub(crate) fn test_interpolation_operator<IO: InterpolationOperator>(op: IO, h2:
 | 
				
			|||||||
    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(0.0, 1.0, nc),
 | 
				
			||||||
            crate::utils::h2linspace(0.0, 1.0, 2 * nc - 1),
 | 
					            crate::utils::h2linspace(0.0, 1.0, 2 * (nc - 1)),
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        (
 | 
					        (
 | 
				
			||||||
@@ -66,9 +66,9 @@ pub(crate) fn test_interpolation_operator<IO: InterpolationOperator>(op: IO, h2:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    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-2);
 | 
					    approx::assert_abs_diff_eq!(ix_f, x_f, epsilon = 1e-5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    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-2);
 | 
					    approx::assert_abs_diff_eq!(ix_c, x_c, epsilon = 1e-5);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ impl Interpolation9h2 {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl InterpolationOperator for Interpolation9h2 {
 | 
					impl InterpolationOperator for Interpolation9h2 {
 | 
				
			||||||
    fn fine2coarse(&self, fine: ArrayView1<Float>, coarse: ArrayViewMut1<Float>) {
 | 
					    fn fine2coarse(&self, fine: ArrayView1<Float>, coarse: ArrayViewMut1<Float>) {
 | 
				
			||||||
        assert_eq!(fine.len(), 2 * coarse.len() - 1);
 | 
					        assert_eq!(fine.len(), 2 * (coarse.len() - 1));
 | 
				
			||||||
        use ndarray::prelude::*;
 | 
					        use ndarray::prelude::*;
 | 
				
			||||||
        use std::iter::FromIterator;
 | 
					        use std::iter::FromIterator;
 | 
				
			||||||
        let block = Array::from_iter(Self::F2C_BLOCK.iter().flatten().copied())
 | 
					        let block = Array::from_iter(Self::F2C_BLOCK.iter().flatten().copied())
 | 
				
			||||||
@@ -63,7 +63,7 @@ impl InterpolationOperator for Interpolation9h2 {
 | 
				
			|||||||
        super::interpolate(fine, coarse, block.view(), diag.view(), (4, 2))
 | 
					        super::interpolate(fine, coarse, block.view(), diag.view(), (4, 2))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    fn coarse2fine(&self, coarse: ArrayView1<Float>, fine: ArrayViewMut1<Float>) {
 | 
					    fn coarse2fine(&self, coarse: ArrayView1<Float>, fine: ArrayViewMut1<Float>) {
 | 
				
			||||||
        assert_eq!(fine.len(), 2 * coarse.len() - 1);
 | 
					        assert_eq!(fine.len(), 2 * (coarse.len() - 1));
 | 
				
			||||||
        use ndarray::prelude::*;
 | 
					        use ndarray::prelude::*;
 | 
				
			||||||
        use std::iter::FromIterator;
 | 
					        use std::iter::FromIterator;
 | 
				
			||||||
        let block = Array::from_iter(Self::C2F_BLOCK.iter().flatten().copied())
 | 
					        let block = Array::from_iter(Self::C2F_BLOCK.iter().flatten().copied())
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user