Skip to content

Commit 3507aff

Browse files
committed
improve cartesian mesh constructors
1 parent 53c6236 commit 3507aff

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/Interpolation/tensorlaginterp.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function cheb1nodes(n::NTuple{N},lc,uc) where {N}
136136
iter = cheb1nodes_iter(n,lc,uc)
137137
return map(x->SVector{N,Float64}(x),iter)
138138
end
139-
function cheb1nodes(n::NTuple{N},rec::AbstractHyperRectangle{N}) where {N}
139+
function cheb1nodes(n::NTuple{N},rec::AbstractHyperRectangle{N}) where {N}
140140
cheb1nodes(n,low_corner(rec),high_corner(rec))
141141
end
142142
function cheb1nodes(n::Integer,a::Number,b::Number)
@@ -182,7 +182,7 @@ function cheb2nodes(n::NTuple{N},lc,uc) where {N}
182182
iter = cheb2nodes_iter(n,lc,uc)
183183
return map(x->SVector{N,Float64}(x),iter)
184184
end
185-
function cheb2nodes(n::NTuple{N},rec::AbstractHyperRectangle{N}) where {N}
185+
function cheb2nodes(n::NTuple{N},rec::AbstractHyperRectangle{N}) where {N}
186186
cheb2nodes(n,low_corner(rec),high_corner(rec))
187187
end
188188
function cheb2nodes(n::Integer,a::Number,b::Number)

src/Mesh/cartesianmesh.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ Base.keys(m::UniformCartesianMesh{N,T}) where {N,T} = (HyperRectangle{N,T},)
1919
Base.step(m::UniformCartesianMesh) = step.(grids(m))
2020

2121
"""
22-
UniformCartesianMesh(;domain::HyperRectangle,sz::NTuple)
22+
UniformCartesianMesh(domain::HyperRectangle,sz::NTuple)
23+
UniformCartesianMesh(domain::HyperRectangle;step::NTuple)
2324
24-
Construct a uniform `UniformCartesianMesh` with `sz[d]` elements along dimension `d`.
25+
Construct a uniform `UniformCartesianMesh` with `sz[d]` elements along dimension
26+
`d`. If the kwarg `step` is passed, construct a `UniformCartesianMesh` with
27+
elements of approximate size `step`.
2528
"""
2629
function UniformCartesianMesh(domain::HyperRectangle{N,T},sz::NTuple{N}) where {N,T}
2730
lc = low_corner(domain)
@@ -34,13 +37,11 @@ function UniformCartesianMesh(domain::HyperRectangle{N,T},sz::NTuple{N}) where {
3437
UniformCartesianMesh(grids1d)
3538
end
3639
UniformCartesianMesh(domain::HyperRectangle{N,T},sz::Int) where {N,T} = UniformCartesianMesh(domain,ntuple(i->sz,N))
37-
UniformCartesianMesh(;domain,sz) = UniformCartesianMesh(domain,sz)
3840

3941
# in case you pass arguments like UniformCartesianMesh(xgrid,ygrid), convert
4042
# them to a Tuple
4143
UniformCartesianMesh(grids::Vararg{LinRange{T}}) where {T} = UniformCartesianMesh(Tuple(grids))
4244

43-
4445
function UniformCartesianMesh(domain::HyperRectangle{N};step::NTuple{N}) where {N}
4546
lc = low_corner(domain)
4647
hc = high_corner(domain)

0 commit comments

Comments
 (0)