view sbpPlot.jl @ 129:1aaeb46ba5f4 cell_based_test

Improve efficiency of apply by the following: - Remove divisions in interior loop by storing and multiplying by the reciprocal of grid spacing instead. - Add @inline to apply(::Laplace - Remove initialization of w = 0 in apply(::Stencil) by manually unrolling first iteration of the loop.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 14 Feb 2019 16:25:22 +0100
parents 631eb9b35d72
children d61bfc8cf6a5
line wrap: on
line source

module sbpPlot
using PyPlot, PyCall

function plotgridfunction(grid::EquidistantGrid, gridfunction)
    if dimension(grid) == 1
        plot(pointsalongdim(grid,1), gridfunction, linewidth=2.0)
    elseif dimension(grid) == 2
        mx = grid.size[1]
        my = grid.size[2]
        X = repeat(pointsalongdim(grid,1),1,my)
        Y = permutedims(repeat(pointsalongdim(grid,2),1,mx))
        plot_surface(X,Y,reshape(gridfunction,mx,my));
    else
        error(string("Plot not implemented for dimension ", string(dimension(grid))))
    end
end
end