Mercurial > repos > public > sbplib_julia
annotate 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 |
rev | line source |
---|---|
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
1 """ |
1222 | 2 Grid{T,D,RD} <: AbstractArray{T,D} |
3 | |
4 The top level type for grids. | |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
5 |
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
6 Should implement |
1222 | 7 # TBD: |
8 """ | |
1242
917cb8acbc17
Remove AbstractArray subtyping for Grid for now
Jonatan Werpers <jonatan@werpers.com>
parents:
1234
diff
changeset
|
9 #TBD: Should it be an AbstractArray? See notes in grid_refactor.md |
917cb8acbc17
Remove AbstractArray subtyping for Grid for now
Jonatan Werpers <jonatan@werpers.com>
parents:
1234
diff
changeset
|
10 abstract type Grid{T,D,RD} end |
1222 | 11 |
12 | |
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) | |
14 nrangedims(::Grid{T,D,RD}) where {T,D,RD} = RD | |
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}? | |
16 | |
17 function eval_on(::Grid) end # TODO: Should return a LazyArray and index the grid | |
18 function refine(::Grid) end | |
19 function coarsen(::Grid) end # Should this be here? What if it is not possible? | |
20 | |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
21 """ |
1222 | 22 # TODO |
23 """ | |
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
24 function boundary_identifiers end |
1222 | 25 """ |
26 # TODO | |
27 """ | |
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
28 function boundary_grid end |
1222 | 29 |
30 | |
31 # TODO: Make sure that all grids implement all of the above. | |
51
614b56a017b9
Split grid.jl into AbstractGrid.jl and EquidistantGrid.jl
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
32 |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
33 """ |
1117
aeeffca46b94
Minor renamings
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1116
diff
changeset
|
34 dims(grid::Grid) |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
35 |
1222 | 36 Enumerate the dimensions of the grid. |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
37 """ |
1128
dfbd62c7eb09
Rename dim to ndims in Grids.jl
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1117
diff
changeset
|
38 dims(grid::Grid) = 1:ndims(grid) |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
39 |
1222 | 40 |
41 | |
42 # TBD: New file grid_functions.jl? | |
43 | |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
44 """ |
1222 | 45 getcomponent(gfun, I::Vararg{Int}) |
51
614b56a017b9
Split grid.jl into AbstractGrid.jl and EquidistantGrid.jl
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff
changeset
|
46 |
1222 | 47 Return one of the components of gfun as a grid function. |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
48 """ |
1222 | 49 # Should it be lazy? Could it be a view? |
50 function getcomponent(gfun, I::Vararg{Int}) end | |
51 # function getcomponent(gfun, s::Symbol) end ? |