Mercurial > repos > public > sbplib_julia
diff src/Grids/equidistant_grid.jl @ 1557:9113f437431d feature/grids/curvilinear
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 13 Apr 2024 23:52:40 +0200 |
parents | 4df668d00d03 43aaf710463e |
children | b9c7bab94241 b02917bcd7d5 |
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl Tue Apr 09 15:26:49 2024 +0200 +++ b/src/Grids/equidistant_grid.jl Sat Apr 13 23:52:40 2024 +0200 @@ -88,7 +88,7 @@ """ - equidistant_grid(size::Dims, limit_lower, limit_upper) + equidistant_grid(limit_lower, limit_upper, dims...) Construct an equidistant grid with corners at the coordinates `limit_lower` and `limit_upper`. @@ -99,25 +99,24 @@ of the grid are not allowed to be negative. The number of equispaced points in each coordinate direction are given -by the tuple `size`. +by the tuple `dims`. -Note: If `limit_lower` and `limit_upper` are integers and `size` would allow a +Note: If `limit_lower` and `limit_upper` are integers and `dims` would allow a completely integer grid, `equidistant_grid` will still return a floating point grid. This simplifies the implementation and avoids certain surprise behaviors. """ -# TODO: Change signature to `equidistant_grid(limit_lower,limit_upper, size...) -function equidistant_grid(size::Dims, limit_lower, limit_upper) - gs = map(equidistant_grid, size, limit_lower, limit_upper) +function equidistant_grid(limit_lower, limit_upper, dims::Vararg{Int}) + gs = map(equidistant_grid, limit_lower, limit_upper, dims) return TensorGrid(gs...) end """ - equidistant_grid(size::Int, limit_lower::T, limit_upper::T) + equidistant_grid(limit_lower::T, limit_upper::T, size::Int) Constructs a 1D equidistant grid. """ -function equidistant_grid(size::Int, limit_lower::T, limit_upper::T) where T +function equidistant_grid(limit_lower::T, limit_upper::T, size::Int) where T if any(size .<= 0) throw(DomainError("size must be postive")) end