Mercurial > repos > public > sbplib_julia
comparison src/SbpOperators/quadrature/quadrature.jl @ 542:011ca1639153 refactor/tensor_index_coupling
Remove Index{Unknown} and replace with general Any implementations
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 27 Nov 2020 11:27:37 +0100 |
parents | 0546cb279fc2 |
children |
comparison
equal
deleted
inserted
replaced
541:62d96e2cd165 | 542:011ca1639153 |
---|---|
20 end | 20 end |
21 | 21 |
22 LazyTensors.range_size(H::Quadrature) = getindex.(range_size.(H.H),1) | 22 LazyTensors.range_size(H::Quadrature) = getindex.(range_size.(H.H),1) |
23 LazyTensors.domain_size(H::Quadrature) = getindex.(domain_size.(H.H),1) | 23 LazyTensors.domain_size(H::Quadrature) = getindex.(domain_size.(H.H),1) |
24 | 24 |
25 function LazyTensors.apply(Q::Quadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {T,Dim} | 25 function LazyTensors.apply(Q::Quadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Any,Dim}) where {T,Dim} |
26 error("not implemented") | 26 error("not implemented") |
27 end | 27 end |
28 | 28 |
29 function LazyTensors.apply(Q::Quadrature{1,T}, v::AbstractVector{T}, I::Index) where T | 29 function LazyTensors.apply(Q::Quadrature{1,T}, v::AbstractVector{T}, i) where T |
30 @inbounds q = apply(Q.H[1], v , I) | 30 @inbounds q = apply(Q.H[1], v , i) |
31 return q | 31 return q |
32 end | 32 end |
33 | 33 |
34 function LazyTensors.apply(Q::Quadrature{2,T}, v::AbstractArray{T,2}, I::Index, J::Index) where T | 34 function LazyTensors.apply(Q::Quadrature{2,T}, v::AbstractArray{T,2}, i, j) where T |
35 # Quadrature in x direction | 35 # Quadrature in x direction |
36 @inbounds vx = view(v, :, Int(J)) | 36 @inbounds vx = view(v, :, Int(j)) |
37 @inbounds qx = apply(Q.H[1], vx , I) | 37 @inbounds qx = apply(Q.H[1], vx , i) |
38 # Quadrature in y-direction | 38 # Quadrature in y-direction |
39 @inbounds vy = view(v, Int(I), :) | 39 @inbounds vy = view(v, Int(i), :) |
40 @inbounds qy = apply(Q.H[2], vy, J) | 40 @inbounds qy = apply(Q.H[2], vy, j) |
41 return qx*qy | 41 return qx*qy |
42 end | 42 end |
43 | 43 |
44 LazyTensors.apply_transpose(Q::Quadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Index,Dim}) where {Dim,T} = LazyTensors.apply(Q,v,I...) | 44 LazyTensors.apply_transpose(Q::Quadrature{Dim,T}, v::AbstractArray{T,Dim}, I::Vararg{Any,Dim}) where {Dim,T} = LazyTensors.apply(Q,v,I...) |