diff src/SbpOperators/constantstenciloperator.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 01b851161018
children 1a53eb83ed24
line wrap: on
line diff
--- a/src/SbpOperators/constantstenciloperator.jl	Thu Nov 26 21:35:34 2020 +0100
+++ b/src/SbpOperators/constantstenciloperator.jl	Fri Nov 27 11:27:37 2020 +0100
@@ -14,7 +14,7 @@
     return @inbounds h_inv*h_inv*Int(op.parity)*apply_stencil_backwards(op.closureStencils[N-Int(i)+1], v, Int(i))
 end
 
-@inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, index::Index{Unknown})
+@inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i)
     N = length(v)
     r = getregion(Int(index), closuresize(op), N)
     i = Index(Int(index), r)
@@ -26,9 +26,9 @@
 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Upper}, N::Integer) where T = v*h*op.quadratureClosure[N-Int(i)+1]
 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h
 
-function apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, index::Index{Unknown}, N::Integer) where T
-    r = getregion(Int(index), closuresize(op), N)
-    i = Index(Int(index), r)
+function apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i, N::Integer) where T
+    r = getregion(i, closuresize(op), N)
+    i = Index(i, r)
     return apply_quadrature(op, h, v, i, N)
 end
 export apply_quadrature
@@ -38,9 +38,9 @@
 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Upper}, N::Integer) where T = h_inv*v/op.quadratureClosure[N-Int(i)+1]
 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h_inv
 
-function apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, index::Index{Unknown}, N::Integer) where T
-    r = getregion(Int(index), closuresize(op), N)
-    i = Index(Int(index), r)
+function apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i, N::Integer) where T
+    r = getregion(i, closuresize(op), N)
+    i = Index(i, r)
     return apply_inverse_quadrature(op, h_inv, v, i, N)
 end