Skip to content

Commit f113010

Browse files
authored
Support plotting on rectangles (#169)
* Support plotting on rectangles * Update test_rect.jl
1 parent b404f83 commit f113010

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/rect.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ ApplyPlan(f, P) = ApplyPlan{eltype(P), typeof(f), typeof(P)}(f, P)
7878

7979
*(A::ApplyPlan, B::AbstractArray) = A.f(A.plan*B)
8080

81+
basis_axes(d::Inclusion{<:Any,<:ProductDomain}, v) = KronPolynomial(map(d -> basis(Inclusion(d)),components(d.domain))...)
8182

8283
struct TensorPlan{T, Plans}
8384
plans::Plans
@@ -107,6 +108,12 @@ function plan_grid_transform(P::KronPolynomial{d,<:Any,<:Fill}, B::Tuple{Block{1
107108
SVector.(x̃, x̃'), ApplyPlan(DiagTrav, F)
108109
end
109110

111+
function plotgrid(P::RectPolynomial, B::Block{1})
112+
x,y = plotgrid.(P.args, Int(B))
113+
SVector.(x, y')
114+
end
115+
116+
110117
function plan_grid_transform(P::KronPolynomial{d}, B::Tuple{Block{1}}, dims=1:1) where d
111118
@assert dims == 1 || dims == 1:1 || dims == (1,)
112119
@assert d == 2

test/test_rect.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using MultivariateOrthogonalPolynomials, ClassicalOrthogonalPolynomials, StaticArrays, LinearAlgebra, BlockArrays, FillArrays, Base64, Test
2-
import ClassicalOrthogonalPolynomials: expand
3-
import MultivariateOrthogonalPolynomials: weaklaplacian
2+
using ClassicalOrthogonalPolynomials: expand
3+
using MultivariateOrthogonalPolynomials: weaklaplacian
4+
using ContinuumArrays: plotgridvalues
45

56
@testset "RectPolynomial" begin
67
@testset "Evaluation" begin
@@ -111,4 +112,11 @@ import MultivariateOrthogonalPolynomials: weaklaplacian
111112
@test stringmime("text/plain", KronPolynomial(Legendre(), Chebyshev())) == "Legendre() ⊗ ChebyshevT()"
112113
@test stringmime("text/plain", KronPolynomial(Legendre(), Chebyshev(), Jacobi(1,1))) == "Legendre() ⊗ ChebyshevT() ⊗ Jacobi(1.0, 1.0)"
113114
end
115+
116+
@testset "Plot" begin
117+
P = RectPolynomial(Legendre(),Legendre())
118+
x,F = plotgridvalues(P[:,1])
119+
@test x == SVector.(ChebyshevGrid{2}(40), ChebyshevGrid{2}(40)')
120+
@test F == ones(40,40)
121+
end
114122
end

0 commit comments

Comments
 (0)