Mercurial > repos > public > sbplib_julia
comparison EquidistantGrid.jl @ 74:c47aaedcf71e
Make grid.spacings more readable
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 17 Jan 2019 13:53:01 +0100 |
parents | f3ea15c8ebb6 |
children | 93c833019857 |
comparison
equal
deleted
inserted
replaced
73:d04569696918 | 74:c47aaedcf71e |
---|---|
51 # between two points for each coordinate direction. | 51 # between two points for each coordinate direction. |
52 # | 52 # |
53 # @Input: grid - an EquidistantGrid | 53 # @Input: grid - an EquidistantGrid |
54 # @Return: h̄ - Grid spacing for each coordinate direction stored in a tuple. | 54 # @Return: h̄ - Grid spacing for each coordinate direction stored in a tuple. |
55 function spacings(grid::EquidistantGrid) | 55 function spacings(grid::EquidistantGrid) |
56 h̄ = Vector{Real}(undef, numberOfDimensions(grid)) | 56 a = grid.limits[1] |
57 for i ∈ eachindex(h̄) | 57 b = grid.limits[2] |
58 h̄[i] = abs(grid.limits[2][i]-grid.limits[1][i])/(grid.numberOfPointsPerDim[i]-1) | 58 |
59 end | 59 return abs.(b.-a)./(grid.numberOfPointsPerDim.-1) |
60 return Tuple(h̄) | |
61 end | 60 end |
62 | 61 |
63 # Computes the points of an EquidistantGrid as a vector of tuples. The vector is ordered | 62 # Computes the points of an EquidistantGrid as a vector of tuples. The vector is ordered |
64 # such that points in the first coordinate direction varies first, then the second | 63 # such that points in the first coordinate direction varies first, then the second |
65 # and lastely the third (if applicable) | 64 # and lastely the third (if applicable) |