diff --git a/sbp/src/operators.rs b/sbp/src/operators.rs index 10b0a02..502357d 100644 --- a/sbp/src/operators.rs +++ b/sbp/src/operators.rs @@ -72,11 +72,13 @@ impl SbpOperator2d for SBP { pub trait UpwindOperator1d: SbpOperator1d + Send + Sync { fn diss(&self, prev: ArrayView1, fut: ArrayViewMut1); + fn as_sbp(&self) -> &dyn SbpOperator1d; } pub trait UpwindOperator2d: SbpOperator2d + Send + Sync { fn dissxi(&self, prev: ArrayView2, fut: ArrayViewMut2); fn disseta(&self, prev: ArrayView2, fut: ArrayViewMut2); + fn as_sbp(&self) -> &dyn SbpOperator2d; } impl UpwindOperator2d for (&UOeta, &UOxi) { @@ -90,6 +92,9 @@ impl UpwindOperator2d for (&UOe let ba = (self.1, self.0); ba.dissxi(prev.reversed_axes(), fut.reversed_axes()) } + fn as_sbp(&self) -> &dyn SbpOperator2d { + self + } } impl UpwindOperator2d for UO { @@ -99,6 +104,9 @@ impl UpwindOperator2d for UO { fn disseta(&self, prev: ArrayView2, fut: ArrayViewMut2) { <(&UO, &UO) as UpwindOperator2d>::disseta(&(self, self), prev, fut) } + fn as_sbp(&self) -> &dyn SbpOperator2d { + self + } } pub trait InterpolationOperator: Send + Sync { diff --git a/sbp/src/operators/upwind4.rs b/sbp/src/operators/upwind4.rs index 00f3cc3..4c4e6c4 100644 --- a/sbp/src/operators/upwind4.rs +++ b/sbp/src/operators/upwind4.rs @@ -413,6 +413,10 @@ impl UpwindOperator1d for Upwind4 { fut, ) } + + fn as_sbp(&self) -> &dyn SbpOperator1d { + self + } } impl UpwindOperator2d for (&Upwind4, &SBP) { diff --git a/sbp/src/operators/upwind4h2.rs b/sbp/src/operators/upwind4h2.rs index 837fce6..9b1a7cc 100644 --- a/sbp/src/operators/upwind4h2.rs +++ b/sbp/src/operators/upwind4h2.rs @@ -92,4 +92,8 @@ impl UpwindOperator1d for Upwind4h2 { fut, ) } + + fn as_sbp(&self) -> &dyn SbpOperator1d { + self + } } diff --git a/sbp/src/operators/upwind9.rs b/sbp/src/operators/upwind9.rs index c6d6dce..a1304c9 100644 --- a/sbp/src/operators/upwind9.rs +++ b/sbp/src/operators/upwind9.rs @@ -72,6 +72,10 @@ impl UpwindOperator1d for Upwind9 { fut, ) } + + fn as_sbp(&self) -> &dyn SbpOperator1d { + self + } } #[test] diff --git a/sbp/src/operators/upwind9h2.rs b/sbp/src/operators/upwind9h2.rs index 811d53a..ed2f7ea 100644 --- a/sbp/src/operators/upwind9h2.rs +++ b/sbp/src/operators/upwind9h2.rs @@ -100,4 +100,7 @@ impl UpwindOperator1d for Upwind9h2 { fut, ) } + fn as_sbp(&self) -> &dyn SbpOperator1d { + self + } }