Mercurial > repos > public > sbplib_julia
comparison src/Grids/equidistant_grid.jl @ 1575:efe1fc4cb6b0
Improve error message when giving arguments of different length to equidistant_grid()
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 25 Apr 2024 14:42:30 +0200 |
parents | 43aaf710463e |
children | 611ae2308aa1 |
comparison
equal
deleted
inserted
replaced
1556:ec5e7926c37b | 1575:efe1fc4cb6b0 |
---|---|
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 """ |