Mercurial > repos > public > sbplib_julia
annotate src/Grids/grid.jl @ 1262:5e28ae42caf2 refactor/grids
Clean up IteratorSize and eltype for EquidistantGrid, Grid, and ZeroDimGrid
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Thu, 23 Feb 2023 22:29:36 +0100 |
| parents | 198ccda331a6 |
| children | 7a67935d3f3a |
| 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 """ |
|
1257
198ccda331a6
Remove range dim as a type paratmeter on Grid as it is already encoded in T if available
Jonatan Werpers <jonatan@werpers.com>
parents:
1256
diff
changeset
|
2 Grid{T,D} |
| 1222 | 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. |
|
1257
198ccda331a6
Remove range dim as a type paratmeter on Grid as it is already encoded in T if available
Jonatan Werpers <jonatan@werpers.com>
parents:
1256
diff
changeset
|
11 abstract type Grid{T,D} end |
| 1222 | 12 |
| 13 | |
|
1262
5e28ae42caf2
Clean up IteratorSize and eltype for EquidistantGrid, Grid, and ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1257
diff
changeset
|
14 Base.ndims(::Grid{T,D}) where {T,D} = D |
|
5e28ae42caf2
Clean up IteratorSize and eltype for EquidistantGrid, Grid, and ZeroDimGrid
Jonatan Werpers <jonatan@werpers.com>
parents:
1257
diff
changeset
|
15 Base.eltype(::Type{<:Grid{T}}) where T = T |
| 1222 | 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 ? |
