move boundary extraction into parallel section

This commit is contained in:
Magnus Ulimoen 2020-04-22 22:22:19 +02:00
parent dd7edd46d5
commit 35c4b25be3
2 changed files with 16 additions and 11 deletions

View File

@ -81,26 +81,31 @@ impl System {
let grids = &self.grids; let grids = &self.grids;
let bt = &self.bt; let bt = &self.bt;
let wb = &mut self.wb; let wb = &mut self.wb;
let mut eb = &mut self.eb; let eb = &mut self.eb;
let operators = &self.operators; let operators = &self.operators;
let rhs = move |fut: &mut [euler::Field], prev: &[euler::Field], time: Float| { let rhs = move |fut: &mut [euler::Field], prev: &[euler::Field], time: Float| {
let bc = euler::extract_boundaries(prev, &bt, &mut eb, &grids, time); let prev_all = &prev;
pool.scope(|s| { pool.scope(|s| {
for (((((fut, prev), bc), wb), metrics), op) in fut for (((((((fut, prev), wb), grid), metrics), op), bt), eb) in fut
.iter_mut() .iter_mut()
.zip(prev.iter()) .zip(prev.iter())
.zip(bc)
.zip(wb.iter_mut()) .zip(wb.iter_mut())
.zip(grids)
.zip(metrics.iter()) .zip(metrics.iter())
.zip(operators.iter()) .zip(operators.iter())
.zip(bt.iter())
.zip(eb.iter_mut())
{ {
s.spawn(move |_| match op.as_ref() { s.spawn(move |_| {
Left(sbp) => { let bc = euler::boundary_extracts(prev_all, bt, prev, grid, eb, time);
euler::RHS_trad(&**sbp, fut, prev, metrics, &bc, &mut wb.0); match op.as_ref() {
} Left(sbp) => {
Right(uo) => { euler::RHS_trad(&**sbp, fut, prev, metrics, &bc, &mut wb.0);
euler::RHS_upwind(&**uo, fut, prev, metrics, &bc, &mut wb.0); }
Right(uo) => {
euler::RHS_upwind(&**uo, fut, prev, metrics, &bc, &mut wb.0);
}
} }
}) })
} }

View File

@ -694,7 +694,7 @@ fn boundary_extractor<'a>(
} }
} }
pub fn boundary_extract<'a>( fn boundary_extract<'a>(
fields: &'a [Field], fields: &'a [Field],
bc: &BoundaryCharacteristic, bc: &BoundaryCharacteristic,
field: &'a Field, field: &'a Field,