From d16b274fe05738f48551dddd61464684c5e3148c Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Sat, 23 Oct 2021 19:35:37 +0000 Subject: [PATCH] Update hdf5/ndarray --- euler/Cargo.toml | 2 +- euler/src/lib.rs | 4 ++-- gridgeneration/Cargo.toml | 2 +- heat-equation/Cargo.toml | 2 +- heat-equation/src/main.rs | 3 --- maxwell/Cargo.toml | 2 +- maxwell/src/lib.rs | 28 ++++++++++++++-------------- multigrid/Cargo.toml | 4 ++-- multigrid/src/system.rs | 30 ++++++++++++++++-------------- sbp/Cargo.toml | 2 +- shallow_water/Cargo.toml | 2 +- webfront/Cargo.toml | 2 +- 12 files changed, 41 insertions(+), 42 deletions(-) diff --git a/euler/Cargo.toml b/euler/Cargo.toml index e3b6f4d..efd49aa 100644 --- a/euler/Cargo.toml +++ b/euler/Cargo.toml @@ -11,7 +11,7 @@ expensive_tests = [] serde1 = ["serde", "arrayvec/serde"] [dependencies] -ndarray = "0.14.0" +ndarray = "0.15.0" sbp = { path = "../sbp" } arrayvec = "0.6.0" serde = { version = "1.0.115", default-features = false, optional = true, features = ["derive"] } diff --git a/euler/src/lib.rs b/euler/src/lib.rs index e4cf538..9489889 100644 --- a/euler/src/lib.rs +++ b/euler/src/lib.rs @@ -227,14 +227,14 @@ impl Field { pub(crate) fn slice( &self, - info: &ndarray::SliceInfo<[ndarray::SliceOrIndex; 3], Do>, + info: ndarray::SliceInfo<[ndarray::SliceInfoElem; 3], ndarray::Ix3, Do>, ) -> ArrayView { self.0.slice(info) } pub(crate) fn slice_mut( &mut self, - info: &ndarray::SliceInfo<[ndarray::SliceOrIndex; 3], Do>, + info: ndarray::SliceInfo<[ndarray::SliceInfoElem; 3], ndarray::Ix3, Do>, ) -> ArrayViewMut { self.0.slice_mut(info) } diff --git a/gridgeneration/Cargo.toml b/gridgeneration/Cargo.toml index 3a3853c..7937ab3 100644 --- a/gridgeneration/Cargo.toml +++ b/gridgeneration/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Magnus Ulimoen "] edition = "2018" [dependencies] -ndarray = { version = "0.14.0", default-features = false } +ndarray = { version = "0.15.0", default-features = false } plotters = { version = "0.3.0", default-features = false, features = ["svg_backend", "line_series", "point_series"] } sbp = { path = "../sbp" } json5 = { version = "0.2.8", optional = true } diff --git a/heat-equation/Cargo.toml b/heat-equation/Cargo.toml index 5e2a939..d41df54 100644 --- a/heat-equation/Cargo.toml +++ b/heat-equation/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] sbp = { path = "../sbp", features = ["sparse"] } -ndarray = "0.14.0" +ndarray = "0.15.0" plotters = { version = "0.3.0", default-features = false, features = ["bitmap_gif", "bitmap_backend", "line_series"] } sprs = { version = "0.10.0", default-features = false } integrate = { path = "../utils/integrate" } diff --git a/heat-equation/src/main.rs b/heat-equation/src/main.rs index 44faba8..8d1cb91 100644 --- a/heat-equation/src/main.rs +++ b/heat-equation/src/main.rs @@ -11,9 +11,6 @@ struct Field(Array1); impl integrate::Integrable for Field { type State = Array1; type Diff = Array1; - fn assign(s: &mut Self::State, o: &Self::State) { - s.assign(o) - } fn scaled_add(s: &mut Self::State, o: &Self::Diff, scale: Float) { s.scaled_add(scale, o) } diff --git a/maxwell/Cargo.toml b/maxwell/Cargo.toml index e9a8c85..533cb55 100644 --- a/maxwell/Cargo.toml +++ b/maxwell/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" sparse = ["sbp/sparse", "sprs"] [dependencies] -ndarray = "0.14.0" +ndarray = "0.15.0" sbp = { path = "../sbp" } sprs = { version = "0.10.0", optional = true, default-features = false } integrate = { path = "../utils/integrate" } diff --git a/maxwell/src/lib.rs b/maxwell/src/lib.rs index 8973c93..cd647bf 100644 --- a/maxwell/src/lib.rs +++ b/maxwell/src/lib.rs @@ -44,14 +44,14 @@ impl Field { pub(crate) fn slice( &self, - info: &ndarray::SliceInfo<[ndarray::SliceOrIndex; 3], Do>, + info: ndarray::SliceInfo<[ndarray::SliceInfoElem; 3], ndarray::Ix3, Do>, ) -> ArrayView { self.0.slice(info) } pub(crate) fn slice_mut( &mut self, - info: &ndarray::SliceInfo<[ndarray::SliceOrIndex; 3], Do>, + info: ndarray::SliceInfo<[ndarray::SliceInfoElem; 3], ndarray::Ix3, Do>, ) -> ArrayViewMut { self.0.slice_mut(info) } @@ -519,10 +519,10 @@ fn SAT_characteristics( }; for ((((mut k, v), g), &kx), &ky) in k .slice_mut(s![.., .., nx - 1]) - .gencolumns_mut() + .columns_mut() .into_iter() - .zip(y.slice(s![.., .., nx - 1]).gencolumns()) - .zip(g.gencolumns()) + .zip(y.slice(s![.., .., nx - 1]).columns()) + .zip(g.columns()) .zip(metrics.detj_dxi_dx().slice(s![.., nx - 1])) .zip(metrics.detj_dxi_dy().slice(s![.., nx - 1])) { @@ -557,10 +557,10 @@ fn SAT_characteristics( }; for ((((mut k, v), g), &kx), &ky) in k .slice_mut(s![.., .., 0]) - .gencolumns_mut() + .columns_mut() .into_iter() - .zip(y.slice(s![.., .., 0]).gencolumns()) - .zip(g.gencolumns()) + .zip(y.slice(s![.., .., 0]).columns()) + .zip(g.columns()) .zip(metrics.detj_dxi_dx().slice(s![.., 0])) .zip(metrics.detj_dxi_dy().slice(s![.., 0])) { @@ -600,10 +600,10 @@ fn SAT_characteristics( }; for ((((mut k, v), g), &kx), &ky) in k .slice_mut(s![.., ny - 1, ..]) - .gencolumns_mut() + .columns_mut() .into_iter() - .zip(y.slice(s![.., ny - 1, ..]).gencolumns()) - .zip(g.gencolumns()) + .zip(y.slice(s![.., ny - 1, ..]).columns()) + .zip(g.columns()) .zip(metrics.detj_deta_dx().slice(s![ny - 1, ..])) .zip(metrics.detj_deta_dy().slice(s![ny - 1, ..])) { @@ -637,10 +637,10 @@ fn SAT_characteristics( }; for ((((mut k, v), g), &kx), &ky) in k .slice_mut(s![.., 0, ..]) - .gencolumns_mut() + .columns_mut() .into_iter() - .zip(y.slice(s![.., 0, ..]).gencolumns()) - .zip(g.gencolumns()) + .zip(y.slice(s![.., 0, ..]).columns()) + .zip(g.columns()) .zip(metrics.detj_deta_dx().slice(s![0, ..])) .zip(metrics.detj_deta_dy().slice(s![0, ..])) { diff --git a/multigrid/Cargo.toml b/multigrid/Cargo.toml index 01dc0df..d12b4fe 100644 --- a/multigrid/Cargo.toml +++ b/multigrid/Cargo.toml @@ -8,11 +8,11 @@ edition = "2018" [dependencies] sbp = { path = "../sbp", features = ["serde1"] } euler = { path = "../euler", features = ["serde1"] } -hdf5 = "0.7.0" +hdf5 = "0.8.0" integrate = { path = "../utils/integrate" } rayon = "1.3.0" indicatif = "0.17.0-beta.1" -ndarray = { version = "0.14.0", features = ["serde"] } +ndarray = { version = "0.15.0", features = ["serde"] } serde = { version = "1.0.115", features = ["derive"] } json5 = "0.3.0" indexmap = { version = "1.5.2", features = ["serde-1"] } diff --git a/multigrid/src/system.rs b/multigrid/src/system.rs index d81fa06..9740313 100644 --- a/multigrid/src/system.rs +++ b/multigrid/src/system.rs @@ -37,9 +37,9 @@ impl BaseSystem { let output = hdf5::File::create(output).unwrap(); output .new_dataset::() - .resizable(true) + .shape((0..,)) .chunk((1,)) - .create("t", (0,)) + .create("t") .unwrap(); Self { names, @@ -92,8 +92,9 @@ impl BaseSystem { let add_dim = |name| { g.new_dataset::() .chunk((grid.ny(), grid.nx())) - .gzip(9) - .create(name, (grid.ny(), grid.nx())) + .deflate(9) + .shape((grid.ny(), grid.nx())) + .create(name) }; let xds = add_dim("x").unwrap(); xds.write(grid.x()).unwrap(); @@ -102,11 +103,11 @@ impl BaseSystem { let add_var = |name| { g.new_dataset::() - .gzip(3) - .shuffle(true) + .shuffle() + .deflate(3) .chunk((1, grid.ny(), grid.nx())) - .resizable(true) - .create(name, (0, grid.ny(), grid.nx())) + .shape((0.., grid.ny(), grid.nx())) + .create(name) }; add_var("rho").unwrap(); add_var("rhou").unwrap(); @@ -261,8 +262,9 @@ impl BaseSystem { let add_dim = |name| { g.new_dataset::() .chunk((grid.ny(), grid.nx())) - .gzip(9) - .create(name, (grid.ny(), grid.nx())) + .deflate(9) + .shape((grid.ny(), grid.nx())) + .create(name) }; let xds = add_dim("x").unwrap(); xds.write(grid.x()).unwrap(); @@ -271,11 +273,11 @@ impl BaseSystem { let add_var = |name| { g.new_dataset::() - .gzip(3) - .shuffle(true) + .shuffle() + .deflate(3) .chunk((1, grid.ny(), grid.nx())) - .resizable(true) - .create(name, (0, grid.ny(), grid.nx())) + .shape((0.., grid.ny(), grid.nx())) + .create(name) }; add_var("rho").unwrap(); add_var("rhou").unwrap(); diff --git a/sbp/Cargo.toml b/sbp/Cargo.toml index aac3e27..cac83c7 100644 --- a/sbp/Cargo.toml +++ b/sbp/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Magnus Ulimoen "] edition = "2018" [dependencies] -ndarray = { version = "0.14.0", features = ["approx"] } +ndarray = { version = "0.15.0", features = ["approx"] } approx = "0.4.0" sprs = { version = "0.10.0", optional = true, default-features = false } serde = { version = "1.0.115", optional = true, default-features = false, features = ["derive"] } diff --git a/shallow_water/Cargo.toml b/shallow_water/Cargo.toml index 1aba6ba..f0bab6e 100644 --- a/shallow_water/Cargo.toml +++ b/shallow_water/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Magnus Ulimoen "] edition = "2018" [dependencies] -ndarray = "0.14.0" +ndarray = "0.15.0" sbp = { path = "../sbp" } log = "0.4.8" integrate = { path = "../utils/integrate" } diff --git a/webfront/Cargo.toml b/webfront/Cargo.toml index 7d80dc0..e336fe2 100644 --- a/webfront/Cargo.toml +++ b/webfront/Cargo.toml @@ -12,7 +12,7 @@ wasm-bindgen = "0.2.63" console_error_panic_hook = "0.1.6" wee_alloc = "0.4.5" sbp = { path = "../sbp", features = ["f32"] } -ndarray = "0.14.0" +ndarray = "0.15.0" euler = { path = "../euler" } maxwell = { path = "../maxwell" } shallow-water = { path = "../shallow_water" }