Mercurial > repos > public > sbplib_julia
comparison src/Grids/grid.jl @ 1132:302d36b5ba8e feature/boundary_conditions
Merge feature/grids
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 15 Jul 2022 15:24:02 +0200 |
parents | aeeffca46b94 |
children | dfbd62c7eb09 |
comparison
equal
deleted
inserted
replaced
1112:b2afacd57635 | 1132:302d36b5ba8e |
---|---|
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(grid::Grid) | |
15 | |
16 A range containing the dimensions of `grid` | |
17 """ | |
18 dims(grid::Grid) = 1:dim(grid) | |
19 | |
20 """ | |
21 evalOn(grid::Grid, f::Function) | |
22 | |
23 Evaluate function `f` on `grid` | |
24 """ | |
25 function evalOn(grid::Grid, f::Function) | |
26 F(x) = f(x...) | |
27 return F.(points(grid)) | |
28 end |