Mercurial > repos > public > sbplib_julia
comparison src/Grids/equidistant_grid.jl @ 1877:21e5fe1545c0 refactor/lazy_tensors/elementwise_ops
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 27 Jan 2025 16:56:04 +0100 |
parents | 516eaabf1169 |
children | edee7d677efb f93ba5832146 |
comparison
equal
deleted
inserted
replaced
1840:cb3a8450ed44 | 1877:21e5fe1545c0 |
---|---|
13 struct EquidistantGrid{T,R<:AbstractRange{T}} <: Grid{T,1} | 13 struct EquidistantGrid{T,R<:AbstractRange{T}} <: Grid{T,1} |
14 points::R | 14 points::R |
15 end | 15 end |
16 | 16 |
17 # Indexing interface | 17 # Indexing interface |
18 Base.getindex(g::EquidistantGrid, i) = g.points[i] | 18 Base.getindex(g::EquidistantGrid, i::Int) = g.points[i] |
19 Base.eachindex(g::EquidistantGrid) = eachindex(g.points) | 19 Base.eachindex(g::EquidistantGrid) = eachindex(g.points) |
20 Base.firstindex(g::EquidistantGrid) = firstindex(g.points) | 20 Base.firstindex(g::EquidistantGrid) = firstindex(g.points) |
21 Base.lastindex(g::EquidistantGrid) = lastindex(g.points) | 21 Base.lastindex(g::EquidistantGrid) = lastindex(g.points) |
22 | 22 |
23 Base.axes(g::EquidistantGrid, d) = axes(g.points, d) | 23 Base.axes(g::EquidistantGrid, d) = axes(g.points, d) |
69 | 69 |
70 | 70 |
71 boundary_identifiers(::EquidistantGrid) = (LowerBoundary(), UpperBoundary()) | 71 boundary_identifiers(::EquidistantGrid) = (LowerBoundary(), UpperBoundary()) |
72 boundary_grid(g::EquidistantGrid, id::LowerBoundary) = ZeroDimGrid(g[begin]) | 72 boundary_grid(g::EquidistantGrid, id::LowerBoundary) = ZeroDimGrid(g[begin]) |
73 boundary_grid(g::EquidistantGrid, id::UpperBoundary) = ZeroDimGrid(g[end]) | 73 boundary_grid(g::EquidistantGrid, id::UpperBoundary) = ZeroDimGrid(g[end]) |
74 boundary_indices(g::EquidistantGrid, id::LowerBoundary) = (firstindex(g),) | 74 boundary_indices(g::EquidistantGrid, id::LowerBoundary) = firstindex(g) |
75 boundary_indices(g::EquidistantGrid, id::UpperBoundary) = (lastindex(g),) | 75 boundary_indices(g::EquidistantGrid, id::UpperBoundary) = lastindex(g) |
76 | 76 |
77 """ | 77 """ |
78 refine(g::EquidistantGrid, r::Int) | 78 refine(g::EquidistantGrid, r::Int) |
79 | 79 |
80 The grid where `g` is refined by the factor `r`. The factor is applied to the number of | 80 The grid where `g` is refined by the factor `r`. The factor is applied to the number of |