diff --git a/src/assembly/batched.rs b/src/assembly/batched.rs index f0f39ea5..1e92f412 100644 --- a/src/assembly/batched.rs +++ b/src/assembly/batched.rs @@ -210,16 +210,9 @@ fn assemble_batch_singular< .unwrap(); } } - 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); - } + output.rows.push(test_space.global_dof_index(*test_dof)); + output.cols.push(trial_space.global_dof_index(*trial_dof)); + output.data.push(sum); } } } @@ -477,16 +470,9 @@ fn assemble_batch_singular_correction< }; } } - 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); - } + output.rows.push(test_space.global_dof_index(*test_dof)); + output.cols.push(trial_space.global_dof_index(*trial_dof)); + output.data.push(sum); } } } @@ -785,14 +771,17 @@ pub trait BatchedAssembler: Sync + Sized { for vertex in 0..grid.number_of_vertices() { for test_cell_info in grid.vertex_to_cells(vertex) { let test_cell = grid.cell_from_index(test_cell_info.cell); - let test_cell_type = test_cell.topology().cell_type(); - for trial_cell_info in grid.vertex_to_cells(vertex) { - let trial_cell = grid.cell_from_index(trial_cell_info.cell); - let trial_cell_type = trial_cell.topology().cell_type(); - - if let Some(pairs) = get_pairs_if_smallest(&test_cell, &trial_cell, vertex) { - cell_pairs[pair_indices[&(test_cell_type, trial_cell_type, pairs)]] - .push((test_cell_info.cell, trial_cell_info.cell)); + if test_cell.ownership() == Ownership::Owned { + let test_cell_type = test_cell.topology().cell_type(); + for trial_cell_info in grid.vertex_to_cells(vertex) { + let trial_cell = grid.cell_from_index(trial_cell_info.cell); + let trial_cell_type = trial_cell.topology().cell_type(); + + if let Some(pairs) = get_pairs_if_smallest(&test_cell, &trial_cell, vertex) + { + cell_pairs[pair_indices[&(test_cell_type, trial_cell_type, pairs)]] + .push((test_cell_info.cell, trial_cell_info.cell)); + } } } } @@ -945,13 +934,15 @@ pub trait BatchedAssembler: Sync + Sized { for test_cell_info in grid.vertex_to_cells(vertex) { let test_cell = grid.cell_from_index(test_cell_info.cell); let test_cell_type = test_cell.topology().cell_type(); - for trial_cell_info in grid.vertex_to_cells(vertex) { - let trial_cell = grid.cell_from_index(trial_cell_info.cell); - let trial_cell_type = trial_cell.topology().cell_type(); - - if get_pairs_if_smallest(&test_cell, &trial_cell, vertex).is_some() { - cell_pairs[cell_type_indices[&(test_cell_type, trial_cell_type)]] - .push((test_cell_info.cell, trial_cell_info.cell)); + if test_cell.ownership() == Ownership::Owned { + for trial_cell_info in grid.vertex_to_cells(vertex) { + let trial_cell = grid.cell_from_index(trial_cell_info.cell); + let trial_cell_type = trial_cell.topology().cell_type(); + + if get_pairs_if_smallest(&test_cell, &trial_cell, vertex).is_some() { + cell_pairs[cell_type_indices[&(test_cell_type, trial_cell_type)]] + .push((test_cell_info.cell, trial_cell_info.cell)); + } } } }