diff SbpOperators/src/laplace/secondderivative.jl @ 328:9cc5d1498b2d

Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 24 Sep 2020 22:31:48 +0200
parents f2d6ec89dfc5
children
line wrap: on
line diff
--- a/SbpOperators/src/laplace/secondderivative.jl	Thu Sep 24 21:42:54 2020 +0200
+++ b/SbpOperators/src/laplace/secondderivative.jl	Thu Sep 24 22:31:48 2020 +0200
@@ -20,32 +20,26 @@
 #      I thought I::Vararg{Index,R} fell back to just Index for R = 1
 
 # Apply for different regions Lower/Interior/Upper or Unknown region
-@inline function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index{Lower}) where T
+function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index{Lower}) where T
     return @inbounds D2.h_inv*D2.h_inv*apply_stencil(D2.closureStencils[Int(I)], v, Int(I))
 end
 
-@inline function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index{Interior}) where T
+function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index{Interior}) where T
     return @inbounds D2.h_inv*D2.h_inv*apply_stencil(D2.innerStencil, v, Int(I))
 end
 
-@inline function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index{Upper}) where T
+function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index{Upper}) where T
     N = length(v) # TODO: Use domain_size here instead? N = domain_size(D2,size(v))
     return @inbounds D2.h_inv*D2.h_inv*Int(D2.parity)*apply_stencil_backwards(D2.closureStencils[N-Int(I)+1], v, Int(I))
 end
 
-@inline function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, index::Index{Unknown}) where T
+function LazyTensors.apply(D2::SecondDerivative{T}, v::AbstractVector{T}, index::Index{Unknown}) where T
     N = length(v)  # TODO: Use domain_size here instead?
     r = getregion(Int(index), closuresize(D2), N)
     I = Index(Int(index), r)
     return LazyTensors.apply(D2, v, I)
 end
 
-
-@inline function LazyTensors.apply_transpose(D2::SecondDerivative, v::AbstractVector, I::Index)
-    return LazyTensors.apply(D2, v, I)
-end
+LazyTensors.apply_transpose(D2::SecondDerivative{T}, v::AbstractVector{T}, I::Index) where {T} = LazyTensors.apply(D2, v, I)
 
-
-function closuresize(D2::SecondDerivative{T,N,M,K}) where {T<:Real,N,M,K}
-    return M
-end
+closuresize(D2::SecondDerivative{T,N,M,K}) where {T<:Real,N,M,K} = M