Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1242:917cb8acbc17 refactor/grids
Remove AbstractArray subtyping for Grid for now
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 21 Feb 2023 21:13:37 +0100 |
parents | 8806f4cd6fee |
children | eb19cd128157 |
comparison
equal
deleted
inserted
replaced
1241:5096102fe053 | 1242:917cb8acbc17 |
---|---|
4 The top level type for grids. | 4 The top level type for grids. |
5 | 5 |
6 Should implement | 6 Should implement |
7 # TBD: | 7 # TBD: |
8 """ | 8 """ |
9 #TBD: Does all the kinds of grids we want fit with this interface? | 9 #TBD: Should it be an AbstractArray? See notes in grid_refactor.md |
10 # Multigrid? | 10 abstract type Grid{T,D,RD} end |
11 # Unstructured? | |
12 # Triangular structured grids? | |
13 # Non-simply connected? | |
14 # | |
15 # Maybe it shouldn't be an abstract array after all? | |
16 abstract type Grid{T,D,RD} <: AbstractArray{T,D} end | |
17 | 11 |
18 | 12 |
19 Base.ndims(::Grid{T,D,RD}) where {T,D,RD} = D # nidms borde nog vara antalet index som används för att indexera nätet. Snarare än vilken dimension nätet har (tänk ostrukturerat) | 13 Base.ndims(::Grid{T,D,RD}) where {T,D,RD} = D # nidms borde nog vara antalet index som används för att indexera nätet. Snarare än vilken dimension nätet har (tänk ostrukturerat) |
20 nrangedims(::Grid{T,D,RD}) where {T,D,RD} = RD | 14 nrangedims(::Grid{T,D,RD}) where {T,D,RD} = RD |
21 Base.eltype(::Grid{T,D,RD}) where {T,D,RD} = T # vad ska eltype vara? Inte T väl... en vektor? SVector{T,D}? | 15 Base.eltype(::Grid{T,D,RD}) where {T,D,RD} = T # vad ska eltype vara? Inte T väl... en vektor? SVector{T,D}? |