test_parallel_space/
test_parallel_space.rs1use mpi::{environment::Universe, traits::Communicator};
2use ndelement::{
3 ciarlet::LagrangeElementFamily,
4 types::{Continuity, ReferenceCellType},
5};
6use ndfunctionspace::{
7 FunctionSpaceImpl, ParallelFunctionSpaceImpl,
8 traits::{FunctionSpace, ParallelFunctionSpace},
9};
10use ndgrid::{
11 shapes::{unit_cube, unit_cube_distributed},
12 types::GraphPartitioner,
13};
14
15fn test_parallel_function_space<C: Communicator>(comm: &C) {
17 let grid = unit_cube_distributed::<f64, _>(
18 comm,
19 GraphPartitioner::None,
20 4,
21 4,
22 4,
23 ReferenceCellType::Tetrahedron,
24 );
25
26 let family = LagrangeElementFamily::<f64>::new(2, Continuity::Standard);
27 let space = ParallelFunctionSpaceImpl::new(&grid, &family);
28 let serial_grid = unit_cube::<f64>(4, 4, 4, ReferenceCellType::Tetrahedron);
29 let serial_space = FunctionSpaceImpl::new(&serial_grid, &family);
30
31 assert_eq!(space.global_size(), serial_space.global_size());
32}
33
34fn main() {
36 let universe: Universe = mpi::initialize().unwrap();
37 let world = universe.world();
38 let rank = world.rank();
39
40 if rank == 0 {
41 println!("Testing parallel function space");
42 }
43 test_parallel_function_space(&world);
44}