Skip to content

Commit

Permalink
minor generalizations of boundary utils and connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
jlchan committed Oct 5, 2023
1 parent 101364a commit 77224d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/boundary_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
function coordinate_face_centroids(xf, md)
Nfaces = size(md.FToF, 1)
Nfp = size(md.xf, 1) ÷ Nfaces
xc = reshape(xf, Nfp, Nfaces * md.K)
xc = reshape(xf, Nfp, :)
return vec(typeof(xf)(sum(xc, dims=1) / size(xc, 1)))
end

Expand All @@ -12,7 +12,7 @@ end
Returns face centroids and `boundary_face_ids` on the boundaries of the domain given by md::MeshData.
"""
function boundary_face_centroids(md)
compute_face_centroids(md) = map(x->coordinate_face_centroids(x, md), md.xyzf)
compute_face_centroids(md) = map(x -> coordinate_face_centroids(x, md), md.xyzf)
xyzc = compute_face_centroids(md)
boundary_face_ids = findall(vec(md.FToF) .== 1:length(md.FToF))

Expand Down
9 changes: 4 additions & 5 deletions src/connectivity_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,18 @@ julia> mapM, mapP, mapB = build_node_maps(FToF, (xf, yf))
```
"""
function build_node_maps(FToF, Xf; tol = 100 * eps())

# total number of faces
num_faces_total = length(FToF)

num_faces_total = length(FToF)

# num face points: assumes all faces have the same number of nodes
num_nodes_per_face = length(Xf[1]) ÷ num_faces_total

# number nodes consecutively
mapM = reshape(collect(1:length(Xf[1])), num_nodes_per_face, num_faces_total);
mapM = reshape(collect(1:length(Xf[1])), num_nodes_per_face, :);
mapP = copy(mapM);

# reshape to be a face-first array
Xf = reshape.(Xf, num_nodes_per_face, num_faces_total)
Xf = reshape.(Xf, num_nodes_per_face, :)

p = zeros(Int, num_nodes_per_face)
for (f1, f2) in enumerate(FToF)
Expand Down

0 comments on commit 77224d9

Please sign in to comment.