diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bfdc3dd..60391f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - '1.9' os: - ubuntu-latest - - macOS-latest + # - macOS-latest - windows-latest arch: - x64 diff --git a/Project.toml b/Project.toml index 51b92e9..6b435f9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RadialPiecewisePolynomials" uuid = "7dab568b-3cf7-4f91-a977-b4631dfca174" authors = ["john.papad "] -version = "0.1.1" +version = "0.1.2" [deps] AnnuliOrthogonalPolynomials = "de1797fd-24c3-4035-91a2-b52aecdcfb01" @@ -21,11 +21,12 @@ MultivariateOrthogonalPolynomials = "4f6956fd-4f93-5457-9149-7bfc4b2ce06d" PiecewiseOrthogonalPolynomials = "4461d12d-4663-4550-8580-cb764c85e20f" QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c" SemiclassicalOrthogonalPolynomials = "291c01f3-23f6-4eb6-aeb0-063a639b53f2" +SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" [compat] -AnnuliOrthogonalPolynomials = "0.0.4" +AnnuliOrthogonalPolynomials = "0.0.5" BandedMatrices = "0.17, 1" BlockArrays = "0.16" BlockBandedMatrices = "0.12" diff --git a/src/RadialPiecewisePolynomials.jl b/src/RadialPiecewisePolynomials.jl index 477ac73..9a89806 100644 --- a/src/RadialPiecewisePolynomials.jl +++ b/src/RadialPiecewisePolynomials.jl @@ -2,7 +2,7 @@ module RadialPiecewisePolynomials using AnnuliOrthogonalPolynomials, BandedMatrices, BlockArrays, BlockBandedMatrices, ClassicalOrthogonalPolynomials, ContinuumArrays, DomainSets, FastTransforms, LinearAlgebra, MultivariateOrthogonalPolynomials, SemiclassicalOrthogonalPolynomials, - StaticArrays, QuasiArrays, FillArrays, LazyArrays, Memoization#, ArrayLayouts#, LazyBandedMatrices#, + StaticArrays, QuasiArrays, FillArrays, LazyArrays, Memoization, SparseArrays#, ArrayLayouts#, LazyBandedMatrices#, import BlockArrays: BlockSlice, block, blockindex, blockvec @@ -28,7 +28,8 @@ export SVector, Zeros, Ones, Vcat, Derivative, pad, paddeddata, Hcat, RadialCoor ZernikeBasis, ZernikeBasisMode, ZernikeBasisModeElement, BBBArrowheadMatrix, get_rs, get_θs, getNs, - mass_matrix, assembly_matrix, stiffness_matrix, gram_matrix, piecewise_constant_assembly_matrix + mass_matrix, assembly_matrix, stiffness_matrix, gram_matrix, piecewise_constant_assembly_matrix, + sparse get_rs(x) = x.r get_θs(x) = x.θ diff --git a/src/continuouszernike.jl b/src/continuouszernike.jl index ec30580..b092041 100644 --- a/src/continuouszernike.jl +++ b/src/continuouszernike.jl @@ -232,6 +232,12 @@ function zero_dirichlet_bcs!(Φ::ContinuousZernike{T}, Mf::AbstractVector{<:Pseu zero_dirichlet_bcs!.(Fs, Mf) end +function zero_dirichlet_bcs!(Φ::ContinuousZernike{T}, Mf::AbstractVector{<:AbstractVector}) where T + @assert length(Mf) == 2*Φ.N-1 + Fs = Φ.Fs #_getFs(Φ.N, Φ.points) + zero_dirichlet_bcs!.(Fs, Mf) +end + function zero_dirichlet_bcs!(points::AbstractVector{T}, A::Matrix) where T K = length(points)-1 if first(points) > 0 diff --git a/src/continuouszernikemode.jl b/src/continuouszernikemode.jl index 0d6fa55..80d8337 100644 --- a/src/continuouszernikemode.jl +++ b/src/continuouszernikemode.jl @@ -372,6 +372,19 @@ function zero_dirichlet_bcs!(F::ContinuousZernikeMode{T}, A::Matrix) where T end end +function zero_dirichlet_bcs!(F::ContinuousZernikeMode{T}, A::SparseMatrixCSC) where T + points = F.points + K = length(points)-1 + if first(points) > 0 + A[1,:] .= zero(T); A[:,1] .= zero(T) + A[K+1, :] .= zero(T); A[:, K+1] .= zero(T) + A[1,1] = one(T); A[K+1, K+1] = one(T) + else + A[K,:] .= zero(T); A[:,K] .= zero(T) + A[K,K] = one(T) + end +end + function zero_dirichlet_bcs!(F::ContinuousZernikeMode{T}, Mf::PseudoBlockVector) where T points = F.points K = length(points)-1 @@ -383,6 +396,17 @@ function zero_dirichlet_bcs!(F::ContinuousZernikeMode{T}, Mf::PseudoBlockVector) end end +function zero_dirichlet_bcs!(F::ContinuousZernikeMode{T}, Mf::AbstractVector) where T + points = F.points + K = length(points)-1 + if !(first(points) ≈ 0) + Mf[1] = zero(T) + Mf[K+1] = zero(T) + else + Mf[K] = zero(T) + end +end + ### # Plotting ### diff --git a/src/plotting/plots.jl b/src/plotting/plots.jl index 72c4eb2..02cfbe3 100644 --- a/src/plotting/plots.jl +++ b/src/plotting/plots.jl @@ -38,17 +38,17 @@ function _plot(K::Int, θs::AbstractVector, rs::AbstractVector, vals::AbstractVe display(gcf()) end -function plot(F::FiniteContinuousZernike{T}, θs::AbstractVector, rs::AbstractVector, vals::AbstractVector;ρ::T=0.0, ttl=[], vminmax=[],K=0) where T +function plot(F::ContinuousZernike{T}, θs::AbstractVector, rs::AbstractVector, vals::AbstractVector;ρ::T=0.0, ttl=[], vminmax=[],K=0) where T K = K ==0 ? lastindex(F.points)-1 : K _plot(K, θs, rs, vals, ρ=ρ, ttl=ttl, vminmax=vminmax) end -function plot(F::FiniteContinuousZernikeMode{T}, θs::AbstractVector, rs::AbstractVector, vals::AbstractVector;ρ::T=0.0, ttl=[], K=0) where T +function plot(F::ContinuousZernikeMode{T}, θs::AbstractVector, rs::AbstractVector, vals::AbstractVector;ρ::T=0.0, ttl=[], K=0) where T K = K ==0 ? lastindex(Z.points)-1 : K _plot(K, θs, rs, vals, ρ=ρ, ttl=ttl) end -function plot(Z::FiniteZernikeBasis{T}, θs::AbstractVector, rs::AbstractVector, vals::AbstractVector;ρ::T=0.0, ttl=[], K=0) where T +function plot(Z::ZernikeBasis{T}, θs::AbstractVector, rs::AbstractVector, vals::AbstractVector;ρ::T=0.0, ttl=[], K=0) where T K = K ==0 ? lastindex(Z.points)-1 : K _plot(K, θs, rs, vals, ρ=ρ, ttl=ttl) end