File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 49
49
function tet_to_edges! (pair:: Vector , pair_set:: Set , t)
50
50
empty! (pair_set)
51
51
length (pair) < length (t)* 6 && resize! (pair, length (t)* 6 )
52
- num_pair = 1
52
+ num_pair = 0
53
53
@inbounds for i in eachindex (t)
54
54
for ep in 1 : 6
55
55
p1 = t[i][tetpairs[ep][1 ]]
56
56
p2 = t[i][tetpairs[ep][2 ]]
57
57
elt = p1 > p2 ? (p2,p1) : (p1,p2)
58
58
if ! in (elt, pair_set)
59
59
push! (pair_set, elt)
60
- pair[num_pair] = elt
61
60
num_pair += 1
61
+ pair[num_pair] = elt
62
62
end
63
63
end
64
64
end
65
65
66
66
# sort the edge pairs for better point lookup
67
- sort! (view (pair, 1 : ( num_pair- 1 ) ))
67
+ sort! (view (pair, 1 : num_pair))
68
68
69
- return num_pair - 1 # return the number of pairs
69
+ return num_pair # return the number of pairs
70
70
end
71
71
72
72
function bitpack (xi,yi)
Original file line number Diff line number Diff line change @@ -107,9 +107,11 @@ function distmesh(fdist::Function,
107
107
num_pairs = tet_to_edges! (pair, pair_set, result. tetrahedra) # Describe each edge by a unique pair of nodes
108
108
109
109
# resize arrays for new pair count
110
- length (bars) < num_pairs && resize! (bars, num_pairs)
111
- length (L) < num_pairs && resize! (L, num_pairs)
112
- non_uniform && length (L0) < num_pairs && resize! (L0, num_pairs)
110
+ if length (L) < num_pairs
111
+ resize! (bars, num_pairs)
112
+ resize! (L, num_pairs)
113
+ non_uniform && resize! (L0, num_pairs)
114
+ end
113
115
114
116
triangulationcount += 1
115
117
stats && push! (result. stats. retriangulations, lcount)
You can’t perform that action at this time.
0 commit comments