Skip to content

Commit bbe0af6

Browse files
Minor fix to demos such as missing package calls
1 parent f0005a6 commit bbe0af6

8 files changed

Lines changed: 38 additions & 46 deletions

examples/demo_boundaryfaces.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,11 @@ for testCase = 1:3
5151
Cbs = simplex2vertexdata(Fbs,Cb)
5252

5353
ax1 = Axis3(fig[1, 1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Input faces")
54-
hp1 = poly!(ax1,GeometryBasics.Mesh(Vs,Fs), strokewidth=1,shading=FastShading,strokecolor=:black, color=:white, transparency=true, overdraw=false)
54+
hp1 = meshplot!(ax1, Fs, Vs, transparency=true)
5555

5656
ax2 = Axis3(fig[1, 2], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "Boundary faces")
57-
hp1 = poly!(ax2,GeometryBasics.Mesh(Vbs,Fbs), strokewidth=1,shading=FastShading,strokecolor=:black, color=Cbs, transparency=true, overdraw=false)
57+
hp2 = meshplot!(ax2, Fbs, Vbs, color=Cbs, transparency=true, overdraw=false)
5858

5959
screen = display(GLMakie.Screen(), fig)
6060
GLMakie.set_title!(screen, "testCase = $testCase")
61-
6261
end

examples/demo_hermiteSegment.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Comodo
22
using Comodo.GLMakie
33
using Comodo.GeometryBasics
4+
using Comodo.LinearAlgebra
45

56
#=
67
This demo shows the use of hermiteSegment to set up a Hermite spline using a set

examples/demo_hexahedronElement.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ fig = Figure(size=(1700, 1000))
2020
ax1 = AxisGeom(fig[1,1], aspect = :data, xlabel = "X", ylabel = "Y", zlabel = "Z", title = "A hexahedral element")
2121
hp1 = meshplot!(ax1, Fs, Vs, color=(:white, 0.25), strokewidth=3, strokecolor=:blue, transparency=true)
2222
screen = display(GLMakie.Screen(), fig)
23-
GLMakie.set_title!(screen, "testCase = $testCase")
23+
fig

examples/demo_load_view_obj.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for testCase = 1:3
3535
fig = Figure(size=(800,800))
3636
ax1 = AxisGeom(fig[1, 1], title = "Spot the cow")
3737

38-
hp1 = poly!(ax1,M, color=T, shading = FastShading, transparency=false,strokecolor=:black,strokewidth=1,stroke_depth_shift=-0.001f0)
38+
hp1 = poly!(ax1, M, color=T, shading = true, strokecolor=:black, strokewidth=1, stroke_depth_shift=-0.001f0)
3939

4040
screen = display(GLMakie.Screen(), fig)
4141
GLMakie.set_title!(screen, "testCase = $testCase")

examples/demo_mergevertices.jl

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,21 @@ GLMakie.closeall()
2929
fig = Figure(size=(1200,800))
3030

3131
stepRange = 0:1:50
32-
hSlider = Slider(fig[2, :], range = stepRange, startvalue = 0,linewidth=30)
32+
ax1 = AxisGeom(fig[1, 1], title = "V = V + N*0")
33+
hp1 = meshplot!(ax1, F1, V1)
3334

34-
titleString = lift(hSlider.value) do stepIndex
35-
"V = V + N*" * string(stepIndex)
36-
end
35+
ax2 = AxisGeom(fig[1, 2], title = "V = V + N*0")
36+
hp2 = meshplot!(ax2, F2, V2)
3737

38-
M1 = lift(hSlider.value) do stepIndex
39-
V1n = [V1[i].+ stepIndex.*NV1[i] for i eachindex(V1)]
40-
return GeometryBasics.Mesh(V1n,F1)
41-
end
38+
hSlider = Slider(fig[2, :], range = stepRange, startvalue = 0,linewidth=30)
4239

43-
M2 = lift(hSlider.value) do stepIndex
40+
on(hSlider.value) do stepIndex
41+
ax1.title ="V = V + N*" * string(stepIndex)
42+
ax2.title ="V = V + N*" * string(stepIndex)
43+
V1n = [V1[i].+ stepIndex.*NV1[i] for i eachindex(V1)]
4444
V2n = [V2[i].+ stepIndex.*NV2[i] for i eachindex(V2)]
45-
return GeometryBasics.Mesh(V2n,F2)
45+
hp1[1] = GeometryBasics.Mesh(V1n, F1)
46+
hp2[1] = GeometryBasics.Mesh(V2n, F2)
4647
end
4748

48-
ax1 = AxisGeom(fig[1, 1], title = titleString)
49-
poly!(ax1,M1,strokewidth=2,color=:white, shading = FastShading)
50-
51-
ax2 = AxisGeom(fig[1, 2], title = titleString)
52-
poly!(ax2,M2,strokewidth=2,color=:white, shading = FastShading)
53-
54-
fig[2, :]=hSlider
55-
5649
fig

examples/demo_surfacevol.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@ using FileIO
66
for testCase = 1:5
77
if testCase == 1 # Triangulated sphere
88
r = 1
9-
F,V = geosphere(3,r)
9+
nSub = 5
10+
F, V = geosphere(nSub, r)
1011
println("Theoretical volume: " * string(4/3*pi*r^3))
1112
elseif testCase == 2 # quad sphere
1213
r = 1.0
13-
F,V = quadsphere(5,r)
14+
pointSpacing = r/20.0
15+
F, V = quadsphere(r, pointSpacing)
1416
println("Theoretical volume: " * string(4/3*pi*r^3))
1517
elseif testCase == 3 # quad cube
1618
r = 2*sqrt(3)/2
17-
F,V = cube(r)
19+
F, V = cube(r)
1820
println("Theoretical volume: " * string((2*(r./(sqrt(3))))^3))
1921
elseif testCase == 4 # triangulated cube
2022
r = 2*sqrt(3)/2
21-
F,V = cube(r)
22-
F = quad2tri(F,V; convert_method = :angle)
23+
F, V = cube(r)
24+
F = quad2tri(F, V; convert_method = :angle)
2325
println("Theoretical volume: " * string((2*(r./(sqrt(3))))^3))
2426
elseif testCase == 5 # Merged STL for single object
2527
# Loading a mesh
@@ -29,7 +31,7 @@ for testCase = 1:5
2931
# Obtain mesh faces and vertices
3032
F = tofaces(faces(M))
3133
V = topoints(coordinates(M))
32-
F,V,_ = mergevertices(F,V)
34+
F, V, _ = mergevertices(F,V)
3335
end
3436

3537
vol = surfacevolume(F,V)

examples/example_checker.jl

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module ExampleChecker
2-
3-
const NUMTASKS = 10
2+
using Comodo
43

54
function load_and_run!(filename::String, problems::Vector{String})::Bool
65
#cmdline = "using Pkg; Pkg.activate(\"./..\"); include(\"$filename\")"
@@ -19,21 +18,19 @@ function load_and_run!(filename::String, problems::Vector{String})::Bool
1918
end
2019
end
2120

22-
function main()
23-
dircontent = readdir(".")
21+
function main()
22+
example_dir = joinpath(comododir(),"examples")
23+
dircontent = readdir(example_dir)
2424
juliafiles = filter(x -> occursin(r"demo.*\.jl", x), dircontent)
25-
26-
problems = Vector{String}(undef, 0)
27-
tasks = Task[]
28-
for file in juliafiles
29-
if length(tasks) >= NUMTASKS
30-
wait.(tasks)
31-
empty!(tasks)
32-
end
25+
26+
problems = Vector{String}(undef, 0)
27+
for file in juliafiles
3328
println("Checking file: $file")
34-
t = Task(() -> load_and_run!(file, problems))
35-
push!(tasks, t)
36-
schedule(t)
29+
t = Task(() -> load_and_run!(joinpath(example_dir, file), problems))
30+
schedule(t)
31+
while !istaskdone(t) # Wait for task completion
32+
sleep(1)
33+
end
3734
end
3835

3936
if !isempty(problems)

src/functions.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ function subquadsphere(n::Int,r::T) where T <: Real
25322532
end
25332533

25342534
"""
2535-
quadsphere(r,pointSpacing)
2535+
quadsphere(r, pointSpacing)
25362536
25372537
Returns a quadrangulated sphere
25382538
@@ -2543,7 +2543,7 @@ approximate point spacing (which is most accurate for regions away from the
25432543
original cube corners. The ouput consists of the faces `F`, the vertices `V`,
25442544
and the underlying cube face boundary labels `C`.
25452545
"""
2546-
function quadsphere(r,pointSpacing)
2546+
function quadsphere(r, pointSpacing)
25472547
boxDim = fill(2.0,3)#fill(r/2.0,3) # Dimensions for the box in each direction
25482548
boxEl = fill(ceil.(Int,(r*π/2.0)./pointSpacing),3) # Number of elements to use in each direction
25492549
F,V,C = quadbox(boxDim,boxEl)

0 commit comments

Comments
 (0)