Mercurial > repos > public > sbplib_julia
annotate src/Grids/grid.jl @ 1268:dbddd0f61bde refactor/grids
Add refine, coarsen, boundary_identifiers, and boundary_grid methods to ZeroDimGrid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 24 Feb 2023 21:54:39 +0100 |
parents | a4ddae8b5d49 |
children | 20f42cf0800c |
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 |
1264
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
17 """ |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
18 # TODO |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
19 """ |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
20 function refine end |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
21 |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
22 """ |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
23 # TODO |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
24 """ |
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
25 function coarsen end |
1222 | 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 |
1264
7a67935d3f3a
grid.jl: Fix function defs and add todos for documentation
Jonatan Werpers <jonatan@werpers.com>
parents:
1262
diff
changeset
|
31 |
1222 | 32 """ |
33 # TODO | |
34 """ | |
1233
3924c1f6ec6d
Fix empty function defs
Jonatan Werpers <jonatan@werpers.com>
parents:
1222
diff
changeset
|
35 function boundary_grid end |
1266
a4ddae8b5d49
Add tests for TensorGrid and make them pass
Jonatan Werpers <jonatan@werpers.com>
parents:
1264
diff
changeset
|
36 # TBD Can we implement a version here that accepts multiple ids and grouped boundaries? Maybe we need multiblock stuff? |
1222 | 37 |
38 | |
39 # 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
|
40 |
212
aa17d4d9d09e
Export some functions from AbstractGrid and move documentation to docstrings
Jonatan Werpers <jonatan@werpers.com>
parents:
211
diff
changeset
|
41 """ |
1117
aeeffca46b94
Minor renamings
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1116
diff
changeset
|
42 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
|
43 |
1222 | 44 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
|
45 """ |
1128
dfbd62c7eb09
Rename dim to ndims in Grids.jl
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1117
diff
changeset
|
46 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
|
47 |
1222 | 48 |
1244
eb19cd128157
Group eval_on with other gridfunction functionality
Jonatan Werpers <jonatan@werpers.com>
parents:
1242
diff
changeset
|
49 # TBD: New file grid_functions.jl? |
1222 | 50 |
1244
eb19cd128157
Group eval_on with other gridfunction functionality
Jonatan Werpers <jonatan@werpers.com>
parents:
1242
diff
changeset
|
51 function eval_on(::Grid) end # TODO: Should return a LazyArray and index the grid |
1222 | 52 |
1116
c2d7e940639e
Rename AbstractGrid to Grid and clean up Grids module
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
1115
diff
changeset
|
53 """ |
1222 | 54 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
|
55 |
1222 | 56 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
|
57 """ |
1222 | 58 # Should it be lazy? Could it be a view? |
59 function getcomponent(gfun, I::Vararg{Int}) end | |
60 # function getcomponent(gfun, s::Symbol) end ? |