Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1116:c2d7e940639e feature/grids
Rename AbstractGrid to Grid and clean up Grids module
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 15 Jul 2022 09:54:15 +0200 |
parents | src/Grids/AbstractGrid.jl@6530fceef37c |
children | aeeffca46b94 |
comparison
equal
deleted
inserted
replaced
1115:6530fceef37c | 1116:c2d7e940639e |
---|---|
1 """ | |
2 Grid | |
3 | |
4 Should implement | |
5 dim(grid::Grid) | |
6 points(grid::Grid) | |
7 | |
8 """ | |
9 abstract type Grid end | |
10 function dim end # TODO: Rename to Base.ndims instead? That's the name used for arrays. | |
11 function points end | |
12 | |
13 """ | |
14 dims(g::Grid) | |
15 | |
16 A range containing the dimensions of the grid | |
17 """ | |
18 dims(grid::Grid) = 1:dim(grid) | |
19 | |
20 """ | |
21 evalOn(g::Grid, f::Function) | |
22 | |
23 Evaluate function f on the grid g | |
24 """ | |
25 function evalOn(g::Grid, f::Function) | |
26 F(x) = f(x...) | |
27 return F.(points(g)) | |
28 end |