Skip to content

Commit

Permalink
Merge pull request #23 from ioannisPApapadopoulos/jp/compat
Browse files Browse the repository at this point in the history
update annuli compat + add sparsearray interface
  • Loading branch information
ioannisPApapadopoulos authored Jun 22, 2024
2 parents c54b097 + 7bfdfa8 commit b1b144c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- '1.9'
os:
- ubuntu-latest
- macOS-latest
# - macOS-latest
- windows-latest
arch:
- x64
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions src/RadialPiecewisePolynomials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.θ
Expand Down
6 changes: 6 additions & 0 deletions src/continuouszernike.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions src/continuouszernikemode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
###
Expand Down
6 changes: 3 additions & 3 deletions src/plotting/plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

2 comments on commit b1b144c

@ioannisPApapadopoulos
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/109565

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" b1b144c99afe85d5085ad201cbac4d92d3acbdf1
git push origin v0.1.2

Please sign in to comment.