Mercurial > repos > public > sbplib_julia
changeset 1030:8fe630a20b64 feature/dissipation_operators
Allow differnt size stencils in the two closures
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 22 Mar 2022 09:53:26 +0100 |
parents | 129262c8e897 |
children | 0905cec43d2e |
files | src/SbpOperators/volumeops/stencil_operator_distinct_closures.jl test/SbpOperators/volumeops/stencil_operator_distinct_closures_test.jl |
diffstat | 2 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/stencil_operator_distinct_closures.jl Tue Mar 22 09:26:05 2022 +0100 +++ b/src/SbpOperators/volumeops/stencil_operator_distinct_closures.jl Tue Mar 22 09:53:26 2022 +0100 @@ -16,10 +16,10 @@ See also: [`VolumeOperator`](@ref) """ -struct StencilOperatorDistinctClosures{T,K,N,M,L} <: LazyTensor{T,1,1} +struct StencilOperatorDistinctClosures{T,K,N,M,LC<:NTuple{N,Stencil{T,L}} where L, UC<:NTuple{M,Stencil{T,L}} where L} <: LazyTensor{T,1,1} inner_stencil::Stencil{T,K} - lower_closure::NTuple{N,Stencil{T,L}} - upper_closure::NTuple{M,Stencil{T,L}} + lower_closure::LC + upper_closure::UC size::Tuple{Int} end
--- a/test/SbpOperators/volumeops/stencil_operator_distinct_closures_test.jl Tue Mar 22 09:26:05 2022 +0100 +++ b/test/SbpOperators/volumeops/stencil_operator_distinct_closures_test.jl Tue Mar 22 09:53:26 2022 +0100 @@ -43,16 +43,16 @@ g = EquidistantGrid(11, 0., 1.) lower_closure = ( - Stencil(-1,1,0, center=1), - Stencil(-2,2,0, center=2), + Stencil(-1,1, center=1), + Stencil(-2,2, center=2), ) inner_stencil = Stencil(-3,3, center=1) upper_closure = ( Stencil(4,-4,4, center=1), - Stencil(0,-5,5, center=2), - Stencil(0,-6,6, center=3), + Stencil(5,-5,5, center=2), + Stencil(6,-6,6, center=3), ) A = StencilOperatorDistinctClosures(g, inner_stencil, lower_closure, upper_closure) @@ -77,7 +77,7 @@ # Upper closure @test LazyTensors.apply(A, v, 9) ≈ 4*(v[9] - v[10] + v[11]) - @test LazyTensors.apply(A, v, 10) ≈ 5*( - v[10] + v[11]) - @test LazyTensors.apply(A, v, 11) ≈ 6*( - v[10] + v[11]) + @test LazyTensors.apply(A, v, 10) ≈ 5*(v[9] - v[10] + v[11]) + @test LazyTensors.apply(A, v, 11) ≈ 6*(v[9] - v[10] + v[11]) end end