Mercurial > repos > public > sbplib_julia
view diffOp.jl @ 34:bb841977d198
Move stencil operator application to its own function
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 10 Jan 2019 15:49:44 +0100 |
parents | e8d7137b3f07 |
children | ef060ab3b035 |
line wrap: on
line source
abstract type DiffOp end function apply!(D::DiffOp, u::AbstractVector, v::AbstractVector) error("not implemented") end function innerProduct(D::DiffOp, u::AbstractVector, v::AbstractVector)::Real error("not implemented") end function matrixRepresentation(D::DiffOp) error("not implemented") end function boundaryCondition(D::DiffOp) error("not implemented") end function interface(Du::DiffOp, Dv::DiffOp, b::grid.BoundaryId; type) error("not implemented") end # Differential operator for a*d^2/dx^2 struct Laplace1D <: DiffOp grid a op end # u = L*v function apply!(L::Laplace1D, u::AbstractVector, v::AbstractVector) N = closureSize(L.op) M = length(v) h = scaling(L.grid) apply!(L.op, u, v, grid.spacings(L.grid)[1], 1, L.grid.numberOfPointsPerDim, stride=1) return nothing end