Mercurial > repos > public > sbplib_julia
comparison src/Grids/curvilinear_grid.jl @ 1432:64b60b42d367 feature/grids/curvilinear
Implement indexing interface
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 28 Aug 2023 09:30:34 +0200 |
parents | 6adf31ba6cfd |
children | 1656228095b5 |
comparison
equal
deleted
inserted
replaced
1431:6adf31ba6cfd | 1432:64b60b42d367 |
---|---|
7 jacobian(g::CurvilinearGrid) = g.jacobian | 7 jacobian(g::CurvilinearGrid) = g.jacobian |
8 logicalgrid(g::CurvilinearGrid) = g.logicalgrid | 8 logicalgrid(g::CurvilinearGrid) = g.logicalgrid |
9 | 9 |
10 | 10 |
11 # Indexing interface | 11 # Indexing interface |
12 Base.getindex(g::CurvilinearGrid, I...) = g.physicalcoordinates[I...] | 12 Base.getindex(g::CurvilinearGrid, I::Vararg{Int}) = g.physicalcoordinates[I...] |
13 Base.eachindex(g::CurvilinearGrid) = eachindex(g.logicalgrid) | |
14 | |
15 Base.firstindex(g::CurvilinearGrid, d) = firstindex(g.logicalgrid, d) | |
16 Base.lastindex(g::CurvilinearGrid, d) = lastindex(g.logicalgrid, d) | |
13 | 17 |
14 # function Base.getindex(g::TensorGrid, I...) | 18 # function Base.getindex(g::TensorGrid, I...) |
15 # szs = ndims.(g.grids) | 19 # szs = ndims.(g.grids) |
16 | 20 |
17 # Is = LazyTensors.split_tuple(I, szs) | 21 # Is = LazyTensors.split_tuple(I, szs) |