Mercurial > repos > public > sbplib_julia
changeset 74:c47aaedcf71e
Make grid.spacings more readable
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Jan 2019 13:53:01 +0100 |
parents | d04569696918 |
children | 93c833019857 |
files | EquidistantGrid.jl |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/EquidistantGrid.jl Tue Jan 15 19:51:16 2019 +0100 +++ b/EquidistantGrid.jl Thu Jan 17 13:53:01 2019 +0100 @@ -53,11 +53,10 @@ # @Input: grid - an EquidistantGrid # @Return: h̄ - Grid spacing for each coordinate direction stored in a tuple. function spacings(grid::EquidistantGrid) - h̄ = Vector{Real}(undef, numberOfDimensions(grid)) - for i ∈ eachindex(h̄) - h̄[i] = abs(grid.limits[2][i]-grid.limits[1][i])/(grid.numberOfPointsPerDim[i]-1) - end - return Tuple(h̄) + a = grid.limits[1] + b = grid.limits[2] + + return abs.(b.-a)./(grid.numberOfPointsPerDim.-1) end # Computes the points of an EquidistantGrid as a vector of tuples. The vector is ordered