view 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
line wrap: on
line source

"""
     Grid

Should implement
    dim(grid::Grid)
    points(grid::Grid)

"""
abstract type Grid end
function dim end # TODO: Rename to Base.ndims instead? That's the name used for arrays.
function points end

"""
    dims(g::Grid)

A range containing the dimensions of the grid
"""
dims(grid::Grid) = 1:dim(grid)

"""
    evalOn(g::Grid, f::Function)

Evaluate function f on the grid g
"""
function evalOn(g::Grid, f::Function)
    F(x) = f(x...)
    return F.(points(g))
end