Skip to content

Commit 45e0390

Browse files
committed
parameter study stuff
1 parent 14a631e commit 45e0390

File tree

5 files changed

+42
-23
lines changed

5 files changed

+42
-23
lines changed

bench/benchmarks.jl

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ using Plots
44
using Dates
55
using Descartes
66
using GeometryBasics
7-
using JLD
8-
using HDF5
7+
#using JLD
8+
#using HDF5
99

1010
include("util.jl")
1111

@@ -60,31 +60,29 @@ println("Benchmarking DistMesh.jl...")
6060

6161
timestamp = Dates.format(now(), "yyyy-mm-ddTHH_MM")
6262
# generate an orthogonal test suite
63-
for ttol in 0.01:0.01:0.05, deltat in 0.02:0.02:0.2, el = 0.05:0.05:0.2
63+
for ttol in 0.01:0.01:0.05, deltat in 0.05:0.05:0.1, el = 0.1:0.05:0.2
6464
rt = time()
65-
p,t,s = distmesh(torus,
66-
huniform,
65+
result = distmesh(torus,
66+
HUniform(),
6767
el,
68-
DistMeshSetup(deltat=deltat, retriangulation_criteria=RetriangulateMaxMove(ttol)),
68+
DistMeshSetup(deltat=deltat,ttol=ttol,distribution=:packed),
6969
origin = GeometryBasics.Point{3,Float64}(-2),
7070
widths = GeometryBasics.Point{3,Float64}(4),
71-
stats=true,
72-
distribution=:packed)
71+
stats=true)
7372
running_time = time() - rt # approximate, since we mostly care about convergence factors
7473
item = "torus$timestamp"
7574
folder = joinpath(@__DIR__, "output/$item")
7675
!isdir(folder) && mkdir(folder)
7776
param_str = "_ttol=$(ttol)_deltat=$(deltat)_el=$(el)"
7877
# save plots
79-
plotout(s, DistMesh.triangle_qualities(p,t), folder, param_str)
78+
plotout(result.stats, DistMesh.triangle_qualities(result.points,result.tetrahedra), folder, param_str)
8079
# save dataset as JLD
81-
jldopen("$folder/$item.jld", "w") do file
82-
g = g_create(file, param_str)
83-
g["points"] = p
84-
g["tets"] = t
85-
g["stats"] = s
86-
g["running_time"] = running_time
87-
end
80+
# jldopen("$folder/$item.jld", "w") do file
81+
# g = g_create(file, param_str)
82+
# g["points"] = p
83+
# g["tets"] = t
84+
# g["stats"] = s
85+
# g["running_time"] = running_time
86+
# end
8887
println(param_str)
8988
end
90-

bench/util.jl

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,32 @@
22
function plotout(statsdata, qualities, folder, name)
33

44
qual_hist = Plots.histogram(qualities, title = "Quality", bins=30, legend=false)
5-
avg_plt = Plots.plot(statsdata.average_qual, title = "Average Quality", legend=false, ylabel="Quality")
5+
avg_plt = Plots.plot(statsdata.average_qual, title = "Average Tri Quality", legend=false, ylabel="Quality")
66
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
7-
med_plt = Plots.plot(statsdata.median_qual, title = "Median Quality", legend=false, ylabel="Quality")
7+
8+
med_plt = Plots.plot(statsdata.median_qual, title = "Median Tri Quality", legend=false, ylabel="Quality")
9+
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
10+
11+
min_plt = Plots.plot(statsdata.minimum_qual, title = "Minimum Tri Quality", legend=false, ylabel="Quality")
12+
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
13+
14+
max_plt = Plots.plot(statsdata.maximum_qual, title = "Maximum Tri Quality", legend=false, ylabel="Quality")
15+
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
16+
17+
min_tq_plt = Plots.plot(statsdata.min_volume_edge_ratio, title = "Minimum Tet Quality", legend=false, ylabel="Vol/Edge Ratio")
18+
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
19+
20+
max_tq_plt = Plots.plot(statsdata.max_volume_edge_ratio, title = "Maximum Tet Quality", legend=false, ylabel="Vol/Edge Ratio")
821
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
22+
923
maxdp_plt = Plots.plot(statsdata.maxdp, title = "Max Displacement", legend=false, ylabel="Edge Displacement")
1024
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
25+
1126
maxmove_plt = Plots.plot(statsdata.maxmove, title = "Max Move", legend=false, ylabel="Point Displacement")
1227
vline!(statsdata.retriangulations, line=(0.2, :dot, [:red]))
13-
plt = Plots.plot(avg_plt, med_plt,maxdp_plt,maxmove_plt,layout=(2,2), xlabel="Iteration")
28+
29+
plt = Plots.plot(avg_plt, med_plt,min_plt,max_plt,min_tq_plt,max_tq_plt,maxdp_plt,maxmove_plt,layout=(4,2), xlabel="Iteration")
1430

