Skip to content

Commit ac83daa

Browse files
committed
perform if-zero displacement sooner
1 parent 3380484 commit ac83daa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/distmeshnd.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,11 @@ function distmesh(fdist::Function,
308308

309309
# Move mesh points based on edge lengths L and forces F
310310
for i in eachindex(pair)
311-
L0_f = non_uniform ? L0[i].*lscbrt : lscbrt
312-
# compute force vectors
313-
F = L0_f-L[i]
314-
# edges are not allowed to pull, only repel
315-
if F > zero(eltype(L))
311+
if non_uniform && L[i] < L0[i] || L[i] < lscbrt
312+
L0_f = non_uniform ? L0[i].*lscbrt : lscbrt
313+
# compute force vectors
314+
F = L0_f-L[i]
315+
# edges are not allowed to pull, only repel
316316
FBar = bars[i].*F./L[i]
317317
# add the force vector to the node
318318
b1 = pair[i][1]

0 commit comments

Comments
 (0)