Mercurial > repos > public > sbplib_julia
changeset 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 (current diff) aff8ea85ca70 (diff) |
children | 19078a768c5a 2dce28c59429 |
files | grid.jl |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/TimeStepper.jl Tue Jan 08 11:17:20 2019 +0100 +++ b/TimeStepper.jl Thu Jan 10 10:38:42 2019 +0100 @@ -6,7 +6,7 @@ end -function step(ts::TimeStepper) +function step!(ts::TimeStepper) error("not implemented") end @@ -45,7 +45,7 @@ return ts.t, ts.v end -function step(ts::Rk4) +function step!(ts::Rk4) k1 = ts.F(ts.v,ts.t) k2 = ts.F(ts.v+0.5*ts.k*k1,ts.t+0.5*ts.k) k3 = ts.F(ts.v+0.5*ts.k*k2,ts.t+0.5*ts.k)
--- a/grid.jl Tue Jan 08 11:17:20 2019 +0100 +++ b/grid.jl Thu Jan 10 10:38:42 2019 +0100 @@ -1,4 +1,5 @@ module grid +using Plots abstract type Grid end @@ -105,4 +106,15 @@ return points end +function plotOnGrid(grid::EquidistantGrid,v::Vector) + dim = numberOfDimensions(grid) + x = points(grid) + + if dim ==1 + plot(x,v) + else + error(string("Plot not implemented for dim =", string(dim))) + end end + +end