Mercurial > repos > public > sbplib_julia
comparison src/Grids/equidistant_grid.jl @ 1651:707fc9761c2b feature/sbp_operators/laplace_curvilinear
Merge feature/grids/manifolds
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Wed, 26 Jun 2024 12:47:26 +0200 |
| parents | 8250cf5a3ce9 |
| children | 13a7a4ff49e3 |
comparison
equal
deleted
inserted
replaced
| 1648:b7dcd3dd3181 | 1651:707fc9761c2b |
|---|---|
| 105 completely integer grid, `equidistant_grid` will still return a floating point | 105 completely integer grid, `equidistant_grid` will still return a floating point |
| 106 grid. This simplifies the implementation and avoids certain surprise | 106 grid. This simplifies the implementation and avoids certain surprise |
| 107 behaviors. | 107 behaviors. |
| 108 """ | 108 """ |
| 109 function equidistant_grid(limit_lower, limit_upper, dims::Vararg{Int}) | 109 function equidistant_grid(limit_lower, limit_upper, dims::Vararg{Int}) |
| 110 if !(length(limit_lower) == length(limit_upper) == length(dims)) | |
| 111 throw(ArgumentError("All arguments must be of the same length")) | |
| 112 end | |
| 110 gs = map(equidistant_grid, limit_lower, limit_upper, dims) | 113 gs = map(equidistant_grid, limit_lower, limit_upper, dims) |
| 111 return TensorGrid(gs...) | 114 return TensorGrid(gs...) |
| 112 end | 115 end |
| 113 | 116 |
| 114 """ | 117 """ |
| 127 return EquidistantGrid(range(limit_lower, limit_upper, length=size)) # TBD: Should it use LinRange instead? | 130 return EquidistantGrid(range(limit_lower, limit_upper, length=size)) # TBD: Should it use LinRange instead? |
| 128 end | 131 end |
| 129 | 132 |
| 130 | 133 |
| 131 equidistant_grid(hb::HyperBox, dims::Vararg{Int}) = equidistant_grid(hb.a, hb.b, dims...) | 134 equidistant_grid(hb::HyperBox, dims::Vararg{Int}) = equidistant_grid(hb.a, hb.b, dims...) |
| 135 # TODO: One dimensional grids shouldn't have vector eltype right?, Change here or in HyperBox? | |
| 132 | 136 |
| 133 function equidistant_grid(c::Chart, dims::Vararg{Int}) | 137 function equidistant_grid(c::Chart, dims::Vararg{Int}) |
| 134 lg = equidistant_grid(parameterspace(c), dims...) | 138 lg = equidistant_grid(parameterspace(c), dims...) |
| 135 return MappedGrid( | 139 return MappedGrid( |
| 136 lg, | 140 lg, |
