Clippy lints

This commit is contained in:
2022-05-17 08:24:33 +02:00
parent 70cab01334
commit f40de866ce
15 changed files with 77 additions and 77 deletions

View File

@@ -56,11 +56,11 @@ pub trait SbpOperator2d: Send + Sync {
fn diffxi(&self, prev: ArrayView2<Float>, mut fut: ArrayViewMut2<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<Float>, mut fut: ArrayViewMut2<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<dyn SbpOperator2d>, Box<dyn SbpOperator2d>) {
fn diffxi(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>) {
self.1.diffxi(prev, fut)
self.1.diffxi(prev, fut);
}
fn diffeta(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>) {
self.0.diffeta(prev, fut)
self.0.diffeta(prev, fut);
}
fn op_xi(&self) -> &dyn SbpOperator1d {
@@ -136,10 +136,10 @@ impl SbpOperator2d for (Box<dyn SbpOperator2d>, Box<dyn SbpOperator2d>) {
impl UpwindOperator2d for (Box<dyn UpwindOperator2d>, Box<dyn UpwindOperator2d>) {
fn dissxi(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>) {
self.1.dissxi(prev, fut)
self.1.dissxi(prev, fut);
}
fn disseta(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>) {
self.0.disseta(prev, fut)
self.0.disseta(prev, fut);
}
fn op_xi(&self) -> &dyn UpwindOperator1d {
self.1.op_xi()

View File

@@ -111,7 +111,7 @@ pub(crate) fn diff_op_1d_slice<const M: usize, const N: usize, const D: usize>(
a: &Matrix<Float, M, N>,
b: &ColVector<Float, N>,
) {
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<const M: usize, const N: usize, const D: usize>(
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<const M: usize, const N: usize, const D: usize
if d.is_zero() {
continue;
}
fut.scaled_add(idx * d, &id)
fut.scaled_add(idx * d, &id);
}
}
@@ -529,7 +529,7 @@ pub(crate) fn diff_op_2d_sliceable<const M: usize, const N: usize, const D: usiz
for (prev, mut fut) in prev.outer_iter().zip(fut.outer_iter_mut()) {
let prev = &prev.as_slice().unwrap()[..nx];
let fut = &mut fut.as_slice_mut().unwrap()[..nx];
diff_op_1d_slice(matrix, optype, prev, fut)
diff_op_1d_slice(matrix, optype, prev, fut);
}
}
@@ -547,7 +547,7 @@ pub(crate) fn diff_op_2d<const M: usize, const N: usize, const D: usize>(
([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),
}

View File

@@ -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<Float>, fine: ArrayViewMut1<Float>) {
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),
)
);
}
}

View File

@@ -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<Float>, fine: ArrayViewMut1<Float>) {
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));
}
}

View File

@@ -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<Float>, fine: ArrayViewMut1<Float>) {
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));
}
}

View File

@@ -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<Float>, fine: ArrayViewMut1<Float>) {
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));
}
}

View File

@@ -50,7 +50,7 @@ impl SBP4 {
impl SbpOperator1d for SBP4 {
fn diff(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<Float>, mut fut: ArrayViewMut1<Float>) {
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]

View File

@@ -36,7 +36,7 @@ impl SBP8 {
impl SbpOperator1d for SBP8 {
fn diff(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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

View File

@@ -51,7 +51,7 @@ impl Upwind4 {
impl SbpOperator1d for Upwind4 {
fn diff(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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 {

View File

@@ -53,7 +53,7 @@ impl Upwind4h2 {
impl SbpOperator1d for Upwind4h2 {
fn diff(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<Float>, fut: ArrayViewMut1<Float>) {
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 {

View File

@@ -59,7 +59,7 @@ impl Upwind9 {
impl SbpOperator1d for Upwind9 {
fn diff(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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

View File

@@ -59,7 +59,7 @@ impl Upwind9h2 {
impl SbpOperator1d for Upwind9h2 {
fn diff(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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<Float>, fut: ArrayViewMut1<Float>) {
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<Float>, fut: ArrayViewMut2<Float>) {
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