Skip to content

Commit f894fc4

Browse files
committed
disk plotting works
1 parent b396234 commit f894fc4

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

examples/diskhelmholtz.jl

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
1-
using MultivariateOrthogonalPolynomials, FastTransforms, BlockBandedMatrices, WGLMakie
2-
import MultivariateOrthogonalPolynomials: ZernikeITransform, grid
1+
using MultivariateOrthogonalPolynomials, FastTransforms, BlockBandedMatrices, Plots
2+
plotly()
3+
import MultivariateOrthogonalPolynomials: ZernikeITransform, grid, plotgrid
4+
35

46
Z = Zernike()[:,Block.(Base.OneTo(10))]
7+
g = grid(Z)
8+
θ = getproperty.(g[1,:],)
9+
[permutedims(RadialCoordinate.(1,θ)); g; permutedims(RadialCoordinate.(0,θ))]
10+
import Mul
11+
12+
plotgrid(Z)
13+
14+
15+
Z = Zernike()
16+
xy = axes(Z,1)
17+
x,y = first.(xy),last.(xy)
18+
u = Z * (Z \ @.(cos(10x*y)))
19+
surface(u)
20+
21+
@.(cos(10x*y))
22+
23+
plot(u)
24+
25+
g = plotgrid(Z[:,Block.(Base.OneTo(10))])
26+
surface(first.(g), last.(g), u[g])
27+
plot(u)
28+
29+
530
G = grid(Z)
631

732
contourf(first.(G), last.(G), ones(size(G)...))

src/MultivariateOrthogonalPolynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Base: axes, in, ==, *, ^, \, copy, OneTo, getindex, size
88
import DomainSets: boundary
99

1010
import QuasiArrays: LazyQuasiMatrix, LazyQuasiArrayStyle
11-
import ContinuumArrays: @simplify, Weight, grid, TransformFactorization, Expansion
11+
import ContinuumArrays: @simplify, Weight, grid, plotgrid, TransformFactorization, Expansion
1212

1313
import ArrayLayouts: MemoryLayout
1414
import BlockArrays: block, blockindex, BlockSlice, viewblock

src/disk.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,21 @@ function grid(S::FiniteZernike{T}) where T
178178
RadialCoordinate.(r, π*θ')
179179
end
180180

181+
_angle(rθ::RadialCoordinate) =.θ
182+
183+
function plotgrid(S::FiniteZernike{T}) where T
184+
N = blocksize(S,2) ÷ 2 + 1 # polynomial degree
185+
g = grid(parent(S)[:,Block.(OneTo(2N))]) # double sampling
186+
θ = [map(_angle,g[1,:]); 0]
187+
[permutedims(RadialCoordinate.(1,θ)); g g[:,1]; permutedims(RadialCoordinate.(0,θ))]
188+
end
189+
190+
function plotgrid(S::SubQuasiArray{<:Any,2,<:Zernike})
191+
kr,jr = parentindices(S)
192+
Z = parent(S)
193+
plotgrid(Z[kr,Block.(OneTo(Int(findblock(axes(Z,2),maximum(jr)))))])
194+
end
195+
181196
struct ZernikeTransform{T} <: Plan{T}
182197
N::Int
183198
disk2cxf::FastTransforms.FTPlan{T,2,FastTransforms.DISK}

0 commit comments

Comments
 (0)