Skip to content

Commit 3b7e080

Browse files
authored
Update TriRefinement implementation (#1076)
* Update 'TriRefinement' implementation * Rename variables
1 parent 6d68a21 commit 3b7e080

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/refinement/tri.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,20 @@ function refine(mesh, method::TriRefinement)
2222

2323
# retrieve geometry and topology
2424
points = vertices(mesh)
25-
connec = topology(mesh)
26-
27-
# convert to half-edge structure
28-
t = convert(HalfEdgeTopology, connec)
25+
topo = topology(mesh)
2926

3027
# indices to refine
3128
rinds = if isnothing(method.pred)
32-
1:nelements(t)
29+
1:nelements(topo)
3330
else
34-
filter(i -> method.pred(mesh[i]), 1:nelements(t))
31+
filter(i -> method.pred(mesh[i]), 1:nelements(topo))
3532
end
3633

3734
# indices to preserve
38-
pinds = setdiff(1:nelements(t), rinds)
35+
pinds = setdiff(1:nelements(topo), rinds)
3936

4037
# add centroids of elements
41-
∂₂₀ = Boundary{2,0}(t)
38+
∂₂₀ = Boundary{2,0}(topo)
4239
rpts = map(rinds) do elem
4340
is = ∂₂₀(elem)
4441
cₒ = sum(i -> to(points[i]), is) / length(is)
@@ -72,7 +69,7 @@ function refine(mesh, method::TriRefinement)
7269

7370
# connectivities of preserved elements
7471
for elem in pinds
75-
push!(newconnec, element(t, elem))
72+
push!(newconnec, element(topo, elem))
7673
end
7774

7875
SimpleMesh(newpoints, newconnec)

0 commit comments

Comments
 (0)