Mercurial > repos > public > sbplib_julia
comparison grid.jl @ 27:aff8ea85ca70
Add plotOnGrid to grid
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 10 Jan 2019 10:15:27 +0100 |
parents | af8469bc1cb3 |
children | 32a53cbee6c5 |
comparison
equal
deleted
inserted
replaced
26:d2896e70cd4f | 27:aff8ea85ca70 |
---|---|
1 module grid | 1 module grid |
2 using Plots | |
2 | 3 |
3 abstract type Grid end | 4 abstract type Grid end |
4 | 5 |
5 function numberOfDimensions(grid::Grid) | 6 function numberOfDimensions(grid::Grid) |
6 error("Not yet implemented") | 7 error("Not yet implemented") |
49 | 50 |
50 function limitsForDimension(grid::EquidistantGrid, dim::Int) | 51 function limitsForDimension(grid::EquidistantGrid, dim::Int) |
51 return grid.limits[dim] | 52 return grid.limits[dim] |
52 end | 53 end |
53 | 54 |
55 function plotOnGrid(grid::EquidistantGrid,v::Vector) | |
56 dim = numberOfDimensions(grid) | |
57 x = points(grid) | |
58 | |
59 if dim ==1 | |
60 plot(x,v) | |
61 else | |
62 error(string("Plot not implemented for dim =", string(dim))) | |
63 end | |
54 end | 64 end |
65 | |
66 end |