relax Fn bound on integrate functions

This commit is contained in:
Magnus Ulimoen 2020-04-13 18:39:21 +02:00
parent fe2621df11
commit 2adf91e1ce
2 changed files with 14 additions and 16 deletions

View File

@ -105,21 +105,19 @@ impl System {
} }
fn advance(&mut self, dt: Float, pool: &rayon::ThreadPool) { fn advance(&mut self, dt: Float, pool: &rayon::ThreadPool) {
type MT<'a> = (
&'a mut [euler::WorkBuffers],
&'a mut [euler::BoundaryStorage],
);
let metrics = &self.metrics; let metrics = &self.metrics;
let grids = &self.grids;
let bt = &self.bt;
let wb = &mut self.wb;
let mut eb = &mut self.eb;
let rhs = move |fut: &mut [euler::Field], let rhs = move |fut: &mut [euler::Field],
prev: &[euler::Field], prev: &[euler::Field],
time: Float, time: Float,
c: &(&[grid::Grid], &[euler::BoundaryCharacteristics]), _c: (),
mt: &mut MT| { _mt: &mut ()| {
let (grids, bt) = c;
let (wb, eb) = mt;
let bc = euler::extract_boundaries::<operators::Interpolation4>( let bc = euler::extract_boundaries::<operators::Interpolation4>(
prev, *bt, *eb, *grids, time, prev, &bt, &mut eb, &grids, time,
); );
pool.scope(|s| { pool.scope(|s| {
for ((((fut, prev), bc), wb), metrics) in fut for ((((fut, prev), bc), wb), metrics) in fut
@ -168,8 +166,8 @@ impl System {
&mut self.time, &mut self.time,
dt, dt,
&mut k, &mut k,
&(&self.grids, &self.bt), (),
&mut (&mut self.wb, &mut self.eb), &mut (),
pool, pool,
); );

View File

@ -89,7 +89,7 @@ impl ButcherTableau for Rk6 {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn integrate<'a, BTableau, F: 'a, RHS, MT, C>( pub fn integrate<'a, BTableau, F: 'a, RHS, MT, C>(
rhs: RHS, mut rhs: RHS,
prev: &F, prev: &F,
fut: &mut F, fut: &mut F,
time: &mut Float, time: &mut Float,
@ -101,7 +101,7 @@ pub fn integrate<'a, BTableau, F: 'a, RHS, MT, C>(
) where ) where
C: Copy, C: Copy,
F: std::ops::Deref<Target = Array3<Float>> + std::ops::DerefMut<Target = Array3<Float>>, F: std::ops::Deref<Target = Array3<Float>> + std::ops::DerefMut<Target = Array3<Float>>,
RHS: Fn(&mut F, &F, Float, C, &mut MT), RHS: FnMut(&mut F, &F, Float, C, &mut MT),
BTableau: ButcherTableau, BTableau: ButcherTableau,
{ {
assert_eq!(prev.shape(), fut.shape()); assert_eq!(prev.shape(), fut.shape());
@ -147,7 +147,7 @@ pub fn integrate<'a, BTableau, F: 'a, RHS, MT, C>(
#[cfg(feature = "rayon")] #[cfg(feature = "rayon")]
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
pub fn integrate_multigrid<'a, BTableau, F: 'a, RHS, MT, C>( pub fn integrate_multigrid<'a, BTableau, F: 'a, RHS, MT, C>(
rhs: RHS, mut rhs: RHS,
prev: &[F], prev: &[F],
fut: &mut [F], fut: &mut [F],
time: &mut Float, time: &mut Float,
@ -163,7 +163,7 @@ pub fn integrate_multigrid<'a, BTableau, F: 'a, RHS, MT, C>(
+ std::ops::DerefMut<Target = Array3<Float>> + std::ops::DerefMut<Target = Array3<Float>>
+ Send + Send
+ Sync, + Sync,
RHS: Fn(&mut [F], &[F], Float, C, &mut MT), RHS: FnMut(&mut [F], &[F], Float, C, &mut MT),
BTableau: ButcherTableau, BTableau: ButcherTableau,
{ {
for i in 0.. { for i in 0.. {