mpi_global_bounding_box/
mpi_global_bounding_box.rs1use bempp_octree::{
4 geometry::PhysicalBox,
5 octree::compute_global_bounding_box,
6 tools::{gather_to_root, generate_random_points},
7};
8use rand::prelude::*;
9use rand_chacha::ChaCha8Rng;
10
11pub fn main() {
12 let universe = mpi::initialize().unwrap();
14
15 let comm = universe.world();
17
18 let mut rng = ChaCha8Rng::seed_from_u64(2);
20
21 let npoints = 10;
23
24 let points = generate_random_points(npoints, &mut rng, &comm);
27
28 let bounding_box = compute_global_bounding_box(&points, &comm);
31
32 if let Some(points_root) = gather_to_root(&points, &comm) {
35 let expected = PhysicalBox::from_points(&points_root);
38 assert_eq!(expected.coordinates(), bounding_box.coordinates());
39 }
40}