Mercurial > repos > public > sbplib_julia
comparison src/Grids/EquidistantGrid.jl @ 353:8257cc75ea6b feature/equidistant_grid/subgrid
Add doc string and allow picking several dimensions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 27 Sep 2020 21:04:59 +0200 |
parents | a18bd337a280 |
children | 64ad8ec0eae0 |
comparison
equal
deleted
inserted
replaced
352:a18bd337a280 | 353:8257cc75ea6b |
---|---|
64 indices = Tuple.(CartesianIndices(grid.size)) | 64 indices = Tuple.(CartesianIndices(grid.size)) |
65 h = spacing(grid) | 65 h = spacing(grid) |
66 return broadcast(I -> grid.limit_lower .+ (I.-1).*h, indices) | 66 return broadcast(I -> grid.limit_lower .+ (I.-1).*h, indices) |
67 end | 67 end |
68 | 68 |
69 function subgrid(grid::EquidistantGrid, dim::Integer) | 69 """ |
70 subgrid(::EquidistantGrid, dim) | |
71 | |
72 Pick out given dimensions from the grid and return a grid for them | |
73 """ | |
74 function subgrid(grid::EquidistantGrid, dim) | |
70 size = grid.size[dim] | 75 size = grid.size[dim] |
71 limit_lower = grid.limit_lower[dim] | 76 limit_lower = grid.limit_lower[dim] |
72 limit_upper = grid.limit_upper[dim] | 77 limit_upper = grid.limit_upper[dim] |
73 | 78 |
74 return EquidistantGrid(size, limit_lower, limit_upper) | 79 return EquidistantGrid(size, limit_lower, limit_upper) |