Mercurial > repos > public > sbplib_julia
comparison grid.jl @ 28:32a53cbee6c5
Resolved merge conflict adding plotting function to grid.jl
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 10 Jan 2019 10:38:42 +0100 |
parents | 9031fe054f2c aff8ea85ca70 |
children | e86c65958aa1 2dce28c59429 |
comparison
equal
deleted
inserted
replaced
23:9031fe054f2c | 28:32a53cbee6c5 |
---|---|
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 implemented for abstact type Grid") | 7 error("Not implemented for abstact type Grid") |
103 points[i] = grid.limits[1] .+ dx̄.*ci | 104 points[i] = grid.limits[1] .+ dx̄.*ci |
104 end | 105 end |
105 return points | 106 return points |
106 end | 107 end |
107 | 108 |
109 function plotOnGrid(grid::EquidistantGrid,v::Vector) | |
110 dim = numberOfDimensions(grid) | |
111 x = points(grid) | |
112 | |
113 if dim ==1 | |
114 plot(x,v) | |
115 else | |
116 error(string("Plot not implemented for dim =", string(dim))) | |
117 end | |
108 end | 118 end |
119 | |
120 end |