diff --git a/euler/src/lib.rs b/euler/src/lib.rs index 567dc87..4394c2a 100644 --- a/euler/src/lib.rs +++ b/euler/src/lib.rs @@ -60,7 +60,7 @@ impl System { let metrics = &self.grid.1; let rhs_trad = |k: &mut Diff, y: &Field, _time: Float| { let boundaries = boundary_extractor(y, grid, &bc); - RHS_trad(op, k, y, metrics, &boundaries, wb) + RHS_trad(op, k, y, metrics, &boundaries, wb); }; integrate::integrate::( rhs_trad, @@ -98,7 +98,7 @@ impl System { self.sys .0 - .vortex(self.grid.0.x(), self.grid.0.y(), 0.0, &vortex_parameters) + .vortex(self.grid.0.x(), self.grid.0.y(), 0.0, &vortex_parameters); } pub fn field(&self) -> &Field { @@ -134,7 +134,7 @@ impl System { let rhs_upwind = |k: &mut Diff, y: &Field, _time: Float| { let (grid, metrics) = grid; let boundaries = boundary_extractor(y, grid, &bc); - RHS_upwind(op, k, y, metrics, &boundaries, wb) + RHS_upwind(op, k, y, metrics, &boundaries, wb); }; integrate::integrate::( rhs_upwind, @@ -159,7 +159,7 @@ impl System { let mut rhs_upwind = |k: &mut Diff, y: &Field, _time: Float| { let (grid, metrics) = grid; let boundaries = boundary_extractor(y, grid, &bc); - RHS_upwind(op, k, y, metrics, &boundaries, wb) + RHS_upwind(op, k, y, metrics, &boundaries, wb); }; let mut time = 0.0; let mut sys2 = self.sys.0.clone(); @@ -194,7 +194,7 @@ impl Clone for Field { Self(self.0.clone()) } fn clone_from(&mut self, source: &Self) { - self.0.clone_from(&source.0) + self.0.clone_from(&source.0); } } @@ -324,7 +324,7 @@ impl Field { vortex_param: &VortexParameters, ) { let (rho, rhou, rhov, e) = self.components_mut(); - vortex_param.evaluate(time, x, y, rho, rhou, rhov, e) + vortex_param.evaluate(time, x, y, rho, rhou, rhov, e); } #[allow(clippy::erasing_op, clippy::identity_op)] fn iter(&self) -> impl ExactSizeIterator + '_ { @@ -508,7 +508,7 @@ pub fn RHS_trad( eflux in &dE.0, fflux in &dF.0, detj in &metrics.detj().broadcast((4, y.ny(), y.nx())).unwrap()) { - *out = (-eflux - fflux)/detj + *out = (-eflux - fflux)/detj; }); SAT_characteristics(op, k, y, metrics, boundaries); @@ -555,14 +555,14 @@ pub fn RHS_no_SAT( ad_xi in &ad_xi.0, ad_eta in &ad_eta.0, detj in &metrics.detj().broadcast((4, y.ny(), y.nx())).unwrap()) { - *out = (-eflux - fflux + ad_xi + ad_eta)/detj + *out = (-eflux - fflux + ad_xi + ad_eta)/detj; }); } else { azip!((out in &mut k.0, eflux in &dE.0, fflux in &dF.0, detj in &metrics.detj().broadcast((4, y.ny(), y.nx())).unwrap()) { - *out = (-eflux - fflux )/detj + *out = (-eflux - fflux )/detj; }); } } @@ -609,7 +609,7 @@ pub fn RHS_upwind( ad_xi in &ad_xi.0, ad_eta in &ad_eta.0, detj in &metrics.detj().broadcast((4, y.ny(), y.nx())).unwrap()) { - *out = (-eflux - fflux + ad_xi + ad_eta)/detj + *out = (-eflux - fflux + ad_xi + ad_eta)/detj; }); SAT_characteristics(op, k, y, metrics, boundaries); @@ -687,7 +687,7 @@ fn fluxes(k: (&mut Field, &mut Field), y: &Field, metrics: &Metrics, wb: &mut Fi let mut p = wb.rho_mut(); azip!((p in &mut p, &rho in &rho, &rhou in &rhou, &rhov in &rhov, &e in &e) { - *p = pressure(gamma, rho, rhou, rhov, e) + *p = pressure(gamma, rho, rhou, rhov, e); }); let (mut c0, c1, mut c2, c3) = k.0.components_mut(); @@ -730,7 +730,7 @@ fn fluxes(k: (&mut Field, &mut Field), y: &Field, metrics: &Metrics, wb: &mut Fi let fflux = *ff; *ef = j_dxi_dx * eflux + j_dxi_dy * fflux; *ff = j_deta_dx * eflux + j_deta_dy * fflux; - }) + }); } } @@ -835,12 +835,12 @@ fn boundary_extract<'a>( to.slice_mut(s![.., i..i + n]) .assign(&seldir(&fields[g]).slice(s![.., start..end])); remaining -= 1; - if remaining != 0 { - to.slice_mut(s![.., i]).iter_mut().for_each(|x| *x /= 2.0); - i += n - 1; - } else { + if remaining == 0 { i += n; assert_eq!(i, to.len_of(Axis(1))); + } else { + to.slice_mut(s![.., i]).iter_mut().for_each(|x| *x /= 2.0); + i += n - 1; } } to.view() @@ -880,7 +880,7 @@ pub fn boundary_extracts<'a>( &bt.north, field, grid.north(), - |f| f.south(), + Field::south, eb.north.as_mut(), time, ), @@ -889,7 +889,7 @@ pub fn boundary_extracts<'a>( &bt.south, field, grid.south(), - |f| f.north(), + Field::north, eb.south.as_mut(), time, ), @@ -898,7 +898,7 @@ pub fn boundary_extracts<'a>( &bt.east, field, grid.east(), - |f| f.west(), + Field::west, eb.east.as_mut(), time, ), @@ -907,7 +907,7 @@ pub fn boundary_extracts<'a>( &bt.west, field, grid.west(), - |f| f.east(), + Field::east, eb.west.as_mut(), time, ), @@ -994,7 +994,7 @@ fn vortexify( fiter.next().unwrap(), ); let (y, x) = yx; - vparams.evaluate(time, x, y, rho, rhou, rhov, e) + vparams.evaluate(time, x, y, rho, rhou, rhov, e); } #[allow(non_snake_case)] diff --git a/maxwell/src/lib.rs b/maxwell/src/lib.rs index cd647bf..7089916 100644 --- a/maxwell/src/lib.rs +++ b/maxwell/src/lib.rs @@ -15,13 +15,13 @@ impl Clone for Field { Self(self.0.clone()) } fn clone_from(&mut self, source: &Self) { - self.0.clone_from(&source.0) + self.0.clone_from(&source.0); } } impl integrate::Integrable for Field { - type State = Field; - type Diff = Field; + type State = Self; + type Diff = Self; fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) { s.0.scaled_add(scale, &o.0); @@ -153,12 +153,12 @@ impl System { let rhs_adaptor = move |fut: &mut Field, prev: &Field, _time: Float| { RHS(op, fut, prev, grid, metrics, wb); }; - let mut _time = 0.0; + let mut time = 0.0; integrate::integrate::( rhs_adaptor, &self.sys.0, &mut self.sys.1, - &mut _time, + &mut time, dt, &mut self.wb.k, ); @@ -213,12 +213,12 @@ impl System { let rhs_adaptor = move |fut: &mut Field, prev: &Field, _time: Float| { RHS_upwind(op, fut, prev, grid, metrics, wb); }; - let mut _time = 0.0; + let mut time = 0.0; integrate::integrate::( rhs_adaptor, &self.sys.0, &mut self.sys.1, - &mut _time, + &mut time, dt, &mut self.wb.k, ); @@ -487,11 +487,8 @@ fn SAT_characteristics( metrics: &Metrics, boundaries: &BoundaryTerms, ) { - let ny = y.ny(); - let nx = y.nx(); - fn positive_flux(kx: Float, ky: Float) -> [[Float; 3]; 3] { - let r = (kx * kx + ky * ky).sqrt(); + let r = Float::hypot(kx, ky); [ [ky * ky / r / 2.0, ky / 2.0, -kx * ky / r / 2.0], [ky / 2.0, r / 2.0, -kx / 2.0], @@ -499,7 +496,7 @@ fn SAT_characteristics( ] } fn negative_flux(kx: Float, ky: Float) -> [[Float; 3]; 3] { - let r = (kx * kx + ky * ky).sqrt(); + let r = Float::hypot(kx, ky); [ [-ky * ky / r / 2.0, ky / 2.0, kx * ky / r / 2.0], [ky / 2.0, -r / 2.0, -kx / 2.0], @@ -507,6 +504,9 @@ fn SAT_characteristics( ] } + let ny = y.ny(); + let nx = y.nx(); + { let g = match boundaries.east { Boundary::This => y.slice(s![.., .., 0]), diff --git a/sbp/src/operators.rs b/sbp/src/operators.rs index 63580f9..1114b99 100644 --- a/sbp/src/operators.rs +++ b/sbp/src/operators.rs @@ -56,11 +56,11 @@ pub trait SbpOperator2d: Send + Sync { fn diffxi(&self, prev: ArrayView2, mut fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); for (p, f) in prev.outer_iter().zip(fut.outer_iter_mut()) { - self.op_xi().diff(p, f) + self.op_xi().diff(p, f); } } fn diffeta(&self, prev: ArrayView2, fut: ArrayViewMut2) { - self.diffxi(prev.reversed_axes(), fut.reversed_axes()) + self.diffxi(prev.reversed_axes(), fut.reversed_axes()); } fn hxi(&self) -> &'static [Float] { @@ -91,12 +91,12 @@ pub trait UpwindOperator2d: Send + Sync { fn dissxi(&self, prev: ArrayView2, mut fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); for (p, f) in prev.outer_iter().zip(fut.outer_iter_mut()) { - UpwindOperator2d::op_xi(self).diss(p, f) + UpwindOperator2d::op_xi(self).diss(p, f); } } // Assuming operator is symmetrical x/y fn disseta(&self, prev: ArrayView2, fut: ArrayViewMut2) { - self.dissxi(prev.reversed_axes(), fut.reversed_axes()) + self.dissxi(prev.reversed_axes(), fut.reversed_axes()); } fn op_xi(&self) -> &dyn UpwindOperator1d; @@ -114,10 +114,10 @@ pub trait InterpolationOperator: Send + Sync { impl SbpOperator2d for (Box, Box) { fn diffxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { - self.1.diffxi(prev, fut) + self.1.diffxi(prev, fut); } fn diffeta(&self, prev: ArrayView2, fut: ArrayViewMut2) { - self.0.diffeta(prev, fut) + self.0.diffeta(prev, fut); } fn op_xi(&self) -> &dyn SbpOperator1d { @@ -136,10 +136,10 @@ impl SbpOperator2d for (Box, Box) { impl UpwindOperator2d for (Box, Box) { fn dissxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { - self.1.dissxi(prev, fut) + self.1.dissxi(prev, fut); } fn disseta(&self, prev: ArrayView2, fut: ArrayViewMut2) { - self.0.disseta(prev, fut) + self.0.disseta(prev, fut); } fn op_xi(&self) -> &dyn UpwindOperator1d { self.1.op_xi() diff --git a/sbp/src/operators/algos.rs b/sbp/src/operators/algos.rs index cb5dee3..73f877a 100644 --- a/sbp/src/operators/algos.rs +++ b/sbp/src/operators/algos.rs @@ -111,7 +111,7 @@ pub(crate) fn diff_op_1d_slice( a: &Matrix, b: &ColVector, ) { - c.matmul_float_into(a, b) + c.matmul_float_into(a, b); } assert_eq!(prev.len(), fut.len()); @@ -198,9 +198,9 @@ pub(crate) fn diff_op_1d( assert!(nx >= 2 * M); if let Some((prev, fut)) = prev.as_slice().zip(fut.as_slice_mut()) { - diff_op_1d_slice(matrix, optype, prev, fut) + diff_op_1d_slice(matrix, optype, prev, fut); } else { - diff_op_1d_fallback(matrix, optype, prev, fut) + diff_op_1d_fallback(matrix, optype, prev, fut); } } @@ -258,7 +258,7 @@ pub(crate) fn diff_op_2d_fallback( ([1, _], [1, _]) if prev.as_slice_memory_order().is_some() && fut.as_slice_memory_order().is_some() => { - diff_op_2d_sliceable_y_simd(matrix, optype, prev, fut) + diff_op_2d_sliceable_y_simd(matrix, optype, prev, fut); } _ => diff_op_2d_fallback(matrix, optype, prev, fut), } diff --git a/sbp/src/operators/interpolation/interpolation4.rs b/sbp/src/operators/interpolation/interpolation4.rs index 8507620..5088228 100644 --- a/sbp/src/operators/interpolation/interpolation4.rs +++ b/sbp/src/operators/interpolation/interpolation4.rs @@ -79,7 +79,7 @@ impl InterpolationOperator for Interpolation4 { ndarray::arr2(Self::F2C_BLOCK).view(), ndarray::arr2(Self::F2C_DIAG).view(), (3, 2), - ) + ); } fn coarse2fine(&self, coarse: ArrayView1, fine: ArrayViewMut1) { assert_eq!(fine.len(), 2 * coarse.len() - 1); @@ -89,7 +89,7 @@ impl InterpolationOperator for Interpolation4 { ndarray::arr2(Self::C2F_BLOCK).view(), ndarray::arr2(Self::C2F_DIAG).view(), (4, 1), - ) + ); } } diff --git a/sbp/src/operators/interpolation/interpolation8.rs b/sbp/src/operators/interpolation/interpolation8.rs index 0825cd7..94d3111 100644 --- a/sbp/src/operators/interpolation/interpolation8.rs +++ b/sbp/src/operators/interpolation/interpolation8.rs @@ -58,7 +58,7 @@ impl InterpolationOperator for Interpolation8 { let diag = Array::from_iter(Self::F2C_DIAG.iter().flatten().copied()) .into_shape((Self::F2C_DIAG.len(), Self::F2C_DIAG[0].len())) .unwrap(); - super::interpolate(fine, coarse, block.view(), diag.view(), (0, 2)) + super::interpolate(fine, coarse, block.view(), diag.view(), (0, 2)); } fn coarse2fine(&self, coarse: ArrayView1, fine: ArrayViewMut1) { assert_eq!(fine.len(), 2 * coarse.len() - 1); @@ -69,7 +69,7 @@ impl InterpolationOperator for Interpolation8 { let diag = Array::from_iter(Self::C2F_DIAG.iter().flatten().copied()) .into_shape((Self::C2F_DIAG.len(), Self::C2F_DIAG[0].len())) .unwrap(); - super::interpolate(coarse, fine, block.view(), diag.view(), (8, 1)) + super::interpolate(coarse, fine, block.view(), diag.view(), (8, 1)); } } diff --git a/sbp/src/operators/interpolation/interpolation9.rs b/sbp/src/operators/interpolation/interpolation9.rs index 354c1d9..0b3df86 100644 --- a/sbp/src/operators/interpolation/interpolation9.rs +++ b/sbp/src/operators/interpolation/interpolation9.rs @@ -59,7 +59,7 @@ impl InterpolationOperator for Interpolation9 { let diag = Array::from_iter(Self::F2C_DIAG.iter().flatten().copied()) .into_shape((Self::F2C_DIAG.len(), Self::F2C_DIAG[0].len())) .unwrap(); - super::interpolate(fine, coarse, block.view(), diag.view(), (5, 2)) + super::interpolate(fine, coarse, block.view(), diag.view(), (5, 2)); } fn coarse2fine(&self, coarse: ArrayView1, fine: ArrayViewMut1) { assert_eq!(fine.len(), 2 * coarse.len() - 1); @@ -70,7 +70,7 @@ impl InterpolationOperator for Interpolation9 { let diag = Array::from_iter(Self::C2F_DIAG.iter().flatten().copied()) .into_shape((Self::C2F_DIAG.len(), Self::C2F_DIAG[0].len())) .unwrap(); - super::interpolate(coarse, fine, block.view(), diag.view(), (8, 1)) + super::interpolate(coarse, fine, block.view(), diag.view(), (8, 1)); } } diff --git a/sbp/src/operators/interpolation/interpolation9h2.rs b/sbp/src/operators/interpolation/interpolation9h2.rs index ee9abc3..0820e12 100644 --- a/sbp/src/operators/interpolation/interpolation9h2.rs +++ b/sbp/src/operators/interpolation/interpolation9h2.rs @@ -59,7 +59,7 @@ impl InterpolationOperator for Interpolation9h2 { let diag = Array::from_iter(Self::F2C_DIAG.iter().flatten().copied()) .into_shape((Self::F2C_DIAG.len(), Self::F2C_DIAG[0].len())) .unwrap(); - 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, fine: ArrayViewMut1) { assert_eq!(fine.len(), 2 * (coarse.len() - 1)); @@ -70,7 +70,7 @@ impl InterpolationOperator for Interpolation9h2 { let diag = Array::from_iter(Self::C2F_DIAG.iter().flatten().copied()) .into_shape((Self::C2F_DIAG.len(), Self::C2F_DIAG[0].len())) .unwrap(); - super::interpolate(coarse, fine, block.view(), diag.view(), (8, 1)) + super::interpolate(coarse, fine, block.view(), diag.view(), (8, 1)); } } diff --git a/sbp/src/operators/traditional4.rs b/sbp/src/operators/traditional4.rs index 9022635..71a6b6a 100644 --- a/sbp/src/operators/traditional4.rs +++ b/sbp/src/operators/traditional4.rs @@ -50,7 +50,7 @@ impl SBP4 { impl SbpOperator1d for SBP4 { fn diff(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut) + super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut); } fn h(&self) -> &'static [Float] { @@ -74,7 +74,7 @@ impl SbpOperator1d for SBP4 { impl SbpOperator2d for SBP4 { fn diffxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DIFF, OperatorType::Normal, prev, fut) + super::diff_op_2d(&Self::DIFF, OperatorType::Normal, prev, fut); } fn op_xi(&self) -> &dyn SbpOperator1d { &Self @@ -85,7 +85,7 @@ impl super::SbpOperator1d2 for SBP4 { fn diff2(&self, prev: ArrayView1, mut fut: ArrayViewMut1) { super::diff_op_1d(&Self::D2, OperatorType::Normal, prev, fut.view_mut()); let hi = (prev.len() - 1) as Float; - fut.map_inplace(|x| *x *= hi) + fut.map_inplace(|x| *x *= hi); } fn d1(&self) -> &[Float] { &[-88.0 / 17.0, 144.0 / 17.0, -72.0 / 17.0, 16.0 / 17.0] diff --git a/sbp/src/operators/traditional8.rs b/sbp/src/operators/traditional8.rs index 32a0525..ca45d29 100644 --- a/sbp/src/operators/traditional8.rs +++ b/sbp/src/operators/traditional8.rs @@ -36,7 +36,7 @@ impl SBP8 { impl SbpOperator1d for SBP8 { fn diff(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut) + super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut); } fn h(&self) -> &'static [Float] { @@ -56,7 +56,7 @@ impl SbpOperator1d for SBP8 { impl SbpOperator2d for SBP8 { fn diffxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DIFF, OperatorType::Normal, prev, fut) + super::diff_op_2d(&Self::DIFF, OperatorType::Normal, prev, fut); } fn op_xi(&self) -> &dyn SbpOperator1d { &Self diff --git a/sbp/src/operators/upwind4.rs b/sbp/src/operators/upwind4.rs index 640d8ec..ae343c0 100644 --- a/sbp/src/operators/upwind4.rs +++ b/sbp/src/operators/upwind4.rs @@ -51,7 +51,7 @@ impl Upwind4 { impl SbpOperator1d for Upwind4 { fn diff(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut) + super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut); } fn h(&self) -> &'static [Float] { &Self::H.start @@ -173,7 +173,7 @@ fn upwind4_test() { impl UpwindOperator1d for Upwind4 { fn diss(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DISS, super::OperatorType::Normal, prev, fut) + super::diff_op_1d(&Self::DISS, super::OperatorType::Normal, prev, fut); } fn as_sbp(&self) -> &dyn SbpOperator1d { @@ -190,7 +190,7 @@ impl UpwindOperator2d for Upwind4 { fn dissxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DISS, OperatorType::Normal, prev, fut) + super::diff_op_2d(&Self::DISS, OperatorType::Normal, prev, fut); } fn op_xi(&self) -> &dyn UpwindOperator1d { diff --git a/sbp/src/operators/upwind4h2.rs b/sbp/src/operators/upwind4h2.rs index ab98006..c8ae1fc 100644 --- a/sbp/src/operators/upwind4h2.rs +++ b/sbp/src/operators/upwind4h2.rs @@ -53,7 +53,7 @@ impl Upwind4h2 { impl SbpOperator1d for Upwind4h2 { fn diff(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DIFF, OperatorType::H2, prev, fut) + super::diff_op_1d(&Self::DIFF, OperatorType::H2, prev, fut); } fn h(&self) -> &'static [Float] { @@ -81,7 +81,7 @@ impl SbpOperator2d for Upwind4h2 { fn diffxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DIFF, OperatorType::H2, prev, fut) + super::diff_op_2d(&Self::DIFF, OperatorType::H2, prev, fut); } fn op_xi(&self) -> &dyn SbpOperator1d { &Self @@ -95,7 +95,7 @@ impl UpwindOperator2d for Upwind4h2 { fn dissxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DISS, OperatorType::H2, prev, fut) + super::diff_op_2d(&Self::DISS, OperatorType::H2, prev, fut); } fn op_xi(&self) -> &dyn UpwindOperator1d { &Self @@ -129,7 +129,7 @@ fn upwind4h2_test() { impl UpwindOperator1d for Upwind4h2 { fn diss(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DISS, super::OperatorType::H2, prev, fut) + super::diff_op_1d(&Self::DISS, super::OperatorType::H2, prev, fut); } fn as_sbp(&self) -> &dyn SbpOperator1d { diff --git a/sbp/src/operators/upwind9.rs b/sbp/src/operators/upwind9.rs index 11f8dee..984d25b 100644 --- a/sbp/src/operators/upwind9.rs +++ b/sbp/src/operators/upwind9.rs @@ -59,7 +59,7 @@ impl Upwind9 { impl SbpOperator1d for Upwind9 { fn diff(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut) + super::diff_op_1d(&Self::DIFF, super::OperatorType::Normal, prev, fut); } fn h(&self) -> &'static [Float] { @@ -84,7 +84,7 @@ impl SbpOperator2d for Upwind9 { fn diffxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DIFF, OperatorType::Normal, prev, fut) + super::diff_op_2d(&Self::DIFF, OperatorType::Normal, prev, fut); } fn op_xi(&self) -> &dyn SbpOperator1d { &Self @@ -96,7 +96,7 @@ impl SbpOperator2d for Upwind9 { impl UpwindOperator1d for Upwind9 { fn diss(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DISS, super::OperatorType::Normal, prev, fut) + super::diff_op_1d(&Self::DISS, super::OperatorType::Normal, prev, fut); } fn as_sbp(&self) -> &dyn SbpOperator1d { @@ -112,7 +112,7 @@ impl UpwindOperator1d for Upwind9 { impl UpwindOperator2d for Upwind9 { fn dissxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DISS, OperatorType::Normal, prev, fut) + super::diff_op_2d(&Self::DISS, OperatorType::Normal, prev, fut); } fn op_xi(&self) -> &dyn UpwindOperator1d { &Self diff --git a/sbp/src/operators/upwind9h2.rs b/sbp/src/operators/upwind9h2.rs index 6c1e104..8347bcb 100644 --- a/sbp/src/operators/upwind9h2.rs +++ b/sbp/src/operators/upwind9h2.rs @@ -59,7 +59,7 @@ impl Upwind9h2 { impl SbpOperator1d for Upwind9h2 { fn diff(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DIFF, super::OperatorType::H2, prev, fut) + super::diff_op_1d(&Self::DIFF, super::OperatorType::H2, prev, fut); } fn h(&self) -> &'static [Float] { @@ -87,7 +87,7 @@ impl SbpOperator2d for Upwind9h2 { fn diffxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DIFF, OperatorType::H2, prev, fut) + super::diff_op_2d(&Self::DIFF, OperatorType::H2, prev, fut); } fn op_xi(&self) -> &dyn SbpOperator1d { &Self @@ -124,7 +124,7 @@ fn upwind9h2_test() { impl UpwindOperator1d for Upwind9h2 { fn diss(&self, prev: ArrayView1, fut: ArrayViewMut1) { - super::diff_op_1d(&Self::DISS, super::OperatorType::H2, prev, fut) + super::diff_op_1d(&Self::DISS, super::OperatorType::H2, prev, fut); } fn as_sbp(&self) -> &dyn SbpOperator1d { self @@ -140,7 +140,7 @@ impl UpwindOperator2d for Upwind9h2 { fn dissxi(&self, prev: ArrayView2, fut: ArrayViewMut2) { assert_eq!(prev.shape(), fut.shape()); - super::diff_op_2d(&Self::DISS, OperatorType::H2, prev, fut) + super::diff_op_2d(&Self::DISS, OperatorType::H2, prev, fut); } fn op_xi(&self) -> &dyn UpwindOperator1d { &Self diff --git a/shallow_water/src/lib.rs b/shallow_water/src/lib.rs index 13abfc5..9e9e352 100644 --- a/shallow_water/src/lib.rs +++ b/shallow_water/src/lib.rs @@ -19,8 +19,8 @@ impl Clone for Field { } impl integrate::Integrable for Field { - type State = Field; - type Diff = Field; + type State = Self; + type Diff = Self; fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) { s.0.scaled_add(scale, &o.0);