Mercurial > repos > public > sbplib_julia
comparison diffOp.jl @ 57:178a203f3e6d cell_based_test
Add types to Laplace operators
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 15 Jan 2019 19:51:16 +0100 |
parents | 27a8d3021a1c |
children | 7ab0043aca53 7054230b639c |
comparison
equal
deleted
inserted
replaced
56:27a8d3021a1c | 57:178a203f3e6d |
---|---|
47 return u | 47 return u |
48 end | 48 end |
49 | 49 |
50 # Differential operator for a*d^2/dx^2 | 50 # Differential operator for a*d^2/dx^2 |
51 struct Laplace1D <: DiffOp | 51 struct Laplace1D <: DiffOp |
52 grid | 52 grid::Grid.EquidistantGrid |
53 a | 53 a::Real |
54 op | 54 op::D2{Float64} |
55 end | 55 end |
56 | 56 |
57 # u = L*v | 57 # u = L*v |
58 function apply(L::Laplace1D, v::AbstractVector, i::Int) | 58 function apply(L::Laplace1D, v::AbstractVector, i::Int) |
59 h = Grid.spacings(L.grid)[1] | 59 h = Grid.spacings(L.grid)[1] |
62 end | 62 end |
63 | 63 |
64 | 64 |
65 # Differential operator for a*d^2/dx^2 + a*d^2/dy^2 | 65 # Differential operator for a*d^2/dx^2 + a*d^2/dy^2 |
66 struct Laplace2D <: DiffOp | 66 struct Laplace2D <: DiffOp |
67 grid | 67 grid::Grid.EquidistantGrid |
68 a | 68 a::Real |
69 op | 69 op::D2{Float64} |
70 end | 70 end |
71 | 71 |
72 # u = L*v | 72 # u = L*v |
73 function apply(L::Laplace2D, v::AbstractVector, i::Int) | 73 function apply(L::Laplace2D, v::AbstractVector, i::Int) |
74 h = Grid.spacings(L.grid) | 74 h = Grid.spacings(L.grid) |