diff --git a/tree/Cargo.toml b/tree/Cargo.toml index 027298b5..ea9084c9 100644 --- a/tree/Cargo.toml +++ b/tree/Cargo.toml @@ -21,9 +21,7 @@ memoffset = "0.6" rand = "0.8.*" hyksort = { path = "../hyksort", optional = true } bempp-traits = { path = "../traits" } -rlst = { git = "https://github.com/linalg-rs/rlst.git" } -rlst-dense = { git = "https://github.com/linalg-rs/rlst.git" } -rlst-common = { git = "https://github.com/linalg-rs/rlst.git" } +rlst = { git = "https://github.com/linalg-rs/rlst.git" , branch = "legacy"} num = "0.4" [features] diff --git a/tree/examples/test_adaptive.rs b/tree/examples/test_adaptive.rs index 1ea1b6d8..07813ef7 100644 --- a/tree/examples/test_adaptive.rs +++ b/tree/examples/test_adaptive.rs @@ -115,118 +115,7 @@ // } // } #[cfg(feature = "mpi")] -use mpi::{environment::Universe, topology::UserCommunicator, traits::*}; - -use bempp_tree::implementations::helpers::points_fixture; - -#[cfg(feature = "mpi")] -use bempp_tree::types::{domain::Domain, morton::MortonKey, multi_node::MultiNodeTree}; - -use bempp_traits::types::Scalar; -use rlst_dense::traits::RawAccess; - -use rand::distributions::uniform::SampleUniform; - -use num::traits::Float; - -/// Test that the leaves on separate nodes do not overlap. -#[cfg(feature = "mpi")] -fn test_no_overlaps>( - world: &UserCommunicator, - tree: &MultiNodeTree, -) { - // Communicate bounds from each process - let max = tree.leaves.iter().max().unwrap(); - let min = tree.leaves.iter().min().unwrap(); - - // Gather all bounds at root - let size = world.size(); - let rank = world.rank(); - - let next_rank = if rank + 1 < size { rank + 1 } else { 0 }; - let previous_rank = if rank > 0 { rank - 1 } else { size - 1 }; - - let previous_process = world.process_at_rank(previous_rank); - let next_process = world.process_at_rank(next_rank); - - // Send max to partner - if rank < (size - 1) { - next_process.send(max); - } - - let mut partner_max = MortonKey::default(); - - if rank > 0 { - previous_process.receive_into(&mut partner_max); - } - - // Test that the partner's minimum node is greater than the process's maximum node - if rank > 0 { - assert!(partner_max < *min) - } -} - -/// Test that the globally defined domain contains all the points at a given node. -#[cfg(feature = "mpi")] -fn test_global_bounds( - world: &UserCommunicator, -) { - let npoints = 10000; - let points = points_fixture::(npoints, None, None); - - let comm = world.duplicate(); - - let domain = Domain::from_global_points(points.data(), &comm); - - // Test that all local points are contained within the global domain - for i in 0..npoints { - let x = points.data()[i]; - let y = points.data()[i + npoints]; - let z = points.data()[i + 2 * npoints]; - - assert!(domain.origin[0] <= x && x <= domain.origin[0] + domain.diameter[0]); - assert!(domain.origin[1] <= y && y <= domain.origin[1] + domain.diameter[1]); - assert!(domain.origin[2] <= z && z <= domain.origin[2] + domain.diameter[2]); - } -} - -#[cfg(feature = "mpi")] -fn main() { - // Setup an MPI environment - let universe: Universe = mpi::initialize().unwrap(); - let world = universe.world(); - let comm = world.duplicate(); - - // Setup tree parameters - let adaptive = true; - let n_crit = Some(50); - let depth: Option<_> = None; - let n_points = 10000; - let k = 2; - - let points = points_fixture::(n_points, None, None); - let global_idxs: Vec<_> = (0..n_points).collect(); - - let tree = MultiNodeTree::new( - &comm, - points.data(), - adaptive, - n_crit, - depth, - k, - &global_idxs, - ); - - test_global_bounds::(&comm); - if world.rank() == 0 { - println!("\t ... test_global_bounds passed on adaptive tree"); - } - - test_no_overlaps(&comm, &tree); - if world.rank() == 0 { - println!("\t ... test_no_overlaps passed on adaptive tree"); - } -} +fn main() {} #[cfg(not(feature = "mpi"))] fn main() {} diff --git a/tree/src/implementations/helpers.rs b/tree/src/implementations/helpers.rs index 41373797..9b3d8183 100644 --- a/tree/src/implementations/helpers.rs +++ b/tree/src/implementations/helpers.rs @@ -8,14 +8,12 @@ use num::Float; use rand::prelude::*; use rand::SeedableRng; -use rlst_dense::{ - array::Array, base_array::BaseArray, data_container::VectorContainer, rlst_dynamic_array2, -}; +use rlst::dense::{base_matrix::BaseMatrix, rlst_dynamic_mat, Dynamic, Matrix, VectorContainer}; use crate::types::morton::MortonKey; /// Alias for an rlst container for point data. -pub type PointsMat = Array, 2>, 2>; +pub type PointsMat = Matrix, Dynamic>, Dynamic>; /// Points fixture for testing, uniformly samples in each axis from min to max. /// @@ -38,7 +36,7 @@ pub fn points_fixture Domain { #[cfg(test)] mod test { use bempp_traits::types::Scalar; - use rlst_dense::traits::{RawAccess, Shape}; + use rlst::dense::{RawAccess, Shape}; use crate::implementations::helpers::{points_fixture, points_fixture_col, PointsMat}; @@ -80,7 +80,7 @@ mod test { assert!(domain.diameter.iter().all(|&x| x == domain.diameter[0])); // Test that all local points are contained within the local domain - let npoints = points.shape()[0]; + let npoints = points.shape().0; for i in 0..npoints { let point = [points[[i, 0]], points[[i, 1]], points[[i, 2]]]; diff --git a/tree/src/implementations/impl_morton.rs b/tree/src/implementations/impl_morton.rs index 6d177009..b2765282 100644 --- a/tree/src/implementations/impl_morton.rs +++ b/tree/src/implementations/impl_morton.rs @@ -1011,7 +1011,7 @@ impl MortonKeyInterface for MortonKey { #[cfg(test)] mod test { use itertools::Itertools; - use rlst_dense::traits::{RawAccess, Shape}; + use rlst::dense::{RawAccess, Shape}; use std::vec; use crate::implementations::helpers::points_fixture; @@ -1193,7 +1193,7 @@ mod test { let mut keys: Vec = Vec::new(); - for i in 0..points.shape()[0] { + for i in 0..points.shape().0 { let point = [points[[i, 0]], points[[i, 1]], points[[i, 2]]]; keys.push(MortonKey::from_point(&point, &domain, DEEPEST_LEVEL)); @@ -1466,7 +1466,7 @@ mod test { let mut keys = Vec::new(); - for i in 0..points.shape()[0] { + for i in 0..points.shape().0 { let point = [points[[i, 0]], points[[i, 1]], points[[i, 2]]]; keys.push(MortonKey::from_point(&point, &domain, DEEPEST_LEVEL)) } diff --git a/tree/src/implementations/impl_single_node.rs b/tree/src/implementations/impl_single_node.rs index 50ccad06..8d50d6a1 100644 --- a/tree/src/implementations/impl_single_node.rs +++ b/tree/src/implementations/impl_single_node.rs @@ -664,7 +664,7 @@ where #[cfg(test)] mod test { - use rlst_dense::traits::RawAccess; + use rlst::dense::RawAccess; use crate::implementations::helpers::{points_fixture, points_fixture_col};