Mercurial > repos > public > sbplib_julia
comparison grid.jl @ 16:c61af27cb67a
Fix compile errors
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 17 Dec 2018 15:05:45 +0100 |
parents | 3d032081832d |
children | af8469bc1cb3 |
comparison
equal
deleted
inserted
replaced
15:3d032081832d | 16:c61af27cb67a |
---|---|
1 module grid | 1 module grid |
2 | 2 |
3 abstract type Grid end | 3 abstract type Grid end |
4 | 4 |
5 function numberOfDimensions(grid::Grid) | 5 function numberOfDimensions(grid::Grid) |
6 error("Not yet implemented"); | 6 error("Not yet implemented") |
7 end | 7 end |
8 | 8 |
9 function numberOfPoints(grid::Grid) | 9 function numberOfPoints(grid::Grid) |
10 error("Not yet implemented"); | 10 error("Not yet implemented") |
11 end | 11 end |
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 abstract type BoundaryId end | 17 abstract type BoundaryId end |
18 | 18 |
19 # Move to seperate file. | 19 # Move to seperate file. |
20 struct EquidistantGrid <: Grid | 20 struct EquidistantGrid <: Grid |
21 numberOfDimensions::UInt; | 21 numberOfDimensions::UInt |
22 numberOfPoints::Vector(UInt); | 22 numberOfPoints::Vector{UInt} |
23 limits::Vector{Pair{Real, Real}}; | 23 limits::Vector{Pair{Real, Real}} |
24 function EquidistantGrid(nDims, nPoints, lims) | 24 function EquidistantGrid(nDims, nPoints, lims) |
25 @assert nDims == size(nPoints); | 25 @assert nDims == size(nPoints) |
26 return new(nDims, nPoints, lims); | 26 return new(nDims, nPoints, lims) |
27 end | 27 end |
28 end | 28 end |
29 | 29 |
30 # Getter functions for public properties? | |
31 function numberOfDimensions(grid::EquidistantGrid) | 30 function numberOfDimensions(grid::EquidistantGrid) |
32 return grid.numberOfDimensions; | 31 return grid.numberOfDimensions |
33 end | 32 end |
34 | 33 |
35 function numberOfPoints(grid::EquidistantGrid) | 34 function numberOfPoints(grid::EquidistantGrid) |
36 return grid.numberOfPoints; | 35 return grid.numberOfPoints |
37 end | 36 end |
38 | 37 |
39 | |
40 function points(grid::EquidistantGrid) | 38 function points(grid::EquidistantGrid) |
41 points::Array{Real,3}(undef, numberOfPoints(grid)); | 39 points::Matrix{Real,3}(undef, numberOfPoints(grid)) |
42 # for i ∈ eachindex(points) | 40 return points |
43 # points(i) = i/ | |
44 # end | |
45 return points; | |
46 end | 41 end |
47 | 42 |
48 function limitsForDimension(grid::EquidistantGrid, dim::UInt) | 43 function limitsForDimension(grid::EquidistantGrid, dim::UInt) |
49 @assert dim <= 3 | 44 return grid.limits(dim) |
50 @assert dim >= 1 | |
51 return grid.limits(dim); | |
52 end | 45 end |
46 | |
47 end |