Mercurial > repos > public > sbplib_julia
annotate src/Grids/grid.jl @ 1234:8806f4cd6fee refactor/grids
Move ZeroDimGrid to its own file
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 19 Feb 2023 22:20:44 +0100 |
parents | 3924c1f6ec6d |
children | 917cb8acbc17 |
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 """ | |
9 #TBD: Does all the kinds of grids we want fit with this interface? | |
10 # Multigrid? | |
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 | |
18 | |
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) | |
20 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}? | |
22 | |
23 function eval_on(::Grid) end # TODO: Should return a LazyArray and index the grid | |
24 function refine(::Grid) end | |
25 function coarsen(::Grid) end # Should this be here? What if it is not possible? | |
26 | |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
27 """ |
1222 | 28 # TODO |
29 """ | |
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
30 function boundary_identifiers end |
1222 | 31 """ |
32 # TODO | |
33 """ | |
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
34 function boundary_grid end |
1222 | 35 |
36 | |
37 # 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
|
38 |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
39 """ |
1117
aeeffca46b94
Minor renamings
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1116
diff
changeset
|
40 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
|
41 |
1222 | 42 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
|
43 """ |
1128
dfbd62c7eb09
Rename dim to ndims in Grids.jl
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1117
diff
changeset
|
44 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
|
45 |
1222 | 46 |
47 | |
48 # TBD: New file grid_functions.jl? | |
49 | |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
50 """ |
1222 | 51 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
|
52 |
1222 | 53 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
|
54 """ |
1222 | 55 # Should it be lazy? Could it be a view? |
56 function getcomponent(gfun, I::Vararg{Int}) end | |
57 # function getcomponent(gfun, s::Symbol) end ? |