view src/Grids/grid.jl @ 1264:7a67935d3f3a refactor/grids

grid.jl: Fix function defs and add todos for documentation
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 24 Feb 2023 20:46:29 +0100
parents 5e28ae42caf2
children a4ddae8b5d49
line wrap: on
line source

"""
     Grid{T,D}

The top level type for grids.

Should implement
# TBD:
"""
#TBD: Should it be an AbstractArray? See notes in grid_refactor.md
# TODO: Document that grids should implement the interfaces for iteration and indexing.
abstract type Grid{T,D} end


Base.ndims(::Grid{T,D}) where {T,D} = D
Base.eltype(::Type{<:Grid{T}}) where T = T

"""
# TODO
"""
function refine end

"""
# TODO
"""
function coarsen end

"""
# TODO
"""
function boundary_identifiers end

"""
# TODO
"""
function boundary_grid end


# TODO: Make sure that all grids implement all of the above.

"""
    dims(grid::Grid)

Enumerate the dimensions of the grid.
"""
dims(grid::Grid) = 1:ndims(grid)


# TBD: New file grid_functions.jl?

function eval_on(::Grid) end # TODO: Should return a LazyArray and index the grid

"""
    getcomponent(gfun, I::Vararg{Int})

Return one of the components of gfun as a grid function.
"""
# Should it be lazy? Could it be a view?
function getcomponent(gfun, I::Vararg{Int}) end
# function getcomponent(gfun, s::Symbol) end ?