Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more BSplineSpace constructor #336

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/_BSplineSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ end
function BSplineSpace{p,T,K}(P::BSplineSpace{p}) where {p,T,K}
return BSplineSpace{p,T}(K(knotvector(P)))
end
function BSplineSpace{p,T,K}(k::AbstractKnotVector) where {p,T,K}
return BSplineSpace{p,T}(K(k))
end

# Broadcast like a scalar
Base.Broadcast.broadcastable(P::BSplineSpace) = Ref(P)
Expand Down
5 changes: 3 additions & 2 deletions test/test_BSplineSpace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
P4 = BSplineSpace{2,Real}(P1)
P5 = BSplineSpace{2,Float64}(P1)
P6 = BSplineSpace{2,Float64}(KnotVector(1:8))
P7 = BSplineSpace{2,Float64,KnotVector{Float64}}(KnotVector(1:8))
@test P1 == P2 == P3 == P4 == P5 == bsplinespace(P1) == bsplinespace(P2) == bsplinespace(P3) == bsplinespace(P4) == bsplinespace(P5)
@test P5 == P6
@test typeof(P5) === typeof(P6)
@test P5 == P6 == P7
@test typeof(P5) === typeof(P6) === typeof(P7)
@test P1 isa BSplineSpace{2,Int}
@test P2 isa BSplineSpace{2,Int}
@test P3 isa BSplineSpace{2,Int}
Expand Down
Loading