Skip to content

Commit e9b4abc

Browse files
committed
implement range for equispaced grids
1 parent 3f67bb1 commit e9b4abc

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "GridArrays"
22
uuid = "356ae075-8bc9-5ef9-a342-46c9ba26438c"
3-
version = "0.1.15"
3+
version = "0.1.16"
44

55
[deps]
66
CompositeTypes = "b152e2b5-7a66-4b01-a709-34e65c35f657"

src/GridArrays.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ using DomainSets: endpoints
1414

1515
## List of imports
1616

17-
import Base: size, length, @propagate_inbounds, step, ndims,
18-
checkbounds, IndexStyle, ==, , getindex, eachindex,
19-
convert, in, ^, string, axes,
20-
show
17+
import Base:
18+
size,
19+
length,
20+
@propagate_inbounds,
21+
range,
22+
step,
23+
ndims,
24+
checkbounds,
25+
IndexStyle,
26+
==, ,
27+
getindex, eachindex,
28+
convert, in, ^, string, axes,
29+
show
2130

2231
import CompositeTypes:
2332
iscomposite, component, components, ncomponents

src/domains/interval.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ range(g::AbstractEquispacedRangeGrid) = g.range
3030
size(g::AbstractEquispacedRangeGrid) = size(range(g))
3131
step(g::AbstractEquispacedRangeGrid) = step(range(g))
3232

33+
range(g::AbstractUnitEquispacedGrid{T}) where T =
34+
range(zero(T), step=step(g), length=length(g))
35+
3336
@inline function unsafe_grid_getindex(grid::AbstractEquispacedRangeGrid, i::Int)
3437
@inbounds getindex(range(grid), i)
3538
end

0 commit comments

Comments
 (0)