Mercurial > repos > public > sbplib_julia
changeset 1248:a5f2372d0e87 refactor/grids
Add argument checking to equdistant_grid
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 22 Feb 2023 12:42:08 +0100 |
parents | 2abec782cf5b |
children | 215f36712332 |
files | src/Grids/equidistant_grid.jl |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl Wed Feb 22 12:41:14 2023 +0100 +++ b/src/Grids/equidistant_grid.jl Wed Feb 22 12:42:08 2023 +0100 @@ -94,6 +94,14 @@ behaviours. """ function equidistant_grid(size::Dims, limit_lower, limit_upper) + if any(size .<= 0) + throw(DomainError("all components of size must be postive")) + end + + if any(limit_upper.-limit_lower .<= 0) + throw(DomainError("all side lengths must be postive")) + end + gs = map(size, limit_lower, limit_upper) do s,l,u EquidistantGrid(range(l, u, length=s)) # TBD: Should it use LinRange instead? end