Skip to content

Commit

Permalink
Make copy_to_coupled_boundary! threaded (trixi-framework#1981)
Browse files Browse the repository at this point in the history
* Make `copy_to_coupled_boundary!` threaded

* Update src/semidiscretization/semidiscretization_coupled.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Reformat

---------

Co-authored-by: Simon Candelaresi <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
  • Loading branch information
3 people authored Jun 18, 2024
1 parent 16bdaf0 commit 75d8c67
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/semidiscretization/semidiscretization_coupled.jl
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,14 @@ function copy_to_coupled_boundary!(boundary_condition::BoundaryConditionCoupled{
i_cell_start, i_cell_step = index_to_start_step_2d(indices[1], axes(mesh_other, 1))
j_cell_start, j_cell_step = index_to_start_step_2d(indices[2], axes(mesh_other, 2))

i_cell = i_cell_start
j_cell = j_cell_start
# We need indices starting at 1 for the handling of `i_cell` etc.
Base.require_one_based_indexing(cells)

@threaded for i in eachindex(cells)
cell = cells[i]
i_cell = i_cell_start + (i - 1) * i_cell_step
j_cell = j_cell_start + (i - 1) * j_cell_step

for cell in cells
i_node = i_node_start
j_node = j_node_start
element_id = linear_indices[i_cell, j_cell]
Expand All @@ -628,9 +632,6 @@ function copy_to_coupled_boundary!(boundary_condition::BoundaryConditionCoupled{
i_node += i_node_step
j_node += j_node_step
end

i_cell += i_cell_step
j_cell += j_cell_step
end
end

Expand Down

0 comments on commit 75d8c67

Please sign in to comment.