Mercurial > repos > public > sbplib_julia
annotate src/Grids/grid.jl @ 1256:3fc78ad26d03 refactor/grids
Add notes and todos about interface implementations for grids
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 22 Feb 2023 22:38:54 +0100 |
parents | eb19cd128157 |
children | 198ccda331a6 |
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 |
1256
3fc78ad26d03
Add notes and todos about interface implementations for grids
Jonatan Werpers <jonatan@werpers.com>
parents:
1244
diff
changeset
|
10 # TODO: Document that grids should implement the interfaces for iteration and indexing. |
1242
917cb8acbc17
Remove AbstractArray subtyping for Grid for now
Jonatan Werpers <jonatan@werpers.com>
parents:
1234
diff
changeset
|
11 abstract type Grid{T,D,RD} end |
1222 | 12 |
13 | |
14 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) | |
15 nrangedims(::Grid{T,D,RD}) where {T,D,RD} = RD | |
16 Base.eltype(::Grid{T,D,RD}) where {T,D,RD} = T # vad ska eltype vara? Inte T väl... en vektor? SVector{T,D}? | |
17 | |
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 |
1244
eb19cd128157
Group eval_on with other gridfunction functionality
Jonatan Werpers <jonatan@werpers.com>
parents:
1242
diff
changeset
|
41 # TBD: New file grid_functions.jl? |
1222 | 42 |
1244
eb19cd128157
Group eval_on with other gridfunction functionality
Jonatan Werpers <jonatan@werpers.com>
parents:
1242
diff
changeset
|
43 function eval_on(::Grid) end # TODO: Should return a LazyArray and index the grid |
1222 | 44 |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
45 """ |
1222 | 46 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
|
47 |
1222 | 48 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
|
49 """ |
1222 | 50 # Should it be lazy? Could it be a view? |
51 function getcomponent(gfun, I::Vararg{Int}) end | |
52 # function getcomponent(gfun, s::Symbol) end ? |