Mercurial > repos > public > sbplib_julia
annotate src/Grids/grid.jl @ 1244:eb19cd128157 refactor/grids
Group eval_on with other gridfunction functionality
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Tue, 21 Feb 2023 21:37:37 +0100 |
| parents | 917cb8acbc17 |
| children | 3fc78ad26d03 |
| 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 refine(::Grid) end | |
| 18 function coarsen(::Grid) end # Should this be here? What if it is not possible? | |
| 19 | |
|
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
20 """ |
| 1222 | 21 # TODO |
| 22 """ | |
|
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
23 function boundary_identifiers end |
| 1222 | 24 """ |
| 25 # TODO | |
| 26 """ | |
|
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
27 function boundary_grid end |
| 1222 | 28 |
| 29 | |
| 30 # 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
|
31 |
|
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
32 """ |
|
1117
aeeffca46b94
Minor renamings
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1116
diff
changeset
|
33 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
|
34 |
| 1222 | 35 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
|
36 """ |
|
1128
dfbd62c7eb09
Rename dim to ndims in Grids.jl
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1117
diff
changeset
|
37 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
|
38 |
| 1222 | 39 |
|
1244
eb19cd128157
Group eval_on with other gridfunction functionality
Jonatan Werpers <jonatan@werpers.com>
parents:
1242
diff
changeset
|
40 # TBD: New file grid_functions.jl? |
| 1222 | 41 |
|
1244
eb19cd128157
Group eval_on with other gridfunction functionality
Jonatan Werpers <jonatan@werpers.com>
parents:
1242
diff
changeset
|
42 function eval_on(::Grid) end # TODO: Should return a LazyArray and index the grid |
| 1222 | 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 ? |
