Skip to content

Commit

Permalink
debugging mixed grids
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed Apr 30, 2024
1 parent 6764c18 commit a68786f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
20 changes: 8 additions & 12 deletions examples/test_parallel_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ fn test_parallel_assembly_flat_triangle_grid<C: Communicator>(
let rank = comm.rank();
let size = comm.size();

let n = 5;
let n = 10;
let grid = example_flat_triangle_grid(comm, n);
let element = LagrangeElementFamily::<f64>::new(degree, cont);
let space = ParallelFunctionSpace::new(&grid, &element);
Expand Down Expand Up @@ -460,7 +460,7 @@ fn test_parallel_assembly_mixed_grid<C: Communicator>(comm: &C, degree: usize, c
let rank = comm.rank();
let size = comm.size();

let n = 10;
let n = 5;
let grid = example_mixed_grid(comm, n);
let element = LagrangeElementFamily::<f64>::new(degree, cont);
let space = ParallelFunctionSpace::new(&grid, &element);
Expand Down Expand Up @@ -522,12 +522,11 @@ fn test_parallel_assembly_mixed_grid<C: Communicator>(comm: &C, degree: usize, c
println!("== full_matrix ==");
println!("{:?}", full_matrix.indptr());
println!("{:?}", full_matrix.indices());
println!("{:?}", full_matrix.data());

//println!("{:?}", full_matrix.data());
println!("== serial_matrix ==");
println!("{:?}", serial_matrix.indptr());
println!("{:?}", serial_matrix.indices());
println!("{:?}", serial_matrix.data());
//println!("{:?}", serial_matrix.data());

for (i, j) in full_matrix.indices().iter().zip(serial_matrix.indices()) {
assert_eq!(i, j);
Expand Down Expand Up @@ -559,11 +558,8 @@ fn main() {
let world = universe.world();
let rank = world.rank();

Check warning on line 559 in examples/test_parallel_grid.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "mpi,strict")

Diff in /home/runner/work/bempp-rs/bempp-rs/examples/test_parallel_grid.rs

test_parallel_assembly_flat_triangle_grid(&world, 1, Continuity::Continuous);

if rank < 100 {
return;
}
test_parallel_assembly_mixed_grid(&world, 2, Continuity::Continuous);
if rank < 100 { return; }

if rank == 0 {
println!("Testing FlatTriangleGrid in parallel.");
Expand All @@ -589,11 +585,11 @@ fn main() {
}
test_parallel_assembly_flat_triangle_grid(&world, degree, Continuity::Continuous);
if rank == 0 {
println!("Testing assembly with DP{degree} using SingleElementGrid in parallel.");
println!("Testing assembly with P{degree} using SingleElementGrid in parallel.");
}
test_parallel_assembly_single_element_grid(&world, degree, Continuity::Continuous);
if rank == 0 {
println!("Testing assembly with DP{degree} using MixedGrid in parallel.");
println!("Testing assembly with P{degree} using MixedGrid in parallel.");
}
test_parallel_assembly_mixed_grid(&world, degree, Continuity::Continuous);
}
Expand Down
4 changes: 2 additions & 2 deletions src/assembly/batched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ fn assemble_batch_singular<
.unwrap();

Check warning on line 210 in src/assembly/batched.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "mpi,strict")

Diff in /home/runner/work/bempp-rs/bempp-rs/src/assembly/batched.rs
}
}
if trial_space.ownership(*trial_dof) == Ownership::Owned {
if trial_space.grid().cell_from_index(trial_space.grid().cell_index_from_id(*trial_cell)).ownership() == Ownership::Owned {
output.rows.push(test_space.global_dof_index(*test_dof));
output.cols.push(trial_space.global_dof_index(*trial_dof));
output.data.push(sum);
Expand Down Expand Up @@ -472,7 +472,7 @@ fn assemble_batch_singular_correction<
};

Check warning on line 472 in src/assembly/batched.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "mpi,strict")

Diff in /home/runner/work/bempp-rs/bempp-rs/src/assembly/batched.rs
}
}
if trial_space.ownership(*trial_dof) == Ownership::Owned {
if trial_space.grid().cell_from_index(trial_space.grid().cell_index_from_id(*trial_cell)).ownership() == Ownership::Owned {
output.rows.push(test_space.global_dof_index(*test_dof));
output.cols.push(trial_space.global_dof_index(*trial_dof));
output.data.push(sum);
Expand Down
3 changes: 3 additions & 0 deletions src/function/function_space/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl<'a, T: RlstScalar, GridImpl: ParallelGridType + GridType<T = T::Real>>
let (cell_dofs, entity_dofs, dofmap_size, owner_data) =

Check warning on line 86 in src/function/function_space/parallel.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "mpi,strict")

Diff in /home/runner/work/bempp-rs/bempp-rs/src/function/function_space/parallel.rs
assign_dofs(rank as usize, grid, e_family);


let mut elements = HashMap::new();
for cell in grid.cell_types() {
elements.insert(*cell, e_family.element(*cell));
Expand Down Expand Up @@ -186,6 +187,8 @@ impl<'a, T: RlstScalar, GridImpl: ParallelGridType + GridType<T = T::Real>>
}

Check warning on line 187 in src/function/function_space/parallel.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "mpi,strict")

Diff in /home/runner/work/bempp-rs/bempp-rs/src/function/function_space/parallel.rs
}

println!("{rank} {:?}", cell_dofs.iter().map(|cell| cell.iter().map(|i| global_dof_numbers[*i]).collect::<Vec<_>>()).collect::<Vec<_>>());

let serial_space = SerialFunctionSpace {
grid: grid.local_grid(),
elements,
Expand Down
3 changes: 3 additions & 0 deletions src/grid/mixed_grid/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ where
});

Check warning on line 280 in src/grid/mixed_grid/parallel.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "mpi,strict")

Diff in /home/runner/work/bempp-rs/bempp-rs/src/grid/mixed_grid/parallel.rs
}

println!("{rank} {:?}", cells.iter().map(|i| point_ids[*i]).collect::<Vec<_>>());
println!("{rank} {cell_ownership:?}");

let serial_grid = MixedGrid::new(
coordinates,
cells,
Expand Down

0 comments on commit a68786f

Please sign in to comment.