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

View File

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