From 424568ef17fd5a0a3e9197893994fb0d8b13525d Mon Sep 17 00:00:00 2001 From: Peter Simon Date: Fri, 5 Jan 2024 16:17:22 -0800 Subject: [PATCH] Fufp fix (#48) * 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 --- .github/workflows/CI.yml | 2 +- Project.toml | 4 ++-- src/PSSFSS.jl | 2 +- src/RWG.jl | 16 +++++++++------- test/Elements_test.jl | 3 +-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6635ccbc..c168a5f6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: version: - - '1.9' + - '1.10' os: - ubuntu-latest - macOS-latest diff --git a/Project.toml b/Project.toml index 4a169cd5..d6c44cdb 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -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" diff --git a/src/PSSFSS.jl b/src/PSSFSS.jl index 6e8c8a48..cca40d0e 100644 --- a/src/PSSFSS.jl +++ b/src/PSSFSS.jl @@ -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') diff --git a/src/RWG.jl b/src/RWG.jl index 1cd42335..9731c20b 100644 --- a/src/RWG.jl +++ b/src/RWG.jl @@ -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)) @@ -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 @@ -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) diff --git a/test/Elements_test.jl b/test/Elements_test.jl index 01f472f1..a1d3ce08 100644 --- a/test/Elements_test.jl +++ b/test/Elements_test.jl @@ -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