changeset 891:f72cc96a58c6 feature/variable_derivatives

Add some size tests
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 08 Feb 2022 10:58:31 +0100
parents eb03bda76bae
children 06c510d40ebb
files src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl test/SbpOperators/volumeops/derivatives/second_derivative_variable_test.jl
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl	Tue Feb 08 10:58:14 2022 +0100
+++ b/src/SbpOperators/volumeops/derivatives/second_derivative_variable.jl	Tue Feb 08 10:58:31 2022 +0100
@@ -51,7 +51,7 @@
 
 derivative_direction(::SecondDerivativeVariable{Dir}) where {Dir} = Dir
 
-closure_size(::SecondDerivativeVariable{T,N,M}) where {T,N,M} = M
+closure_size(op::SecondDerivativeVariable) = length(op.closure_stencils)
 
 LazyTensors.range_size(op::SecondDerivativeVariable) = op.size
 LazyTensors.domain_size(op::SecondDerivativeVariable) = op.size
--- a/test/SbpOperators/volumeops/derivatives/second_derivative_variable_test.jl	Tue Feb 08 10:58:14 2022 +0100
+++ b/test/SbpOperators/volumeops/derivatives/second_derivative_variable_test.jl	Tue Feb 08 10:58:31 2022 +0100
@@ -51,9 +51,19 @@
         c = evalOn(g, (x,y)->x+y)
         @testset "Constructors" begin
             @test SecondDerivativeVariable(g, c, interior_stencil, closure_stencils,1) isa TensorMapping
+            @test SecondDerivativeVariable(g, c, interior_stencil, closure_stencils,2) isa TensorMapping
         end
 
         @testset "sizes" begin
+            D₂ᶜ = SecondDerivativeVariable(g, c, interior_stencil, closure_stencils,1)
+            @test range_size(D₂ᶜ) == (11,9)
+            @test domain_size(D₂ᶜ) == (11,9)
+            @test closure_size(D₂ᶜ) == 1
+
+            D₂ᶜ = SecondDerivativeVariable(g, c, interior_stencil, closure_stencils,2)
+            @test range_size(D₂ᶜ) == (11,9)
+            @test domain_size(D₂ᶜ) == (11,9)
+            @test closure_size(D₂ᶜ) == 1
         end
 
         @testset "application" begin