Mercurial > repos > public > sbplib_julia
diff src/Grids/equidistant_grid.jl @ 1956:b0fcb29e3620 feature/grids/multiblock_boundaries
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 11 Feb 2025 08:54:18 +0100 |
parents | f93ba5832146 |
children | 04c251bccbd4 |
line wrap: on
line diff
--- a/src/Grids/equidistant_grid.jl Mon Feb 03 23:10:12 2025 +0100 +++ b/src/Grids/equidistant_grid.jl Tue Feb 11 08:54:18 2025 +0100 @@ -135,21 +135,26 @@ end """ - equidistant_grid(limit_lower::T, limit_upper::T, size::Int) + equidistant_grid(limit_lower::Number, limit_upper::Number, size::Int) Constructs a 1D equidistant grid. """ function equidistant_grid(limit_lower::Number, limit_upper::Number, size::Int) - if any(size .<= 0) + if size <= 0 throw(DomainError("size must be postive")) end - if any(limit_upper.-limit_lower .<= 0) + if limit_upper-limit_lower <= 0 throw(DomainError("side length must be postive")) end + return EquidistantGrid(range(limit_lower, limit_upper, length=size)) # TBD: Should it use LinRange instead? end +equidistant_grid(d::Interval, size::Int) = equidistant_grid(limits(d)..., size) +equidistant_grid(hb::HyperBox, dims::Vararg{Int}) = equidistant_grid(limits(hb)..., dims...) + + CartesianBoundary{D,BID} = TensorGridBoundary{D,BID} # TBD: What should we do about the naming of this boundary?