Mercurial > repos > public > sbplib_julia
comparison src/Grids/tensor_grid.jl @ 1338:5604676d8426 refactor/grids
Docs in tensor_grid.jl
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 04 May 2023 08:39:00 +0200 |
parents | f265799bc2b6 |
children | 08f06bfacd5c |
comparison
equal
deleted
inserted
replaced
1337:f265799bc2b6 | 1338:5604676d8426 |
---|---|
1 """ | 1 """ |
2 TensorGrid{T,D} <: Grid{T,D} | 2 TensorGrid{T,D} <: Grid{T,D} |
3 | 3 |
4 * Only supports HasShape grids at the moment | 4 A grid constructed as the tensor product of other grids. |
5 # TODO: | 5 |
6 Currently only supports grids with the `HasShape`-trait. | |
6 """ | 7 """ |
7 struct TensorGrid{T,D,GT<:NTuple{N,Grid} where N} <: Grid{T,D} | 8 struct TensorGrid{T,D,GT<:NTuple{N,Grid} where N} <: Grid{T,D} |
8 grids::GT | 9 grids::GT |
9 | 10 |
10 function TensorGrid(gs...) | 11 function TensorGrid(gs...) |
45 refine(g::TensorGrid, r::Int) = mapreduce(g->refine(g,r), TensorGrid, g.grids) | 46 refine(g::TensorGrid, r::Int) = mapreduce(g->refine(g,r), TensorGrid, g.grids) |
46 coarsen(g::TensorGrid, r::Int) = mapreduce(g->coarsen(g,r), TensorGrid, g.grids) | 47 coarsen(g::TensorGrid, r::Int) = mapreduce(g->coarsen(g,r), TensorGrid, g.grids) |
47 | 48 |
48 """ | 49 """ |
49 TensorGridBoundary{N, BID} <: BoundaryIdentifier | 50 TensorGridBoundary{N, BID} <: BoundaryIdentifier |
50 # TODO: | 51 |
52 A boundary identifier for a tensor grid. `N` Specifies which grid in the | |
53 tensor product and `BID` which boundary on that grid. | |
51 """ | 54 """ |
52 struct TensorGridBoundary{N, BID} <: BoundaryIdentifier end | 55 struct TensorGridBoundary{N, BID} <: BoundaryIdentifier end |
53 grid_id(::TensorGridBoundary{N, BID}) where {N, BID} = N | 56 grid_id(::TensorGridBoundary{N, BID}) where {N, BID} = N |
54 boundary_id(::TensorGridBoundary{N, BID}) where {N, BID} = BID() | 57 boundary_id(::TensorGridBoundary{N, BID}) where {N, BID} = BID() |
55 | 58 |