1531
savefig(plt, "$folder/result_stat$name.svg")
1632
savefig(qual_hist, "$folder/result_qual$name.svg")
17-
end
33+
end

src/DistMesh.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ struct DistMeshStatistics{T}
8989
median_qual::Vector{T}
9090
minimum_qual::Vector{T}
9191
maximum_qual::Vector{T}
92+
min_volume_edge_ratio::Vector{T}
93+
max_volume_edge_ratio::Vector{T}
9294
retriangulations::Vector{Int} # Iteration num where retriangulation occured
9395
end
9496

95-
DistMeshStatistics() = DistMeshStatistics{Float64}([],[],[],[],[],[],[])
97+
DistMeshStatistics() = DistMeshStatistics{Float64}([],[],[],[],[],[],[],[],[])
9698

9799
"""
98100
Uniform edge length function.

src/distmeshnd.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ function distmesh(fdist::Function,
179179
push!(result.stats.median_qual, qualities[round(Int,length(qualities)/2)])
180180
push!(result.stats.minimum_qual, mine)
181181
push!(result.stats.maximum_qual, maxe)
182+
min_v_edge, max_v_edge = volume_edge_extrema(result.points,result.tetrahedra)
183+
push!(result.stats.min_volume_edge_ratio, min_v_edge)
184+
push!(result.stats.max_volume_edge_ratio, max_v_edge)
182185
end
183186

184187
# Termination criterion

test/vals.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
stat_04 = DistMeshStatistics{Float64}([0.015861808197171447, 0.04333997993833317, 0.030539364290593892, 0.03136281119397018, 0.02563981053478331, 0.013146443917954281, 0.01175223918624788, 0.010072460884465097, 0.010095555217344735, 0.01013796999511984, 0.010140632643274205, 0.010304587497854923, 0.010462582532303984, 0.010716139899621396, 0.011021054862975449, 0.011240323884294448, 0.01142232855445764, 0.011612249108897528, 0.011811272270023909, 0.012034107769143534, 0.012056898531952622, 0.012293750640801487, 0.01253910968482863, 0.013004095618999076, 0.013252841175879744, 0.013917719093503656, 0.013396847948485273, 0.003189020157222165, 0.001562109707501573, 0.0009931741145458414, 0.0006511321515956363, 0.0004797453102939885, 0.00037832020260625596], [0.01586180819717149, 0.043339979938333134, 0.030539364290593937, 0.025048818294013803, 0.025639810534783355, 0.013146443917954269, 0.011752239186247897, 0.010072460884465097, 0.010095555217344726, 0.0101379699951199, 0.010140632643274243, 0.010304587497854942, 0.01046258253230403, 0.010716139899621346, 0.011021054862975494, 0.011240323884294462, 0.011422328554457682, 0.01161224910889749, 0.011811272270023897, 0.012034107769143534, 0.012056898531952602, 0.012293750640801451, 0.012539109684828593, 0.012245282734261766, 0.0023300852630041935, 0.002447933509399279, 0.0025695121186121712, 0.002338682036472209, 0.0015621097075015642, 0.0009931741145458226, 0.0006511321515956257, 0.00044189161676361335, 0.00031167049211313627], [0.8513479333014904, 0.7999266605934156, 0.8237832569578655, 0.817521012694373, 0.8296223294441304, 0.8782925269541574, 0.8923366367078434, 0.8927651653134971, 0.8945352521480744, 0.8976771953430919, 0.9006192563827091, 0.9015511578835772, 0.9023325838482263, 0.9021231128462143, 0.9013980826173323, 0.9013870765654909, 0.9016622807520963, 0.9018313595924459, 0.9018918673592288, 0.9018399155548923, 0.9017386119698663, 0.9014401063090378, 0.9010116089076747, 0.8993122456162714, 0.8985981708401958, 0.8955172651439618, 0.8942894809739554, 0.8907754718921969, 0.8909268818143122, 0.8910108579548632, 0.8910571422908532, 0.8910820499895338, 0.8910946964871009], [0.8652080743786591, 0.8543837234573923, 0.8623250243903223, 0.8600554459902974, 0.8623728487909205, 0.8675526892316004, 0.86813448792801, 0.867886604152207, 0.8683165255416818, 0.8741409899736776, 0.8874376497339312, 0.8871929206150294, 0.8868023977155903, 0.8862767476859909, 0.8855800788413576, 0.8847996249062478, 0.883963567834448, 0.8830513999087894, 0.8820448631022926, 0.8809192341868274, 0.8797024210613953, 0.8783238518802771, 0.8767724740675475, 0.8749410864744815, 0.872938454517967, 0.8706218244939238, 0.8702910360100947, 0.8684338642874472, 0.8683585516484286, 0.8682860253670031, 0.8682092206857535, 0.8681310653003876, 0.8680532945221214], [0.8042665470208608, 0.030882544034837138, 0.031205915063413674, 0.039027484580454345, 0.043185620349155414, 0.7801798146155217, 0.7757327592563474, 0.7895610286647429, 0.7982628961615663, 0.8019173511962595, 0.8080797261120612, 0.8113232071425015, 0.8141475611173873, 0.8164017608524986, 0.8162646723007843, 0.8161431245874965, 0.8160398512387739, 0.8159572530416423, 0.8158854172957702, 0.8158108155078492, 0.8157818549664978, 0.8157456416732362, 0.8157018839829728, 0.8155656386618806, 0.8154254644984282, 0.8152833339192274, 0.8151391827922918, 0.7527856381383334, 0.7513436255829244, 0.7502417424228109, 0.749393575220651, 0.7487360804668232, 0.7482227724278689], [1.0000000000000002, 1.0, 0.9999999999288185, 0.9999999997538248, 0.9999999998746554, 0.9999999996769505, 0.9999999998056341, 0.9999999998989167, 0.9999999999633605, 0.9999999999958346, 0.9999999999853654, 0.9999999999148561, 0.9999999997622445, 0.9999999995007761, 0.9999999991000814, 0.999999999251637, 0.9999999989511745, 0.9999999983301885, 0.9999999974434121, 0.9999999963425825, 0.9999999951246715, 0.9999999937977475, 0.9999999924659485, 0.9999999911705475, 0.9999999900045999, 0.9999999889813795, 0.9999999881198527, 0.999999983355277, 0.9999999885253779, 0.9999999920525013, 0.9999999944812701, 0.999999996164262, 0.9999999973343159], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27])
1+
stat_04 = DistMeshStatistics{Float64}([0.015861808197171447, 0.04333997993833317, 0.030539364290593892, 0.03136281119397018, 0.02563981053478331, 0.013146443917954281, 0.01175223918624788, 0.010072460884465097, 0.010095555217344735, 0.01013796999511984, 0.010140632643274205, 0.010304587497854923, 0.010462582532303984, 0.010716139899621396, 0.011021054862975449, 0.011240323884294448, 0.01142232855445764, 0.011612249108897528, 0.011811272270023909, 0.012034107769143534, 0.012056898531952622, 0.012293750640801487, 0.01253910968482863, 0.013004095618999076, 0.013252841175879744, 0.013917719093503656, 0.013396847948485273, 0.003189020157222165, 0.001562109707501573, 0.0009931741145458414, 0.0006511321515956363, 0.0004797453102939885, 0.00037832020260625596], [0.01586180819717149, 0.043339979938333134, 0.030539364290593937, 0.025048818294013803, 0.025639810534783355, 0.013146443917954269, 0.011752239186247897, 0.010072460884465097, 0.010095555217344726, 0.0101379699951199, 0.010140632643274243, 0.010304587497854942, 0.01046258253230403, 0.010716139899621346, 0.011021054862975494, 0.011240323884294462, 0.011422328554457682, 0.01161224910889749, 0.011811272270023897, 0.012034107769143534, 0.012056898531952602, 0.012293750640801451, 0.012539109684828593, 0.012245282734261766, 0.0023300852630041935, 0.002447933509399279, 0.0025695121186121712, 0.002338682036472209, 0.0015621097075015642, 0.0009931741145458226, 0.0006511321515956257, 0.00044189161676361335, 0.00031167049211313627], [0.8513479333014904, 0.7999266605934156, 0.8237832569578655, 0.817521012694373, 0.8296223294441304, 0.8782925269541574, 0.8923366367078434, 0.8927651653134971, 0.8945352521480744, 0.8976771953430919, 0.9006192563827091, 0.9015511578835772, 0.9023325838482263, 0.9021231128462143, 0.9013980826173323, 0.9013870765654909, 0.9016622807520963, 0.9018313595924459, 0.9018918673592288, 0.9018399155548923, 0.9017386119698663, 0.9014401063090378, 0.9010116089076747, 0.8993122456162714, 0.8985981708401958, 0.8955172651439618, 0.8942894809739554, 0.8907754718921969, 0.8909268818143122, 0.8910108579548632, 0.8910571422908532, 0.8910820499895338, 0.8910946964871009], [0.8652080743786591, 0.8543837234573923, 0.8623250243903223, 0.8600554459902974, 0.8623728487909205, 0.8675526892316004, 0.86813448792801, 0.867886604152207, 0.8683165255416818, 0.8741409899736776, 0.8874376497339312, 0.8871929206150294, 0.8868023977155903, 0.8862767476859909, 0.8855800788413576, 0.8847996249062478, 0.883963567834448, 0.8830513999087894, 0.8820448631022926, 0.8809192341868274, 0.8797024210613953, 0.8783238518802771, 0.8767724740675475, 0.8749410864744815, 0.872938454517967, 0.8706218244939238, 0.8702910360100947, 0.8684338642874472, 0.8683585516484286, 0.8682860253670031, 0.8682092206857535, 0.8681310653003876, 0.8680532945221214], [0.8042665470208608, 0.030882544034837138, 0.031205915063413674, 0.039027484580454345, 0.043185620349155414, 0.7801798146155217, 0.7757327592563474, 0.7895610286647429, 0.7982628961615663, 0.8019173511962595, 0.8080797261120612, 0.8113232071425015, 0.8141475611173873, 0.8164017608524986, 0.8162646723007843, 0.8161431245874965, 0.8160398512387739, 0.8159572530416423, 0.8158854172957702, 0.8158108155078492, 0.8157818549664978, 0.8157456416732362, 0.8157018839829728, 0.8155656386618806, 0.8154254644984282, 0.8152833339192274, 0.8151391827922918, 0.7527856381383334, 0.7513436255829244, 0.7502417424228109, 0.749393575220651, 0.7487360804668232, 0.7482227724278689], [1.0000000000000002, 1.0, 0.9999999999288185, 0.9999999997538248, 0.9999999998746554, 0.9999999996769505, 0.9999999998056341, 0.9999999998989167, 0.9999999999633605, 0.9999999999958346, 0.9999999999853654, 0.9999999999148561, 0.9999999997622445, 0.9999999995007761, 0.9999999991000814, 0.999999999251637, 0.9999999989511745, 0.9999999983301885, 0.9999999974434121, 0.9999999963425825, 0.9999999951246715, 0.9999999937977475, 0.9999999924659485, 0.9999999911705475, 0.9999999900045999, 0.9999999889813795, 0.9999999881198527, 0.999999983355277, 0.9999999885253779, 0.9999999920525013, 0.9999999944812701, 0.999999996164262, 0.9999999973343159], [],[], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27])
22
hilbert_a = Array{Float64,1}[[0.9, 0.9, 0.9], [0.6, 0.6, 0.9], [0.6, 0.9, 0.9], [0.6, 0.6, 0.6], [0.9, 0.9, 0.6], [0.9, 0.6, 0.6], [0.6, 0.9, 0.6], [0.9, 0.6, 0.9], [0.6, 0.3, 0.9], [0.9, 0.3, 0.9], [0.6, 0.3, 0.6], [0.9, 0.0, 0.9], [0.9, 0.0, 0.6], [0.9, 0.3, 0.6], [0.6, 0.0, 0.9], [0.6, 0.0, 0.6], [0.3, 0.0, 0.6], [0.0, 0.0, 0.6], [0.0, 0.0, 0.9], [0.0, 0.3, 0.6], [0.0, 0.3, 0.9], [0.3, 0.3, 0.9], [0.3, 0.0, 0.9], [0.3, 0.3, 0.6], [0.0, 0.6, 0.6], [0.0, 0.6, 0.9], [0.3, 0.6, 0.6], [0.3, 0.9, 0.9], [0.3, 0.6, 0.9], [0.0, 0.9, 0.6], [0.3, 0.9, 0.6], [0.3, 0.9, 0.3], [0.3, 0.9, 0.0], [0.0, 0.9, 0.9], [0.0, 0.9, 0.3], [0.3, 0.6, 0.3], [0.0, 0.9, 0.0], [0.3, 0.6, 0.0], [0.0, 0.6, 0.3], [0.0, 0.6, 0.0], [0.3, 0.3, 0.0], [0.0, 0.3, 0.3], [0.3, 0.0, 0.0], [0.3, 0.3, 0.3], [0.0, 0.0, 0.0], [0.0, 0.0, 0.3], [0.0, 0.3, 0.0], [0.3, 0.0, 0.3], [0.9, 0.0, 0.3], [0.6, 0.0, 0.3], [0.9, 0.3, 0.3], [0.6, 0.0, 0.0], [0.6, 0.3, 0.3], [0.9, 0.0, 0.0], [0.6, 0.3, 0.0], [0.9, 0.3, 0.0], [0.6, 0.6, 0.3], [0.6, 0.6, 0.0], [0.9, 0.6, 0.0], [0.9, 0.6, 0.3], [0.6, 0.9, 0.3], [0.9, 0.9, 0.0], [0.9, 0.9, 0.3], [0.6, 0.9, 0.0]]

0 commit comments

Comments
 (0)