Mercurial > repos > public > sbplib_julia
diff src/Grids/equidistant_grid.jl @ 1133:a8c8517a310f feature/boundary_conditions
Merge with default
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Wed, 05 Oct 2022 22:05:23 +0200 |
parents | dfbd62c7eb09 |
children | 9275d95e2d90 102ebdaf7c11 |
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl Fri Jul 15 15:24:02 2022 +0200 +++ b/src/Grids/equidistant_grid.jl Wed Oct 05 22:05:23 2022 +0200 @@ -62,13 +62,10 @@ Base.size(g::EquidistantGrid) = g.size - -""" - dim(grid::EquidistantGrid) +Base.ndims(::EquidistantGrid{Dim}) where Dim = Dim -The dimension of the grid. -""" -dim(::EquidistantGrid{Dim}) where Dim = Dim + + """ @@ -140,7 +137,7 @@ CartesianBoundary(2,Lower), ...) """ -boundary_identifiers(g::EquidistantGrid) = (((ntuple(i->(CartesianBoundary{i,Lower}(),CartesianBoundary{i,Upper}()),dim(g)))...)...,) +boundary_identifiers(g::EquidistantGrid) = (((ntuple(i->(CartesianBoundary{i,Lower}(),CartesianBoundary{i,Upper}()),ndims(g)))...)...,) """ @@ -158,18 +155,6 @@ """ - boundary_size(grid::EquidistantGrid, id::CartesianBoundary) - -Returns the size of the boundary of `grid` specified by `id`. -""" -function boundary_size(grid::EquidistantGrid, id::CartesianBoundary) - orth_dims = orthogonal_dims(grid, dim(id)) - return grid.size[orth_dims] -end -boundary_size(::EquidistantGrid{1,T},::CartesianBoundary{1}) where T = () - - -""" refine(grid::EquidistantGrid, r::Int) Refines `grid` by a factor `r`. The factor is applied to the number of @@ -180,7 +165,7 @@ function refine(grid::EquidistantGrid, r::Int) sz = size(grid) new_sz = (sz .- 1).*r .+ 1 - return EquidistantGrid{dim(grid), eltype(grid)}(new_sz, grid.limit_lower, grid.limit_upper) + return EquidistantGrid{ndims(grid), eltype(grid)}(new_sz, grid.limit_lower, grid.limit_upper) end @@ -202,5 +187,5 @@ new_sz = (sz .- 1).÷r .+ 1 - return EquidistantGrid{dim(grid), eltype(grid)}(new_sz, grid.limit_lower, grid.limit_upper) + return EquidistantGrid{ndims(grid), eltype(grid)}(new_sz, grid.limit_lower, grid.limit_upper) end