comparison diffOp.jl @ 89:c0729ade65da patch_based_test

Merge with default
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 25 Jan 2019 16:47:51 +0100
parents 170e5447bc19 48079bd39969
children 2882e1318cc3
comparison
equal deleted inserted replaced
88:170e5447bc19 89:c0729ade65da
31 function apply(c::Penalty, g, i::Int) 31 function apply(c::Penalty, g, i::Int)
32 error("not implemented") 32 error("not implemented")
33 end 33 end
34 34
35 # Differential operator for a*d^2/dx^2 35 # Differential operator for a*d^2/dx^2
36 struct Laplace{Dim, T<:Real} <: DiffOp 36 struct Laplace{Dim,T<:Real,N,M,K} <: DiffOp
37 grid::Grid.EquidistantGrid{Dim,T} 37 grid::Grid.EquidistantGrid{Dim,T}
38 a::T 38 a::T
39 op::D2{Float64} 39 op::D2{Float64,N,M,K}
40 end 40 end
41 41
42 # u = L*v 42 # u = L*v
43 function apply!(L::Laplace{1}, u::AbstractVector, v::AbstractVector) 43 function apply!(L::Laplace{1}, u::AbstractVector, v::AbstractVector)
44 h = Grid.spacings(L.grid)[1] 44 h = Grid.spacings(L.grid)[1]
61 temp = zeros(eltype(u), n_y) 61 temp = zeros(eltype(u), n_y)
62 for i ∈ 1:n_x 62 for i ∈ 1:n_x
63 @inbounds indices = uview(li,i,:) 63 @inbounds indices = uview(li,i,:)
64 @inbounds apply!(L.op, temp, uview(v, indices), h[2]) 64 @inbounds apply!(L.op, temp, uview(v, indices), h[2])
65 for i ∈ eachindex(indices) 65 for i ∈ eachindex(indices)
66 @inbounds u[indices[i]] += temp[i] 66 @inbounds u[indices[i]] = temp[i]
67 end 67 end
68 end 68 end
69 69
70 # For each y 70 # For each y
71 temp = zeros(eltype(u), n_x) 71 temp = zeros(eltype(u), n_x)