Reimplement interpolation for distributed system
This commit is contained in:
parent
b142bb63e4
commit
1e363c0508
|
@ -327,7 +327,7 @@ impl System {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let (ny, nx) = (grid.nx(), grid.ny());
|
let (ny, nx) = (grid.ny(), grid.nx());
|
||||||
|
|
||||||
tids.push(
|
tids.push(
|
||||||
builder
|
builder
|
||||||
|
@ -429,15 +429,6 @@ pub enum DistributedBoundaryConditions {
|
||||||
Channel(Receiver<Array2<Float>>),
|
Channel(Receiver<Array2<Float>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DistributedBoundaryConditions {
|
|
||||||
fn channel(&self) -> Option<&Receiver<Array2<Float>>> {
|
|
||||||
match self {
|
|
||||||
Self::Interpolate(r, _) | Self::Channel(r) => Some(r),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type PushCommunicator = Option<Sender<Array2<Float>>>;
|
type PushCommunicator = Option<Sender<Array2<Float>>>;
|
||||||
|
|
||||||
struct DistributedSystemPart {
|
struct DistributedSystemPart {
|
||||||
|
@ -661,34 +652,82 @@ impl DistributedSystemPart {
|
||||||
let s = select.select();
|
let s = select.select();
|
||||||
let sindex = s.index();
|
let sindex = s.index();
|
||||||
match Some(sindex) {
|
match Some(sindex) {
|
||||||
x if x == recv_north => {
|
x if x == recv_north => match boundary_conditions.north() {
|
||||||
let r = s
|
DistributedBoundaryConditions::Channel(r) => {
|
||||||
.recv(boundary_conditions.north().channel().unwrap())
|
let r = s.recv(r).unwrap();
|
||||||
.unwrap();
|
euler::SAT_north(sbp.deref(), k, y, metrics, r.view());
|
||||||
// TODO: Interpolation
|
}
|
||||||
euler::SAT_north(sbp.deref(), k, y, metrics, r.view());
|
DistributedBoundaryConditions::Interpolate(r, int_op) => {
|
||||||
}
|
let r = s.recv(r).unwrap();
|
||||||
x if x == recv_south => {
|
let is_fine2coarse = r.shape()[1] > wb_ns.shape()[1];
|
||||||
let r = s
|
for (mut to, from) in wb_ns.outer_iter_mut().zip(r.outer_iter()) {
|
||||||
.recv(boundary_conditions.south().channel().unwrap())
|
if is_fine2coarse {
|
||||||
.unwrap();
|
int_op.fine2coarse(from.view(), to.view_mut());
|
||||||
// TODO: Interpolation
|
} else {
|
||||||
euler::SAT_south(sbp.deref(), k, y, metrics, r.view());
|
int_op.coarse2fine(from.view(), to.view_mut());
|
||||||
}
|
}
|
||||||
x if x == recv_west => {
|
}
|
||||||
let r = s
|
euler::SAT_north(sbp.deref(), k, y, metrics, wb_ns.view());
|
||||||
.recv(boundary_conditions.west().channel().unwrap())
|
}
|
||||||
.unwrap();
|
_ => unreachable!(),
|
||||||
// TODO: Interpolation
|
},
|
||||||
euler::SAT_west(sbp.deref(), k, y, metrics, r.view());
|
x if x == recv_south => match boundary_conditions.south() {
|
||||||
}
|
DistributedBoundaryConditions::Channel(r) => {
|
||||||
x if x == recv_east => {
|
let r = s.recv(r).unwrap();
|
||||||
let r = s
|
euler::SAT_south(sbp.deref(), k, y, metrics, r.view());
|
||||||
.recv(boundary_conditions.east().channel().unwrap())
|
}
|
||||||
.unwrap();
|
DistributedBoundaryConditions::Interpolate(r, int_op) => {
|
||||||
// TODO: Interpolation
|
let r = s.recv(r).unwrap();
|
||||||
euler::SAT_east(sbp.deref(), k, y, metrics, r.view());
|
let is_fine2coarse = r.shape()[1] > wb_ns.shape()[1];
|
||||||
}
|
for (mut to, from) in wb_ns.outer_iter_mut().zip(r.outer_iter()) {
|
||||||
|
if is_fine2coarse {
|
||||||
|
int_op.fine2coarse(from.view(), to.view_mut());
|
||||||
|
} else {
|
||||||
|
int_op.coarse2fine(from.view(), to.view_mut());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
euler::SAT_south(sbp.deref(), k, y, metrics, wb_ns.view());
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
},
|
||||||
|
x if x == recv_west => match boundary_conditions.west() {
|
||||||
|
DistributedBoundaryConditions::Channel(r) => {
|
||||||
|
let r = s.recv(r).unwrap();
|
||||||
|
euler::SAT_west(sbp.deref(), k, y, metrics, r.view());
|
||||||
|
}
|
||||||
|
DistributedBoundaryConditions::Interpolate(r, int_op) => {
|
||||||
|
let r = s.recv(r).unwrap();
|
||||||
|
let is_fine2coarse = r.shape()[1] > wb_ew.shape()[1];
|
||||||
|
for (mut to, from) in wb_ew.outer_iter_mut().zip(r.outer_iter()) {
|
||||||
|
if is_fine2coarse {
|
||||||
|
int_op.fine2coarse(from.view(), to.view_mut());
|
||||||
|
} else {
|
||||||
|
int_op.coarse2fine(from.view(), to.view_mut());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
euler::SAT_west(sbp.deref(), k, y, metrics, wb_ew.view());
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
},
|
||||||
|
x if x == recv_east => match boundary_conditions.east() {
|
||||||
|
DistributedBoundaryConditions::Channel(r) => {
|
||||||
|
let r = s.recv(r).unwrap();
|
||||||
|
euler::SAT_east(sbp.deref(), k, y, metrics, r.view());
|
||||||
|
}
|
||||||
|
DistributedBoundaryConditions::Interpolate(r, int_op) => {
|
||||||
|
let r = s.recv(r).unwrap();
|
||||||
|
let is_fine2coarse = r.shape()[1] > wb_ew.shape()[1];
|
||||||
|
for (mut to, from) in wb_ew.outer_iter_mut().zip(r.outer_iter()) {
|
||||||
|
if is_fine2coarse {
|
||||||
|
int_op.fine2coarse(from.view(), to.view_mut());
|
||||||
|
} else {
|
||||||
|
int_op.coarse2fine(from.view(), to.view_mut());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
euler::SAT_east(sbp.deref(), k, y, metrics, wb_ew.view());
|
||||||
|
}
|
||||||
|
_ => unreachable!(),
|
||||||
|
},
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
select.remove(sindex);
|
select.remove(sindex);
|
||||||
|
|
Loading…
Reference in New Issue