comparison grid.jl @ 22:f2dc3e09fffc

Add comments
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Tue, 18 Dec 2018 14:51:41 +0100
parents 2dbdd00eaea0
children 9031fe054f2c
comparison
equal deleted inserted replaced
21:2dbdd00eaea0 22:f2dc3e09fffc
12 12
13 function points(grid::Grid) 13 function points(grid::Grid)
14 error("Not yet implemented") 14 error("Not yet implemented")
15 end 15 end
16 16
17 # TODO: Should this be here?
17 abstract type BoundaryId end 18 abstract type BoundaryId end
18 19
19 # TODO: Move to seperate file. 20 # TODO: Move to seperate file.
20 # Prefer to use UInt here, but printing UInt returns hex. 21 # Prefer to use UInt here, but printing UInt returns hex.
21 struct EquidistantGrid <: Grid 22 struct EquidistantGrid <: Grid
52 return numberOfPoints 53 return numberOfPoints
53 end 54 end
54 55
55 # TODO: Decide if spacings should be positive or if it is allowed to be negative 56 # TODO: Decide if spacings should be positive or if it is allowed to be negative
56 # If defined as positive, then need to do something extra when calculating the 57 # If defined as positive, then need to do something extra when calculating the
57 # points. The current implementation works for 58 # points. The current implementation works for arbitarily given limits of the grid.
58 function spacings(grid::EquidistantGrid) 59 function spacings(grid::EquidistantGrid)
59 h = Vector{Real}(undef, numberOfDimensions(grid)) 60 h = Vector{Real}(undef, numberOfDimensions(grid))
60 for i ∈ eachindex(h) 61 for i ∈ eachindex(h)
61 h[i] = (grid.limits[2][i]-grid.limits[1][i])/(grid.numberOfPointsPerDim[i]-1) 62 h[i] = (grid.limits[2][i]-grid.limits[1][i])/(grid.numberOfPointsPerDim[i]-1)
62 end 63 end