add dyn cast to sbp
This commit is contained in:
parent
d089df6d54
commit
5068a6123c
|
@ -72,11 +72,13 @@ impl<SBP: SbpOperator1d + Copy> SbpOperator2d for SBP {
|
|||
|
||||
pub trait UpwindOperator1d: SbpOperator1d + Send + Sync {
|
||||
fn diss(&self, prev: ArrayView1<Float>, fut: ArrayViewMut1<Float>);
|
||||
fn as_sbp(&self) -> &dyn SbpOperator1d;
|
||||
}
|
||||
|
||||
pub trait UpwindOperator2d: SbpOperator2d + Send + Sync {
|
||||
fn dissxi(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>);
|
||||
fn disseta(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>);
|
||||
fn as_sbp(&self) -> &dyn SbpOperator2d;
|
||||
}
|
||||
|
||||
impl<UOeta: UpwindOperator1d, UOxi: UpwindOperator1d> UpwindOperator2d for (&UOeta, &UOxi) {
|
||||
|
@ -90,6 +92,9 @@ impl<UOeta: UpwindOperator1d, UOxi: UpwindOperator1d> 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<UO: UpwindOperator1d + Copy> UpwindOperator2d for UO {
|
||||
|
@ -99,6 +104,9 @@ impl<UO: UpwindOperator1d + Copy> UpwindOperator2d for UO {
|
|||
fn disseta(&self, prev: ArrayView2<Float>, fut: ArrayViewMut2<Float>) {
|
||||
<(&UO, &UO) as UpwindOperator2d>::disseta(&(self, self), prev, fut)
|
||||
}
|
||||
fn as_sbp(&self) -> &dyn SbpOperator2d {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
pub trait InterpolationOperator: Send + Sync {
|
||||
|
|
|
@ -413,6 +413,10 @@ impl UpwindOperator1d for Upwind4 {
|
|||
fut,
|
||||
)
|
||||
}
|
||||
|
||||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<SBP: UpwindOperator1d> UpwindOperator2d for (&Upwind4, &SBP) {
|
||||
|
|
|
@ -92,4 +92,8 @@ impl UpwindOperator1d for Upwind4h2 {
|
|||
fut,
|
||||
)
|
||||
}
|
||||
|
||||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,10 @@ impl UpwindOperator1d for Upwind9 {
|
|||
fut,
|
||||
)
|
||||
}
|
||||
|
||||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -100,4 +100,7 @@ impl UpwindOperator1d for Upwind9h2 {
|
|||
fut,
|
||||
)
|
||||
}
|
||||
fn as_sbp(&self) -> &dyn SbpOperator1d {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue