Skip to content

Commit 1d14613

Browse files
committed
DomainSets 0.0.2 support
1 parent 684c0a6 commit 1d14613

File tree

11 files changed

+27
-25
lines changed

11 files changed

+27
-25
lines changed

src/ApproxFunBase.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import StaticArrays, Calculus
88

99
import DomainSets: Domain, indomain, UnionDomain, ProductDomain, FullSpace, Point, elements, DifferenceDomain,
1010
Interval, ChebyshevInterval, boundary, ∂, rightendpoint, leftendpoint,
11-
dimension, Domain1d, Domain2d
11+
dimension
12+
13+
1214

1315
import AbstractFFTs: Plan, fft, ifft
1416
import FFTW: plan_r2r!, fftwNumber, REDFT10, REDFT01, REDFT00, RODFT00, R2HC, HC2R,

src/Multivariate/LowRankFun.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ end
4848

4949
## Construction in a TensorSpace via a Vector of Funs
5050

51-
function LowRankFun(X::Vector{VFun{S,T}},d::TensorSpace{SV,DD}) where {S,T,DD<:Domain2d,SV}
51+
function LowRankFun(X::Vector{VFun{S,T}},d::TensorSpace{SV,DD}) where {S,T,DD<:EuclideanDomain{2},SV}
5252
@assert d[1] == space(X[1])
5353
LowRankFun(X,d[2])
5454
end
@@ -190,7 +190,7 @@ end
190190

191191
## Construction via TensorSpaces and ProductDomains
192192

193-
LowRankFun(f::Function,S::TensorSpace{SV,DD,RR};kwds...) where {SV,DD<:Domain2d,RR} =
193+
LowRankFun(f::Function,S::TensorSpace{SV,DD,RR};kwds...) where {SV,DD<:EuclideanDomain{2},RR} =
194194
LowRankFun(dynamic(f),factor(S,1),factor(S,2);kwds...)
195195
LowRankFun(f::Function,dx::Domain,dy::Domain;kwds...) =
196196
LowRankFun(dynamic(f),Space(dx),Space(dy);kwds...)

