Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
541:62d96e2cd165 | 542:011ca1639153 |
---|---|
12 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Upper}) | 12 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i::Index{Upper}) |
13 N = length(v) | 13 N = length(v) |
14 return @inbounds h_inv*h_inv*Int(op.parity)*apply_stencil_backwards(op.closureStencils[N-Int(i)+1], v, Int(i)) | 14 return @inbounds h_inv*h_inv*Int(op.parity)*apply_stencil_backwards(op.closureStencils[N-Int(i)+1], v, Int(i)) |
15 end | 15 end |
16 | 16 |
17 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, index::Index{Unknown}) | 17 @inline function apply_2nd_derivative(op::ConstantStencilOperator, h_inv::Real, v::AbstractVector, i) |
18 N = length(v) | 18 N = length(v) |
19 r = getregion(Int(index), closuresize(op), N) | 19 r = getregion(Int(index), closuresize(op), N) |
20 i = Index(Int(index), r) | 20 i = Index(Int(index), r) |
21 return apply_2nd_derivative(op, h_inv, v, i) | 21 return apply_2nd_derivative(op, h_inv, v, i) |
22 end | 22 end |
24 | 24 |
25 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Lower}, N::Integer) where T = v*h*op.quadratureClosure[Int(i)] | 25 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Lower}, N::Integer) where T = v*h*op.quadratureClosure[Int(i)] |
26 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Upper}, N::Integer) where T = v*h*op.quadratureClosure[N-Int(i)+1] | 26 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Upper}, N::Integer) where T = v*h*op.quadratureClosure[N-Int(i)+1] |
27 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h | 27 apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h |
28 | 28 |
29 function apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, index::Index{Unknown}, N::Integer) where T | 29 function apply_quadrature(op::ConstantStencilOperator, h::Real, v::T, i, N::Integer) where T |
30 r = getregion(Int(index), closuresize(op), N) | 30 r = getregion(i, closuresize(op), N) |
31 i = Index(Int(index), r) | 31 i = Index(i, r) |
32 return apply_quadrature(op, h, v, i, N) | 32 return apply_quadrature(op, h, v, i, N) |
33 end | 33 end |
34 export apply_quadrature | 34 export apply_quadrature |
35 | 35 |
36 # TODO: Evaluate if divisions affect performance | 36 # TODO: Evaluate if divisions affect performance |
37 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Lower}, N::Integer) where T = h_inv*v/op.quadratureClosure[Int(i)] | 37 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Lower}, N::Integer) where T = h_inv*v/op.quadratureClosure[Int(i)] |
38 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] | 38 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] |
39 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h_inv | 39 apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i::Index{Interior}, N::Integer) where T = v*h_inv |
40 | 40 |
41 function apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, index::Index{Unknown}, N::Integer) where T | 41 function apply_inverse_quadrature(op::ConstantStencilOperator, h_inv::Real, v::T, i, N::Integer) where T |
42 r = getregion(Int(index), closuresize(op), N) | 42 r = getregion(i, closuresize(op), N) |
43 i = Index(Int(index), r) | 43 i = Index(i, r) |
44 return apply_inverse_quadrature(op, h_inv, v, i, N) | 44 return apply_inverse_quadrature(op, h_inv, v, i, N) |
45 end | 45 end |
46 | 46 |
47 export apply_inverse_quadrature | 47 export apply_inverse_quadrature |
48 | 48 |