Mercurial > repos > public > sbplib_julia
changeset 543:1a53eb83ed24 refactor/tensor_index_coupling
Remove some unecessary Index types
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 27 Nov 2020 12:02:47 +0100 |
parents | 011ca1639153 |
children | 53828d3ed132 ace46ca8513f |
files | src/SbpOperators/constantstenciloperator.jl src/SbpOperators/laplace/secondderivative.jl src/SbpOperators/quadrature/diagonal_inner_product.jl |
diffstat | 3 files changed, 2 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/constantstenciloperator.jl Fri Nov 27 11:27:37 2020 +0100 +++ b/src/SbpOperators/constantstenciloperator.jl Fri Nov 27 12:02:47 2020 +0100 @@ -62,14 +62,14 @@ export apply_normal_derivative_transpose -function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i::Index, N::Integer, ::Type{Lower}) +function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i, N::Integer, ::Type{Lower}) @boundscheck if !(0<length(Int(i)) <= N) throw(BoundsError()) end h_inv*op.dClosure[Int(i)-1]*v end -function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i::Index, N::Integer, ::Type{Upper}) +function apply_normal_derivative(op::ConstantStencilOperator, h_inv::Real, v::Number, i, N::Integer, ::Type{Upper}) @boundscheck if !(0<length(Int(i)) <= N) throw(BoundsError()) end
--- a/src/SbpOperators/laplace/secondderivative.jl Fri Nov 27 11:27:37 2020 +0100 +++ b/src/SbpOperators/laplace/secondderivative.jl Fri Nov 27 12:02:47 2020 +0100 @@ -20,10 +20,6 @@ LazyTensors.range_size(D2::SecondDerivative) = D2.size LazyTensors.domain_size(D2::SecondDerivative) = D2.size -#TODO: The 1D tensor mappings should not have to dispatch on 1D tuples if we write LazyTensor.apply for vararg right?!?! -# Currently have to index the Tuple{Index} in each method in order to call the stencil methods which is ugly. -# I thought I::Vararg{Index,R} fell back to just Index for R = 1 - # Apply for different regions Lower/Interior/Upper or Unknown region 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))
--- a/src/SbpOperators/quadrature/diagonal_inner_product.jl Fri Nov 27 11:27:37 2020 +0100 +++ b/src/SbpOperators/quadrature/diagonal_inner_product.jl Fri Nov 27 12:02:47 2020 +0100 @@ -17,11 +17,6 @@ LazyTensors.range_size(H::DiagonalInnerProduct) = H.size LazyTensors.domain_size(H::DiagonalInnerProduct) = H.size -# Behövs den här? -function LazyTensors.apply(H::DiagonalInnerProduct{T}, v::AbstractVector{T}, I::Index) where T - return @inbounds apply(H, v, I) -end - function LazyTensors.apply(H::DiagonalInnerProduct{T}, v::AbstractVector{T}, I::Index{Lower}) where T return @inbounds H.h*H.quadratureClosure[Int(I)]*v[Int(I)] end