src/Multivariate/ProductFun.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ ProductFun(f::Function,dx::Space,dy::Space)=ProductFun(dynamic(f),TensorSpace(dx
7474

7575
ProductFun(f::Function,D::Domain,M::Integer,N::Integer) = ProductFun(dynamic(f),Space(D),M,N)
7676
ProductFun(f::Function,d::Domain) = ProductFun(dynamic(f),Space(d))
77-
ProductFun(f::Function,dx::Domain1d,dy::Domain1d) = ProductFun(dynamic(f),Space(dx),Space(dy))
77+
ProductFun(f::Function, dx::EuclideanDomain{1}, dy::EuclideanDomain{1}) = ProductFun(dynamic(f),Space(dx),Space(dy))
7878
ProductFun(f::Function) = ProductFun(dynamic(f),ChebyshevInterval(),ChebyshevInterval())
7979

8080
## Conversion from other 2D Funs

src/Multivariate/TensorSpace.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ end
392392

393393
## points
394394

395-
points(d::Union{Domain2d,BivariateSpace},n,m) = points(d,n,m,1),points(d,n,m,2)
395+
points(d::Union{EuclideanDomain{2},BivariateSpace},n,m) = points(d,n,m,1),points(d,n,m,2)
396396

397397
function points(d::BivariateSpace,n,m,k)
398398
ptsx=points(columnspace(d,1),n)
@@ -510,16 +510,16 @@ union_rule(a::TensorSpace,b::TensorSpace) = TensorSpace(map(union,a.spaces,b.spa
510510
# (domain(ts)[2] == Point(0.0) && isconvertible(sp,ts.spaces[1])))
511511
# end
512512

513-
isconvertible(sp::UnivariateSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:Domain2d,R} = length(ts.spaces) == 2 &&
513+
isconvertible(sp::UnivariateSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:EuclideanDomain{2},R} = length(ts.spaces) == 2 &&
514514
((domain(ts)[1] == Point(0.0) && isconvertible(sp,ts.spaces[2])) ||
515515
(domain(ts)[2] == Point(0.0) && isconvertible(sp,ts.spaces[1])))
516516

517517

518-
# coefficients(f::AbstractVector,sp::ConstantSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:Domain2d,R} =
518+
# coefficients(f::AbstractVector,sp::ConstantSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:EuclideanDomain{2},R} =
519519
# f[1]*ones(ts).coefficients
520520

521521
#
522-
# function coefficients(f::AbstractVector,sp::Space{IntervalOrSegment{Vec{2,TT}}},ts::TensorSpace{Tuple{S,V},D,R}) where {S,V<:ConstantSpace,D<:Domain2d,R,TT} where {T<:Number}
522+
# function coefficients(f::AbstractVector,sp::Space{IntervalOrSegment{Vec{2,TT}}},ts::TensorSpace{Tuple{S,V},D,R}) where {S,V<:ConstantSpace,D<:EuclideanDomain{2},R,TT} where {T<:Number}
523523
# a = domain(sp)
524524
# b = domain(ts)
525525
# # make sure we are the same domain. This will be replaced by isisomorphic
@@ -530,7 +530,7 @@ isconvertible(sp::UnivariateSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:Domain2d
530530
# end
531531

532532

533-
function coefficients(f::AbstractVector,sp::UnivariateSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:Domain2d,R}
533+
function coefficients(f::AbstractVector,sp::UnivariateSpace,ts::TensorSpace{SV,D,R}) where {SV,D<:EuclideanDomain{2},R}
534534
@assert length(ts.spaces) == 2
535535

536536
if factor(domain(ts),1) == Point(0.0)
@@ -543,7 +543,7 @@ function coefficients(f::AbstractVector,sp::UnivariateSpace,ts::TensorSpace{SV,D
543543
end
544544

545545

546-
function isconvertible(sp::Space{Segment{Vec{2,TT}}},ts::TensorSpace{SV,D,R}) where {TT,SV,D<:Domain2d,R}
546+
function isconvertible(sp::Space{Segment{Vec{2,TT}}},ts::TensorSpace{SV,D,R}) where {TT,SV,D<:EuclideanDomain{2},R}
547547
d1 = domain(sp)
548548
d2 = domain(ts)
549549
if length(ts.spaces) 2
@@ -562,7 +562,7 @@ end
562562

563563

564564
function coefficients(f::AbstractVector,sp::Space{Segment{Vec{2,TT}}},
565-
ts::TensorSpace{SV,D,R}) where {TT,SV,D<:Domain2d,R}
565+
ts::TensorSpace{SV,D,R}) where {TT,SV,D<:EuclideanDomain{2},R}
566566
@assert length(ts.spaces) == 2
567567
d1 = domain(sp)
568568
d2 = domain(ts)

src/PDE/KroneckerOperator.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Base.transpose(S::ConstantTimesOperator) = sp.c*transpose(S.op)
254254
### Calculus
255255

256256
#TODO: general dimension
257-
function Derivative(S::TensorSpace{SV,DD},order::Vector{Int}) where {SV,DD<:Domain2d}
257+
function Derivative(S::TensorSpace{SV,DD},order::Vector{Int}) where {SV,DD<:EuclideanDomain{2}}
258258
@assert length(order)==2
259259
if order[1]==0
260260
Dy=Derivative(S.spaces[2],order[2])

src/PDE/PDE.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function Laplacian(d::BivariateSpace,k::Integer)
2121
end
2222
end
2323

24-
Laplacian(d::Domain2d, k::Integer) = Laplacian(Space(d),k)
24+
Laplacian(d::EuclideanDomain{2}, k::Integer) = Laplacian(Space(d),k)
2525
grad(d::ProductDomain) = [Derivative(d,[1,0]),Derivative(d,[0,1])]
2626

2727

src/Space.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ abstract type Space{D,R} end
1818

1919
const RealSpace = Space{D,R} where {D,R<:Real}
2020
const ComplexSpace = Space{D,R} where {D,R<:Complex}
21-
const UnivariateSpace = Space{D,R} where {D<:Domain1d,R}
22-
const BivariateSpace = Space{D,R} where {D<:Domain2d,R}
23-
const RealUnivariateSpace = RealSpace{D,R} where {D<:Domain1d,R<:Real}
21+
const UnivariateSpace = Space{D,R} where {D<:EuclideanDomain{1},R}
22+
const BivariateSpace = Space{D,R} where {D<:EuclideanDomain{2},R}
23+
const RealUnivariateSpace = RealSpace{D,R} where {D<:EuclideanDomain{1},R<:Real}
2424

2525

2626

src/Spaces/ArraySpace.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ pieces(f::Fun{<:ArraySpace}) = [piece(f,k) for k=1:npieces(f)]
258258

259259
fromcanonical(d::ProductDomain, f::Fun{<:ArraySpace}) = vcat(fromcanonical.(factors(d), vec(f))...)
260260

261-
function coefficients(f::AbstractVector,sp::ArraySpace{<:ConstantSpace{AnyDomain}},ts::TensorSpace{SV,D,R}) where {SV,D<:Domain2d,R}
261+
function coefficients(f::AbstractVector,sp::ArraySpace{<:ConstantSpace{AnyDomain}},ts::TensorSpace{SV,D,R}) where {SV,D<:EuclideanDomain{2},R}
262262
@assert length(ts.spaces) == 2
263263

264264
if ts.spaces[1] isa ArraySpace
@@ -278,14 +278,14 @@ ArraySpace(sp::TensorSpace{Tuple{S1,S2}}) where {S1<:Space{D,R},S2} where {D,R<:
278278
ArraySpace(sp::TensorSpace{Tuple{S1,S2}},k...) where {S1,S2<:Space{D,R}} where {D,R<:AbstractArray} =
279279
ArraySpace(map(a -> sp.spaces[1] a, sp.spaces[2]))
280280

281-
function coefficients(f::AbstractVector, a::VectorSpace, b::TensorSpace{Tuple{S1,S2},<:Domain2d}) where {S1<:Space{D,R},S2} where {D,R<:AbstractArray}
281+
function coefficients(f::AbstractVector, a::VectorSpace, b::TensorSpace{Tuple{S1,S2},<:EuclideanDomain{2}}) where {S1<:Space{D,R},S2} where {D,R<:AbstractArray}
282282
if size(a)  size(b)
283283
throw(DimensionMismatch("dimensions must match"))
284284
end
285285
interlace(map(coefficients,Fun(a,f),b),ArraySpace(b))
286286
end
287287

288-
function coefficients(f::AbstractVector, a::VectorSpace, b::TensorSpace{Tuple{S1,S2},<:Domain2d}) where {S1,S2<:Space{D,R}} where {D,R<:AbstractArray}
288+
function coefficients(f::AbstractVector, a::VectorSpace, b::TensorSpace{Tuple{S1,S2},<:EuclideanDomain{2}}) where {S1,S2<:Space{D,R}} where {D,R<:AbstractArray}
289289
if size(a)  size(b)
290290
throw(DimensionMismatch("dimensions must match"))
291291
end

src/Spaces/ConstantSpace.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ union_rule(A::ConstantSpace,B::Space) = ConstantSpace(domain(B))⊕B
114114
## Special Multiplication and Conversion for constantspace
115115

116116
# TODO: this is a special work around but really we want it to be blocks
117-
Conversion(a::ConstantSpace,b::Space{D}) where {D<:Domain2d} = ConcreteConversion{typeof(a),typeof(b),
117+
Conversion(a::ConstantSpace,b::Space{D}) where {D<:EuclideanDomain{2}} = ConcreteConversion{typeof(a),typeof(b),
118118
promote_type(real(prectype(a)),real(prectype(b)))}(a,b)
119119

120120
Conversion(a::ConstantSpace,b::Space) = ConcreteConversion(a,b)
@@ -130,10 +130,10 @@ end
130130

131131

132132
coefficients(f::AbstractVector,sp::ConstantSpace{Segment{Vec{2,TT}}},
133-
ts::TensorSpace{SV,DD}) where {TT,SV,DD<:Domain2d} =
133+
ts::TensorSpace{SV,DD}) where {TT,SV,DD<:EuclideanDomain{2}} =
134134
f[1]*ones(ts).coefficients
135135
coefficients(f::AbstractVector,sp::ConstantSpace{<:Domain{<:Number}},
136-
ts::TensorSpace{SV,DD}) where {TT,SV,DD<:Domain2d} =
136+
ts::TensorSpace{SV,DD}) where {TT,SV,DD<:EuclideanDomain{2}} =
137137
f[1]*ones(ts).coefficients
138138
coefficients(f::AbstractVector, sp::ConstantSpace{<:Domain{<:Number}}, ts::Space) =
139139
f[1]*ones(ts).coefficients

src/Spaces/SubSpace.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ points(sp::SubSpace, n) = points(sp.space, n)
211211
points(sp::SubSpace) = points(sp, dimension(sp))
212212

213213

214-
coefficients(v::AbstractVector,::SubSpace{DS,IT,Segment{Vec{2,TT}}},::TensorSpace{SV,DD}) where {DS,IT,TT,SV,DD<:Domain2d} =
214+
coefficients(v::AbstractVector,::SubSpace{DS,IT,Segment{Vec{2,TT}}},::TensorSpace{SV,DD}) where {DS,IT,TT,SV,DD<:EuclideanDomain{2}} =
215215
error("Not callable, only defined for ambiguity errors.")
216-
coefficients(v::AbstractVector,::SubSpace{DS,IT,D},::TensorSpace{SV,DD}) where {DS,IT,D,SV,DD<:Domain2d} =
216+
coefficients(v::AbstractVector,::SubSpace{DS,IT,D},::TensorSpace{SV,DD}) where {DS,IT,D,SV,DD<:EuclideanDomain{2}} =
217217
error("Not callable, only defined for ambiguity errors.")
218218

219219
for TYP in (:SumSpace,:PiecewiseSpace,:TensorSpace,:ConstantSpace,:Space) # Resolve conflict

src/specialfunctions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ for OP in (:abs,:sign,:log,:angle)
379379
@eval begin
380380
$OP(f::Fun{<:PiecewiseSpace{<:Any,<:Any,<:Real},<:Real}) =
381381
Fun(map($OP,components(f)),PiecewiseSpace)
382-
$OP(f::Fun{<:PiecewiseSpace{<:Any,<:Domain1d}}) =
382+
$OP(f::Fun{<:PiecewiseSpace{<:Any,<:EuclideanDomain{1}}}) =
383383
Fun(map($OP,components(f)),PiecewiseSpace)
384384
end
385385
end

0 commit comments

Comments
 (0)