From 082db465bfbedffe44543654541bb6ff6f231599 Mon Sep 17 00:00:00 2001 From: Steve Kelly Date: Thu, 12 Dec 2019 22:07:55 -0500 Subject: [PATCH 1/2] use geps for point filtering --- src/distmeshnd.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/distmeshnd.jl b/src/distmeshnd.jl index ac51fdd..b5c10f1 100644 --- a/src/distmeshnd.jl +++ b/src/distmeshnd.jl @@ -65,12 +65,12 @@ function distmesh(fdist::Function, # add points to p based on the initial distribution if setup.distribution === :regular - simplecubic!(fdist, p, pt_dists, h, setup.iso, origin, widths, VertType) + simplecubic!(fdist, p, pt_dists, h, geps, origin, widths, VertType) elseif setup.distribution === :packed # face-centered cubic point distribution - facecenteredcubic!(fdist, p, pt_dists, h, setup.iso, origin, widths, VertType) + facecenteredcubic!(fdist, p, pt_dists, h, geps, origin, widths, VertType) end - + @show length(p) # initialize arrays pair_set = Set{Tuple{Int32,Int32}}() # set used for ensure we have a unique set of edges pair = Tuple{Int32,Int32}[] # edge indices (Int32 since we use Tetgen) @@ -120,7 +120,7 @@ function distmesh(fdist::Function, triangulationcount += 1 stats && push!(statsdata.retriangulations, lcount) end - + #@show lcount, triangulationcount compute_displacements!(fh, dp, pair, L, L0, bars, p, setup, VertType) # Zero out forces on fix points From d4bcef895d5c7d0054c3d07575becca0c83c4ffc Mon Sep 17 00:00:00 2001 From: Steve Kelly Date: Thu, 12 Dec 2019 22:59:07 -0500 Subject: [PATCH 2/2] wip --- src/distmeshnd.jl | 1 + src/tetgen.jl | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/distmeshnd.jl b/src/distmeshnd.jl index b5c10f1..f3c1f4a 100644 --- a/src/distmeshnd.jl +++ b/src/distmeshnd.jl @@ -117,6 +117,7 @@ function distmesh(fdist::Function, pt_dists[i] = fdist(p[i]) end end + triangulationcount == 0 && @show length(t) triangulationcount += 1 stats && push!(statsdata.retriangulations, lcount) end diff --git a/src/tetgen.jl b/src/tetgen.jl index bcacf45..993bfb9 100644 --- a/src/tetgen.jl +++ b/src/tetgen.jl @@ -1,5 +1,5 @@ function delaunayn(points) - tetio = tetrahedralize(TetGen.TetgenIO(points), "Q") # Q- Quiet + tetio = tetrahedralize(TetGen.TetgenIO(points), "S0JNFIQ") # Q- Quiet tetio end @@ -13,7 +13,8 @@ function delaunayn!(fdist, p, t, geps, sorted_pts) t_d = triangulation.tetrahedra resize!(t, length(t_d)) copyto!(t, t_d) # we need to copy since we have a shared reference with tetgen - + @show length(t_d) + exit() # average points to get mid point of each tetrahedra # if the mid point of the tetrahedra is outside of # the boundary we remove it. @@ -24,7 +25,7 @@ function delaunayn!(fdist, p, t, geps, sorted_pts) for ai in t t[j] = ai pm = (p[ai[1]].+p[ai[2]].+p[ai[3]].+p[ai[4]])./4 - j = ifelse(fdist(pm) <= -geps, nextind(t, j), j) + j = ifelse(fdist(pm) < -geps, nextind(t, j), j) end j <= lastindex(t) && resize!(t, j-1) nothing