Mercurial > repos > public > sbplib_julia
diff src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl @ 906:33c7e266e1a9 feature/variable_derivatives
Add fix for type instability in SecondDerivativeVariable along with tests
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 15 Feb 2022 09:56:07 +0100 |
parents | 5bbc3ea3821b |
children | cad3a9f82009 |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl Tue Feb 15 08:08:19 2022 +0100 +++ b/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl Tue Feb 15 09:56:07 2022 +0100 @@ -30,14 +30,17 @@ Implements the one-dimensional second derivative with variable coefficients. """ -struct SecondDerivativeVariable{Dir,T,D,N,M,K,TArray<:AbstractArray} <: TensorMapping{T,D,D} - inner_stencil::NestedStencil{T,N} - closure_stencils::NTuple{M,NestedStencil{T,K}} +struct SecondDerivativeVariable{Dir,T,D,M,IStencil<:NestedStencil{T},CStencil<:NestedStencil{T},TArray<:AbstractArray} <: TensorMapping{T,D,D} + inner_stencil::IStencil + closure_stencils::NTuple{M,CStencil} size::NTuple{D,Int} coefficient::TArray - function SecondDerivativeVariable{Dir, D}(inner_stencil::NestedStencil{T,N}, closure_stencils::NTuple{M,NestedStencil{T,K}}, size::NTuple{D,Int}, coefficient::TArray) where {Dir,T,D,N,M,K,TArray<:AbstractArray} - return new{Dir,T,D,N,M,K,TArray}(inner_stencil,closure_stencils,size, coefficient) + function SecondDerivativeVariable{Dir, D}(inner_stencil::NestedStencil{T}, closure_stencils::NTuple{M,NestedStencil{T}}, size::NTuple{D,Int}, coefficient::AbstractArray) where {Dir,T,D,M} + IStencil = typeof(inner_stencil) + CStencil = eltype(closure_stencils) + TArray = typeof(coefficient) + return new{Dir,T,D,M,IStencil,CStencil,TArray}(inner_stencil,closure_stencils,size, coefficient) end end