Skip to content

Commit

Permalink
check cell ownership outside main assembly loop
Browse files Browse the repository at this point in the history
  • Loading branch information
mscroggs committed May 1, 2024
1 parent 67ae005 commit 0f478a7
Showing 1 changed file with 26 additions and 35 deletions.
61 changes: 26 additions & 35 deletions src/assembly/batched.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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));
}
}
}
}
Expand Down Expand Up @@ -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));
}
}
}
}
Expand Down

0 comments on commit 0f478a7

Please sign in to comment.