Skip to content

Commit b396234

Browse files
committed
Support plotting on disks
1 parent d1f1c63 commit b396234

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ InfiniteLinearAlgebra = "cde9dba0-b1de-11e9-2c62-0bab9446c55c"
1818
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
1919
LazyBandedMatrices = "d7e5e226-e90b-4449-9968-0f923699bf6f"
2020
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
21+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
2122
QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
2223
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2324
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

examples/diskhelmholtz.jl

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
1-
using MultivariateOrthogonalPolynomials, FastTransforms, BlockBandedMatrices, Plots
1+
using MultivariateOrthogonalPolynomials, FastTransforms, BlockBandedMatrices, WGLMakie
2+
import MultivariateOrthogonalPolynomials: ZernikeITransform, grid
3+
4+
Z = Zernike()[:,Block.(Base.OneTo(10))]
5+
G = grid(Z)
6+
7+
contourf(first.(G), last.(G), ones(size(G)...))
8+
9+
10+
scatter(vec(first.(G)), vec(last.(G)))
11+
G[1,1].θ
212

313
WZ = Weighted(Zernike(1))
414
xy = axes(WZ,1)
515
x,y = first.(xy),last.(xy)
6-
u = Zernike(1) \ @. exp(x*cos(y))
16+
f = Zernike(1) \ @. exp(x*cos(y))
717

818
N = 50
919
KR = Block.(Base.OneTo(N))
10-
Δ = BandedBlockBandedMatrix((Zernike(1) \ (Laplacian(xy) * WZ))[KR,KR],(0,0),(0,0))
20+
Δ = (Zernike(1) \ (Laplacian(xy) * WZ))[KR,KR]
1121
C = (Zernike(1) \ WZ)[KR,KR]
1222
k = 5
1323
L = Δ - k^2 * C
1424

15-
v = (L \ u[KR])
25+
v = f[KR]
26+
@time u = (L \ v);
27+
28+
g = MultivariateOrthogonalPolynomials.grid(Zernike(1)[:,KR])
29+
U = ZernikeITransform{Float64}(N, 0, 1) * u
30+
31+
plot(first.(g), last.(g), U)
32+
33+
34+
35+
F = factorize(Zernike(1)[:,KR]).plan
36+
F \ u
37+
u
38+
39+
40+
F*u
41+
1642

17-
F = factorize(Zernike(1)[:,KR])
1843
F.plan \ v
1944
F |> typeof |> fieldnames
2045

src/disk.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,24 @@ struct ZernikeTransform{T} <: Plan{T}
184184
analysis::FastTransforms.FTPlan{T,2,FastTransforms.DISKANALYSIS}
185185
end
186186

187+
struct ZernikeITransform{T} <: Plan{T}
188+
N::Int
189+
disk2cxf::FastTransforms.FTPlan{T,2,FastTransforms.DISK}
190+
synthesis::FastTransforms.FTPlan{T,2,FastTransforms.DISKSYNTHESIS}
191+
end
192+
187193
function ZernikeTransform{T}(N::Int, a::Number, b::Number) where T<:Real
188194
= N ÷ 2 + 1
189195
ZernikeTransform{T}(N, plan_disk2cxf(T, Ñ, a, b), plan_disk_analysis(T, Ñ, 4-3))
190196
end
197+
function ZernikeITransform{T}(N::Int, a::Number, b::Number) where T<:Real
198+
= N ÷ 2 + 1
199+
ZernikeITransform{T}(N, plan_disk2cxf(T, Ñ, a, b), plan_disk_synthesis(T, Ñ, 4-3))
200+
end
201+
202+
191203
*(P::ZernikeTransform{T}, f::Matrix{T}) where T = DiskTrav(P.disk2cxf \ (P.analysis * f))[Block.(1:P.N)]
192-
\(P::ZernikeTransform, f::AbstractVector) = P.analysis \ (P.disk2cxf * DiskTrav(f).matrix)
204+
*(P::ZernikeITransform, f::AbstractVector) = P.synthesis * (P.disk2cxf * DiskTrav(f).matrix)
193205

194206
factorize(S::FiniteZernike{T}) where T = TransformFactorization(grid(S), ZernikeTransform{T}(blocksize(S,2), parent(S).a, parent(S).b))
195207

0 commit comments

Comments
 (0)