Skip to content

Commit 1070f7b

Browse files
authored
Merge pull request #64 from WIAS-PDELib/chmerdon/periodic_coupling_matrix_bregionlists
allow arrays of bregions in get_periodic_coupling_matrix
2 parents b8ce68a + 7c177f5 commit 1070f7b

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/helper_functions.jl

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,14 @@ function _get_periodic_coupling_matrix(
221221

222222
@info "Computing periodic coupling matrix. This may take a while."
223223

224+
if typeof(b_from) <: Int
225+
b_from = [b_from]
226+
end
227+
228+
if typeof(b_to) <: Int
229+
b_to = [b_to]
230+
end
231+
224232
# total number of grid boundary faces
225233
boundary_nodes = xgrid[BFaceNodes]
226234
n_boundary_faces = size(boundary_nodes, 2)
@@ -250,9 +258,9 @@ function _get_periodic_coupling_matrix(
250258
faces_in_b_to = TiG[]
251259
faces_in_b_from = TiG[]
252260
for (i, region) in enumerate(boundary_regions)
253-
if region == b_to
261+
if region in b_to
254262
push!(faces_in_b_to, face_numbers_of_bfaces[i])
255-
elseif region == b_from
263+
elseif region in b_from
256264
push!(faces_in_b_from, face_numbers_of_bfaces[i])
257265
end
258266
end
@@ -354,7 +362,7 @@ function _get_periodic_coupling_matrix(
354362
for i_boundary_face in 1:n_boundary_faces
355363

356364
# for each boundary face: check if in b_from
357-
if boundary_regions[i_boundary_face] == b_from
365+
if boundary_regions[i_boundary_face] in b_from
358366

359367
local_dofs = @views dofs_on_boundary[:, i_boundary_face]
360368
for local_dof in local_dofs
@@ -419,8 +427,8 @@ Compute a coupling information for each dof on one boundary as a linear combinat
419427
420428
Input:
421429
- FES: FE space to be coupled (on its dofgrid)
422-
- b_from: boundary region of the grid which dofs should be replaced in terms of dofs on b_to
423-
- b_to: boundary region of the grid with dofs to replace the dofs in b_from
430+
- b_from: boundary region(s) of the grid which dofs should be replaced in terms of dofs on b_to
431+
- b_to: boundary region(s) of the grid with dofs to replace the dofs in b_from
424432
- give_opposite! Function in (y,x)
425433
- mask: (optional) vector of masking components
426434
- sparsity_tol: threshold for treating an interpolated value as zero

0 commit comments

Comments
 (0)