Skip to content

Commit e58cc4d

Browse files
committed
consolidate point distribution
1 parent 0ebb1ef commit e58cc4d

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

src/DistMesh.jl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,27 +62,31 @@ Use Tetrahedral quality analysis to control the meshing process
6262
struct DistMeshQuality{T} <: AbstractDistMeshAlgorithm
6363
iso::T
6464
deltat::T
65-
minimum::T
65+
filter_less_than::T # Remove tets less than the given quality
66+
#allow_n_regressions::Int # Might want this
67+
termination_quality::T # Once achieved, terminate
6668
sort::Bool # use hilbert sort to cache-localize points
6769
sort_interval::Int # retriangulations before resorting
6870
nonlinear::Bool # uses nonlinear edge force
6971
distribution::Symbol # intial point distribution
7072
end
7173

7274
function DistMeshQuality(;iso=0,
73-
ptol=.001,
7475
deltat=0.05,
75-
ttol=0.02,
76+
filter_less_than=0.02,
77+
termination_quality=0.3,
7678
sort=false,
7779
sort_interval=20,
78-
nonlinear=false,
80+
nonlinear=true,
7981
distribution=:regular)
80-
T = promote_type(typeof(iso),typeof(ptol),typeof(deltat), typeof(ttol))
81-
DistMeshQuality{T}(iso,
82-
deltat,
83-
ttol,
84-
ptol,
85-
distribution)
82+
DistMeshQuality(iso,
83+
deltat,
84+
filter_less_than,
85+
termination_quality,
86+
sort,
87+
sort_interval,
88+
nonlinear,
89+
distribution)
8690
end
8791

8892
"""

src/distmeshnd.jl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,10 @@ function distmesh(fdist::Function,
7373
p = VertType[]
7474
end
7575

76-
pt_dists = map(fdist, p) # cache to store point locations so we can minimize fdist calls
77-
78-
# add points to p based on the initial distribution
79-
if setup.distribution === :regular
80-
simplecubic!(fdist, p, pt_dists, h, setup.iso, origin, widths, VertType)
81-
elseif setup.distribution === :packed
82-
# face-centered cubic point distribution
83-
facecenteredcubic!(fdist, p, pt_dists, h, setup.iso, origin, widths, VertType)
84-
end
76+
pt_dists = eltype(VertType)[]
77+
78+
# setup the initial point distribution specified in setup
79+
point_distribution!(fdist,p,pt_dists,h, setup, origin, widths, VertType)
8580

8681
# Result struct for holding points, simplices, and iteration statistics
8782
result = DistMeshResult(p,

src/pointdistribution.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,16 @@ function facecenteredcubic!(fdist, points, dists, h, iso, origin, widths, ::Type
2222
push!(dists, d)
2323
end
2424
end
25-
end
25+
end
26+
27+
function point_distribution!(fdist, p, pt_dists, h, setup, origin, widths, ::Type{VertType}) where VertType
28+
map!(fdist, pt_dists, p) # cache to store point locations so we can minimize fdist calls
29+
30+
# add points to p based on the initial distribution
31+
if setup.distribution === :regular
32+
simplecubic!(fdist, p, pt_dists, h, setup.iso, origin, widths, VertType)
33+
elseif setup.distribution === :packed
34+
# face-centered cubic point distribution
35+
facecenteredcubic!(fdist, p, pt_dists, h, setup.iso, origin, widths, VertType)
36+
end
37+
end

0 commit comments

Comments
 (0)