comparison src/SbpOperators/laplace/laplace.jl @ 556:37a81dad36b9

Merge refactor/tensor_index_coupling
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Sun, 29 Nov 2020 21:18:45 +0100
parents 011ca1639153
children e71f2f81b5f8
comparison
equal deleted inserted replaced
540:013ca4892540 556:37a81dad36b9
21 end 21 end
22 22
23 LazyTensors.range_size(L::Laplace) = getindex.(range_size.(L.D2),1) 23 LazyTensors.range_size(L::Laplace) = getindex.(range_size.(L.D2),1)
24 LazyTensors.domain_size(L::Laplace) = getindex.(domain_size.(L.D2),1) 24 LazyTensors.domain_size(L::Laplace) = getindex.(domain_size.(L.D2),1)
25 25
26 function LazyTensors.apply(L::Laplace{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} 26 function LazyTensors.apply(L::Laplace{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Any,Dim}) where {T,Dim}
27 error("not implemented") 27 error("not implemented")
28 end 28 end
29 29
30 # u = L*v 30 # u = L*v
31 function LazyTensors.apply(L::Laplace{1,T}, v::AbstractVector{T}, I::Index) where T 31 function LazyTensors.apply(L::Laplace{1,T}, v::AbstractVector{T}, i) where T
32 @inbounds u = LazyTensors.apply(L.D2[1],v,I) 32 @inbounds u = LazyTensors.apply(L.D2[1],v,i)
33 return u 33 return u
34 end 34 end
35 35
36 function LazyTensors.apply(L::Laplace{2,T}, v::AbstractArray{T,2}, I::Index, J::Index) where T 36 function LazyTensors.apply(L::Laplace{2,T}, v::AbstractArray{T,2}, i, j) where T
37 # 2nd x-derivative 37 # 2nd x-derivative
38 @inbounds vx = view(v, :, Int(J)) 38 @inbounds vx = view(v, :, Int(j))
39 @inbounds uᵢ = LazyTensors.apply(L.D2[1], vx , I) 39 @inbounds uᵢ = LazyTensors.apply(L.D2[1], vx , i)
40 40
41 # 2nd y-derivative 41 # 2nd y-derivative
42 @inbounds vy = view(v, Int(I), :) 42 @inbounds vy = view(v, Int(i), :)
43 @inbounds uᵢ += LazyTensors.apply(L.D2[2], vy , J) 43 @inbounds uᵢ += LazyTensors.apply(L.D2[2], vy , j)
44 44
45 return uᵢ 45 return uᵢ
46 end 46 end
47 47
48 # quadrature(L::Laplace) = Quadrature(L.op, L.grid) 48 # quadrature(L::Laplace) = Quadrature(L.op, L.grid)