diff --git a/sbp/src/euler.rs b/sbp/src/euler.rs index 70b527d..48b61a6 100644 --- a/sbp/src/euler.rs +++ b/sbp/src/euler.rs @@ -272,7 +272,7 @@ impl Field { impl Field { /// sqrt((self-other)^T*H*(self-other)) - pub fn h2_err(&self, other: &Self, op: &SBP) -> Float { + pub fn h2_err(&self, other: &Self, op: &dyn SbpOperator2d) -> Float { assert_eq!(self.nx(), other.nx()); assert_eq!(self.ny(), other.ny()); @@ -406,8 +406,8 @@ fn pressure(gamma: Float, rho: Float, rhou: Float, rhov: Float, e: Float) -> Flo } #[allow(non_snake_case)] -pub fn RHS_trad( - op: &SBP, +pub fn RHS_trad( + op: &dyn SbpOperator2d, k: &mut Field, y: &Field, metrics: &Metrics, @@ -441,8 +441,8 @@ pub fn RHS_trad( } #[allow(non_snake_case)] -pub fn RHS_upwind( - op: &UO, +pub fn RHS_upwind( + op: &dyn UpwindOperator2d, k: &mut Field, y: &Field, metrics: &Metrics, @@ -478,12 +478,12 @@ pub fn RHS_upwind( *out = (-eflux - fflux + ad_xi + ad_eta)/detj }); - SAT_characteristics(op, k, y, metrics, boundaries); + SAT_characteristics(op.as_sbp(), k, y, metrics, boundaries); } #[allow(clippy::many_single_char_names)] -fn upwind_dissipation( - op: &UO, +fn upwind_dissipation( + op: &dyn UpwindOperator2d, k: (&mut Field, &mut Field), y: &Field, metrics: &Metrics, @@ -843,8 +843,8 @@ fn vortexify( #[allow(non_snake_case)] /// Boundary conditions (SAT) -fn SAT_characteristics( - op: &SBP, +fn SAT_characteristics( + op: &dyn SbpOperator2d, k: &mut Field, y: &Field, metrics: &Metrics, diff --git a/sbp/src/grid.rs b/sbp/src/grid.rs index 64090c1..3857486 100644 --- a/sbp/src/grid.rs +++ b/sbp/src/grid.rs @@ -1,3 +1,4 @@ +use super::operators::SbpOperator2d; use crate::Float; use ndarray::Array2; @@ -36,10 +37,7 @@ impl Grid { self.y.view() } - pub fn metrics( - &self, - op: &SBP, - ) -> Result { + pub fn metrics(&self, op: &dyn SbpOperator2d) -> Result { Metrics::new(self, op) } @@ -70,10 +68,7 @@ impl Grid { } impl Metrics { - fn new( - grid: &Grid, - op: &SBP, - ) -> Result { + fn new(grid: &Grid, op: &dyn SbpOperator2d) -> Result { let ny = grid.ny(); let nx = grid.nx(); let x = &grid.x;