Skip to content

Commit

Permalink
Fufp fix (#48)
Browse files Browse the repository at this point in the history
* Correct search for unique face pairs

* Revert test for Apple system

* Update LibGEOS version

* Update Progress call

* Require v1.9 of ProgressMeter

* Update Julia version to 1.10

* Update sinuous test for Julia 1.10

* Avoid sinuous differences
  • Loading branch information
simonp0420 authored Jan 6, 2024
1 parent fbca4ff commit 424568e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.9'
- '1.10'
os:
- ubuntu-latest
- macOS-latest
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ FFTW = "1.4"
FileIO = "1.8"
GeoInterface = "1.0.1"
JLD2 = "0.4.11"
LibGEOS = "0.7.2"
LibGEOS = "0.8.6"
LoggingExtras = "1.0"
LoopVectorization = "0.12"
MetalSurfaceImpedance = "1.0"
Expand All @@ -45,7 +45,7 @@ OffsetArrays = "1.8"
PkgVersion = "0.3"
PolygonOps = "0.1"
PrecompileTools = "1.0"
ProgressMeter = "1.6"
ProgressMeter = "1.9"
RecipesBase = "1.1"
Reexport = "^1.0.0"
StaticArrays = "1.1"
Expand Down
2 changes: 1 addition & 1 deletion src/PSSFSS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function _analyze(layers, sheets, junc, freqs, stkeys, stvalues;
showprogress && println("Beginning PSSFSS Analysis")
ncount = 0 # Number of analyses performed
ntotal = length(freqs) * length(stvalues[1]) * length(stvalues[2])
showprogress && (progress = Progress(ntotal, 1))
showprogress && (progress = Progress(ntotal; dt = 1))
showprogress && update!(progress, 0)
isfile(resultfile) && rm(resultfile)
date, clock = split(string(now()), 'T')
Expand Down
16 changes: 9 additions & 7 deletions src/RWG.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,9 @@ function setup_rwg(sheet::RWGSheet, leafsize::Int=9)::RWGData
# classes). Each element of ufp2fp contains a pointer to an allocated
# array of face/pair indices. Row i contains a list of the face/pairs
# that are members of equivalence class i. Two face pairs belong to
# the same equivalence class if the source triangles can be overlaid
# using a rigid translation, the source triangle nodes are listed
# in the same order, and if the observation point (centroid
# of the match triangle) is in the same relative position wrt the
# source triangle. This version uses the NearestNeighbors package:
# the same equivalence class if the triangle pairs can be overlaid
# using a rigid translation, and the triangle nodes are listed
# in the same order. This version uses the NearestNeighbors package.

# Allocate the unique face pairs matrix and some scratch arrays.
ufpm = zeros(Int, (nface, nface))
Expand All @@ -290,7 +288,7 @@ function setup_rwg(sheet::RWGSheet, leafsize::Int=9)::RWGData
r2 = @view sheet.ρ[sheet.fv[2, :]]
r3 = @view sheet.ρ[sheet.fv[3, :]]
centroid = [(r1[n] + r2[n] + r3[n]) / 3 for n in eachindex(r1)]
data = Array{SVector{6,Float64}}(undef, nface^2)
data = Array{SVector{12,Float64}}(undef, nface^2)
# Characterize each face pair:
mn = 0
for n in 1:nface, m in 1:nface
Expand All @@ -299,7 +297,11 @@ function setup_rwg(sheet::RWGSheet, leafsize::Int=9)::RWGData
rmn1 = centroid[m] - r1[n]
rmn2 = centroid[m] - r2[n]
rmn3 = centroid[m] - r3[n]
data[mn] = SVector{6,Float64}(rmn1[1], rmn1[2], rmn2[1], rmn2[2], rmn3[1], rmn3[2])
rnm1 = centroid[n] - r1[m]
rnm2 = centroid[n] - r2[m]
rnm3 = centroid[n] - r3[m]
data[mn] = SVector{12,Float64}(rmn1[1], rmn1[2], rmn2[1], rmn2[2], rmn3[1], rmn3[2],
rnm1[1], rnm1[2], rnm2[1], rnm2[2], rnm3[1], rnm3[2])
end

kdtree = KDTree(data, leafsize=leafsize)
Expand Down
3 changes: 1 addition & 2 deletions test/Elements_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,5 @@ end
sides = 50; ntri = 2800; units = cm
sheet = sinuous(; arms=4, b, w=0.03, rc=0.05, s1, s2,
L2=0.95, w2=0.03, c2=0.12, g=0.04, sides, ntri, units)
mycount = Sys.isapple() ? 3328 : 3393
@test facecount(sheet) == mycount
@test facecount(sheet) > 3300 # Different on Apple, and depends on Julia version
end

0 comments on commit 424568e

Please sign in to comment.