annotate test/testSbpOperators.jl @ 603:fbff4009c08a refactor/toml_operator_format

Add tests for parse_rational()
author Jonatan Werpers <jonatan@werpers.com>
date Sat, 05 Dec 2020 13:07:07 +0100
parents 03ef4d4740ab
children 8fcf9c9afb30
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
1 using Test
335
f4e3e71a4ff4 Fix `using` commands to refer to local modules within the Sbplib package/module
Jonatan Werpers <jonatan@werpers.com>
parents: 333
diff changeset
2 using Sbplib.SbpOperators
f4e3e71a4ff4 Fix `using` commands to refer to local modules within the Sbplib package/module
Jonatan Werpers <jonatan@werpers.com>
parents: 333
diff changeset
3 using Sbplib.Grids
f4e3e71a4ff4 Fix `using` commands to refer to local modules within the Sbplib package/module
Jonatan Werpers <jonatan@werpers.com>
parents: 333
diff changeset
4 using Sbplib.RegionIndices
f4e3e71a4ff4 Fix `using` commands to refer to local modules within the Sbplib package/module
Jonatan Werpers <jonatan@werpers.com>
parents: 333
diff changeset
5 using Sbplib.LazyTensors
395
737e597e0e6d Rewrite broken tests as testing that the norm is zero
Jonatan Werpers <jonatan@werpers.com>
parents: 389
diff changeset
6 using LinearAlgebra
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
7
338
2b0c9b30ea3b Add test sets for each submodule to make the test output nicer
Jonatan Werpers <jonatan@werpers.com>
parents: 335
diff changeset
8 @testset "SbpOperators" begin
2b0c9b30ea3b Add test sets for each submodule to make the test output nicer
Jonatan Werpers <jonatan@werpers.com>
parents: 335
diff changeset
9
584
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
10 @testset "Stencil" begin
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
11 s = SbpOperators.Stencil((-2,2), (1.,2.,2.,3.,4.))
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
12 @test s isa SbpOperators.Stencil{Float64, 5}
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
13
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
14 @test eltype(s) == Float64
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
15 @test SbpOperators.scale(s, 2) == SbpOperators.Stencil((-2,2), (2.,4.,4.,6.,8.))
595
03ef4d4740ab Add a constructor for Stencil where you can specify the center of the stencil
Jonatan Werpers <jonatan@werpers.com>
parents: 594
diff changeset
16
03ef4d4740ab Add a constructor for Stencil where you can specify the center of the stencil
Jonatan Werpers <jonatan@werpers.com>
parents: 594
diff changeset
17 @test SbpOperators.Stencil((1,2,3,4), center=1) == SbpOperators.Stencil((0, 3),(1,2,3,4))
03ef4d4740ab Add a constructor for Stencil where you can specify the center of the stencil
Jonatan Werpers <jonatan@werpers.com>
parents: 594
diff changeset
18 @test SbpOperators.Stencil((1,2,3,4), center=2) == SbpOperators.Stencil((-1, 2),(1,2,3,4))
03ef4d4740ab Add a constructor for Stencil where you can specify the center of the stencil
Jonatan Werpers <jonatan@werpers.com>
parents: 594
diff changeset
19 @test SbpOperators.Stencil((1,2,3,4), center=4) == SbpOperators.Stencil((-3, 0),(1,2,3,4))
584
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
20 end
4aa7fe13a984 Add scale() and eltype() methods for stencils
Jonatan Werpers <jonatan@werpers.com>
parents: 397
diff changeset
21
603
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
22 @testset "parse_rational" begin
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
23 @test SbpOperators.parse_rational("1") isa Rational
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
24 @test SbpOperators.parse_rational("1") == 1//1
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
25 @test SbpOperators.parse_rational("1/2") isa Rational
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
26 @test SbpOperators.parse_rational("1/2") == 1//2
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
27 @test SbpOperators.parse_rational("37/13") isa Rational
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
28 @test SbpOperators.parse_rational("37/13") == 37//13
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
29 end
fbff4009c08a Add tests for parse_rational()
Jonatan Werpers <jonatan@werpers.com>
parents: 595
diff changeset
30
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
31 # @testset "apply_quadrature" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
32 # op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
33 # h = 0.5
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
34 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
35 # @test apply_quadrature(op, h, 1.0, 10, 100) == h
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
36 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
37 # N = 10
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
38 # qc = op.quadratureClosure
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
39 # q = h.*(qc..., ones(N-2*closuresize(op))..., reverse(qc)...)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
40 # @assert length(q) == N
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
41 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
42 # for i ∈ 1:N
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
43 # @test apply_quadrature(op, h, 1.0, i, N) == q[i]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
44 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
45 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
46 # v = [2.,3.,2.,4.,5.,4.,3.,4.,5.,4.5]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
47 # for i ∈ 1:N
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
48 # @test apply_quadrature(op, h, v[i], i, N) == q[i]*v[i]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
49 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
50 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
51
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
52 @testset "SecondDerivative" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
53 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
54 L = 3.5
388
5223872485cd Clean up grid creation
Jonatan Werpers <jonatan@werpers.com>
parents: 387
diff changeset
55 g = EquidistantGrid(101, 0.0, L)
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
56 Dₓₓ = SecondDerivative(g,op.innerStencil,op.closureStencils)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
57
396
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
58 f0(x) = 1.
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
59 f1(x) = x
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
60 f2(x) = 1/2*x^2
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
61 f3(x) = 1/6*x^3
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
62 f4(x) = 1/24*x^4
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
63 f5(x) = sin(x)
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
64 f5ₓₓ(x) = -f5(x)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
65
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
66 v0 = evalOn(g,f0)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
67 v1 = evalOn(g,f1)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
68 v2 = evalOn(g,f2)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
69 v3 = evalOn(g,f3)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
70 v4 = evalOn(g,f4)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
71 v5 = evalOn(g,f5)
219
69a6049e14d9 Create package SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
72
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
73 @test Dₓₓ isa TensorMapping{T,1,1} where T
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
74 @test Dₓₓ' isa TensorMapping{T,1,1} where T
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
75
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
76 # 4th order interior stencil, 2nd order boundary stencil,
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
77 # implies that L*v should be exact for v - monomial up to order 3.
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
78 # Exact differentiation is measured point-wise. For other grid functions
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
79 # the error is measured in the l2-norm.
395
737e597e0e6d Rewrite broken tests as testing that the norm is zero
Jonatan Werpers <jonatan@werpers.com>
parents: 389
diff changeset
80 @test norm(Dₓₓ*v0) ≈ 0.0 atol=5e-10
737e597e0e6d Rewrite broken tests as testing that the norm is zero
Jonatan Werpers <jonatan@werpers.com>
parents: 389
diff changeset
81 @test norm(Dₓₓ*v1) ≈ 0.0 atol=5e-10
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
82 @test Dₓₓ*v2 ≈ v0 atol=5e-11
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
83 @test Dₓₓ*v3 ≈ v1 atol=5e-11
388
5223872485cd Clean up grid creation
Jonatan Werpers <jonatan@werpers.com>
parents: 387
diff changeset
84
5223872485cd Clean up grid creation
Jonatan Werpers <jonatan@werpers.com>
parents: 387
diff changeset
85 h = spacing(g)[1];
389
0433ab553d13 Rewrite l2 norm comparison to use the norm key word of isapprox
Jonatan Werpers <jonatan@werpers.com>
parents: 388
diff changeset
86 l2(v) = sqrt(h*sum(v.^2))
0433ab553d13 Rewrite l2 norm comparison to use the norm key word of isapprox
Jonatan Werpers <jonatan@werpers.com>
parents: 388
diff changeset
87 @test Dₓₓ*v4 ≈ v2 atol=5e-4 norm=l2
0433ab553d13 Rewrite l2 norm comparison to use the norm key word of isapprox
Jonatan Werpers <jonatan@werpers.com>
parents: 388
diff changeset
88 @test Dₓₓ*v5 ≈ -v5 atol=5e-4 norm=l2
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
89 end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
90
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
91
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
92 @testset "Laplace2D" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
93 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
94 Lx = 1.5
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
95 Ly = 3.2
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
96 g = EquidistantGrid((102,131), (0.0, 0.0), (Lx,Ly))
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
97 L = Laplace(g, op.innerStencil, op.closureStencils)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
98
254
4ca3794fffef Add apply_quadrature to SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents: 219
diff changeset
99
396
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
100 f0(x,y) = 2.
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
101 f1(x,y) = x+y
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
102 f2(x,y) = 1/2*x^2 + 1/2*y^2
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
103 f3(x,y) = 1/6*x^3 + 1/6*y^3
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
104 f4(x,y) = 1/24*x^4 + 1/24*y^4
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
105 f5(x,y) = sin(x) + cos(y)
9aff09ca0052 Remove some type annotations
Jonatan Werpers <jonatan@werpers.com>
parents: 395
diff changeset
106 f5ₓₓ(x,y) = -f5(x,y)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
107
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
108 v0 = evalOn(g,f0)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
109 v1 = evalOn(g,f1)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
110 v2 = evalOn(g,f2)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
111 v3 = evalOn(g,f3)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
112 v4 = evalOn(g,f4)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
113 v5 = evalOn(g,f5)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
114 v5ₓₓ = evalOn(g,f5ₓₓ)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
115
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
116 @test L isa TensorMapping{T,2,2} where T
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
117 @test L' isa TensorMapping{T,2,2} where T
254
4ca3794fffef Add apply_quadrature to SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents: 219
diff changeset
118
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
119 # 4th order interior stencil, 2nd order boundary stencil,
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
120 # implies that L*v should be exact for v - monomial up to order 3.
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
121 # Exact differentiation is measured point-wise. For other grid functions
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
122 # the error is measured in the H-norm.
395
737e597e0e6d Rewrite broken tests as testing that the norm is zero
Jonatan Werpers <jonatan@werpers.com>
parents: 389
diff changeset
123 @test norm(L*v0) ≈ 0 atol=5e-10
737e597e0e6d Rewrite broken tests as testing that the norm is zero
Jonatan Werpers <jonatan@werpers.com>
parents: 389
diff changeset
124 @test norm(L*v1) ≈ 0 atol=5e-10
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
125 @test L*v2 ≈ v0 # Seems to be more accurate
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
126 @test L*v3 ≈ v1 atol=5e-10
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
127
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
128 h = spacing(g)
389
0433ab553d13 Rewrite l2 norm comparison to use the norm key word of isapprox
Jonatan Werpers <jonatan@werpers.com>
parents: 388
diff changeset
129 l2(v) = sqrt(prod(h)*sum(v.^2))
0433ab553d13 Rewrite l2 norm comparison to use the norm key word of isapprox
Jonatan Werpers <jonatan@werpers.com>
parents: 388
diff changeset
130 @test L*v4 ≈ v2 atol=5e-4 norm=l2
0433ab553d13 Rewrite l2 norm comparison to use the norm key word of isapprox
Jonatan Werpers <jonatan@werpers.com>
parents: 388
diff changeset
131 @test L*v5 ≈ v5ₓₓ atol=5e-4 norm=l2
254
4ca3794fffef Add apply_quadrature to SbpOperators
Jonatan Werpers <jonatan@werpers.com>
parents: 219
diff changeset
132 end
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
133
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
134 @testset "DiagonalInnerProduct" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
135 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
136 L = 2.3
388
5223872485cd Clean up grid creation
Jonatan Werpers <jonatan@werpers.com>
parents: 387
diff changeset
137 g = EquidistantGrid(77, 0.0, L)
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
138 H = DiagonalInnerProduct(g,op.quadratureClosure)
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
139 v = ones(Float64, size(g))
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
140
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
141 @test H isa TensorMapping{T,1,1} where T
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
142 @test H' isa TensorMapping{T,1,1} where T
383
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
143 @test sum(H*v) ≈ L
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
144 @test H*v == H'*v
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
145 end
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
146
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
147 @testset "Quadrature" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
148 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
149 Lx = 2.3
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
150 Ly = 5.2
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
151 g = EquidistantGrid((77,66), (0.0, 0.0), (Lx,Ly))
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
152
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
153 Q = Quadrature(g, op.quadratureClosure)
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
154
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
155 @test Q isa TensorMapping{T,2,2} where T
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
156 @test Q' isa TensorMapping{T,2,2} where T
382
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
157
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
158 v = ones(Float64, size(g))
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
159 @test sum(Q*v) ≈ Lx*Ly
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
160
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
161 v = 2*ones(Float64, size(g))
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
162 @test_broken sum(Q*v) ≈ 2*Lx*Ly
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
163
5c10cd0ed1fe testSbpOperators.jl: Add a test for Quadrature and mark some tests broken
Jonatan Werpers <jonatan@werpers.com>
parents: 379
diff changeset
164 @test Q*v == Q'*v
328
9cc5d1498b2d Refactor 1D diagonal inner product in quadrature.jl to separate file. Write tests for quadratures. Clean up laplace and secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 314
diff changeset
165 end
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
166
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
167 @testset "InverseDiagonalInnerProduct" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
168 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
169 L = 2.3
388
5223872485cd Clean up grid creation
Jonatan Werpers <jonatan@werpers.com>
parents: 387
diff changeset
170 g = EquidistantGrid(77, 0.0, L)
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
171 H = DiagonalInnerProduct(g, op.quadratureClosure)
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
172 Hi = InverseDiagonalInnerProduct(g,op.quadratureClosure)
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
173 v = evalOn(g, x->sin(x))
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
174
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
175 @test Hi isa TensorMapping{T,1,1} where T
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
176 @test Hi' isa TensorMapping{T,1,1} where T
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
177 @test Hi*H*v ≈ v
383
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
178 @test Hi*v == Hi'*v
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
179 end
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
180
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
181 @testset "InverseQuadrature" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
182 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
183 Lx = 7.3
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
184 Ly = 8.2
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
185 g = EquidistantGrid((77,66), (0.0, 0.0), (Lx,Ly))
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
186
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
187 Q = Quadrature(g, op.quadratureClosure)
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
188 Qinv = InverseQuadrature(g, op.quadratureClosure)
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
189 v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y)
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
190
356
0844069ab5ff Reinclude SbpOperators and fix most of the code and tests there.
Jonatan Werpers <jonatan@werpers.com>
parents: 338
diff changeset
191 @test Qinv isa TensorMapping{T,2,2} where T
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
192 @test Qinv' isa TensorMapping{T,2,2} where T
383
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
193 @test_broken Qinv*(Q*v) ≈ v
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
194 @test Qinv*v == Qinv'*v
329
408c37b295c2 Refactor 1D tensor mapping in inverse quadrature to separate file, InverseDiagonalNorm. Add tests
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 328
diff changeset
195 end
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
196
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
197 @testset "BoundaryRestrictrion" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
198 op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
568
34d9e10f0001 Make grid larger in test to make sure there all kinds of regions are represented
Jonatan Werpers <jonatan@werpers.com>
parents: 567
diff changeset
199 g_1D = EquidistantGrid(11, 0.0, 1.0)
34d9e10f0001 Make grid larger in test to make sure there all kinds of regions are represented
Jonatan Werpers <jonatan@werpers.com>
parents: 567
diff changeset
200 g_2D = EquidistantGrid((11,15), (0.0, 0.0), (1.0,1.0))
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
201
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
202 @testset "Constructors" begin
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
203 @testset "1D" begin
580
0779713f95a2 Add constructor that infers T and N
Jonatan Werpers <jonatan@werpers.com>
parents: 578
diff changeset
204 e_l = BoundaryRestriction{Lower}(op.eClosure,size(g_1D)[1])
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
205 @test e_l == BoundaryRestriction(g_1D,op.eClosure,Lower())
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
206 @test e_l == boundary_restriction(g_1D,op.eClosure,CartesianBoundary{1,Lower}())
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
207 @test e_l isa TensorMapping{T,0,1} where T
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
208
580
0779713f95a2 Add constructor that infers T and N
Jonatan Werpers <jonatan@werpers.com>
parents: 578
diff changeset
209 e_r = BoundaryRestriction{Upper}(op.eClosure,size(g_1D)[1])
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
210 @test e_r == BoundaryRestriction(g_1D,op.eClosure,Upper())
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
211 @test e_r == boundary_restriction(g_1D,op.eClosure,CartesianBoundary{1,Upper}())
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
212 @test e_r isa TensorMapping{T,0,1} where T
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
213 end
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
214
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
215 @testset "2D" begin
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
216 e_w = boundary_restriction(g_2D,op.eClosure,CartesianBoundary{1,Upper}())
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
217 @test e_w isa InflatedTensorMapping
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
218 @test e_w isa TensorMapping{T,1,2} where T
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
219 end
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
220 end
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
221
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
222 e_l = boundary_restriction(g_1D, op.eClosure, CartesianBoundary{1,Lower}())
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
223 e_r = boundary_restriction(g_1D, op.eClosure, CartesianBoundary{1,Upper}())
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
224
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
225 e_w = boundary_restriction(g_2D, op.eClosure, CartesianBoundary{1,Lower}())
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
226 e_e = boundary_restriction(g_2D, op.eClosure, CartesianBoundary{1,Upper}())
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
227 e_s = boundary_restriction(g_2D, op.eClosure, CartesianBoundary{2,Lower}())
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
228 e_n = boundary_restriction(g_2D, op.eClosure, CartesianBoundary{2,Upper}())
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
229
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
230 @testset "Sizes" begin
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
231 @testset "1D" begin
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
232 @test domain_size(e_l) == (11,)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
233 @test domain_size(e_r) == (11,)
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
234
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
235 @test range_size(e_l) == ()
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
236 @test range_size(e_r) == ()
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
237 end
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
238
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
239 @testset "2D" begin
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
240 @test domain_size(e_w) == (11,15)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
241 @test domain_size(e_e) == (11,15)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
242 @test domain_size(e_s) == (11,15)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
243 @test domain_size(e_n) == (11,15)
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
244
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
245 @test range_size(e_w) == (15,)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
246 @test range_size(e_e) == (15,)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
247 @test range_size(e_s) == (11,)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
248 @test range_size(e_n) == (11,)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
249 end
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
250 end
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
251
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
252
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
253 @testset "Application" begin
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
254 @testset "1D" begin
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
255 v = evalOn(g_1D,x->1+x^2)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
256 u = fill(3.124)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
257 @test (e_l*v)[] == v[1]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
258 @test (e_r*v)[] == v[end]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
259 @test (e_r*v)[1] == v[end]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
260 @test e_l'*u == [u[]; zeros(10)]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
261 @test e_r'*u == [zeros(10); u[]]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
262 end
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
263
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
264 @testset "2D" begin
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
265 v = rand(11, 15)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
266 u = fill(3.124)
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
267
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
268 @test e_w*v == v[1,:]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
269 @test e_e*v == v[end,:]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
270 @test e_s*v == v[:,1]
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
271 @test e_n*v == v[:,end]
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
272
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
273
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
274 g_x = rand(11)
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
275 g_y = rand(15)
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
276
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
277 G_w = zeros(Float64, (11,15))
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
278 G_w[1,:] = g_y
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
279
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
280 G_e = zeros(Float64, (11,15))
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
281 G_e[end,:] = g_y
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
282
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
283 G_s = zeros(Float64, (11,15))
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
284 G_s[:,1] = g_x
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
285
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
286 G_n = zeros(Float64, (11,15))
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
287 G_n[:,end] = g_x
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
288
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
289 @test e_w'*g_y == G_w
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
290 @test e_e'*g_y == G_e
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
291 @test e_s'*g_x == G_s
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
292 @test e_n'*g_x == G_n
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
293 end
573
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
294
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
295 @testset "Regions" begin
576
1d4417ced79f Put test sets around 1d and 2d tests
Jonatan Werpers <jonatan@werpers.com>
parents: 575
diff changeset
296 u = fill(3.124)
573
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
297 @test (e_l'*u)[Index(1,Lower)] == 3.124
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
298 @test (e_l'*u)[Index(2,Lower)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
299 @test (e_l'*u)[Index(6,Interior)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
300 @test (e_l'*u)[Index(10,Upper)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
301 @test (e_l'*u)[Index(11,Upper)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
302
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
303 @test (e_r'*u)[Index(1,Lower)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
304 @test (e_r'*u)[Index(2,Lower)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
305 @test (e_r'*u)[Index(6,Interior)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
306 @test (e_r'*u)[Index(10,Upper)] == 0
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
307 @test (e_r'*u)[Index(11,Upper)] == 3.124
4e2490f568aa Add tests for apply_transpose and different regions
Jonatan Werpers <jonatan@werpers.com>
parents: 572
diff changeset
308 end
544
884be64e82d9 Add test case illustrating issue in split_index for region indices.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 519
diff changeset
309 end
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
310
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
311 @testset "Inferred" begin
568
34d9e10f0001 Make grid larger in test to make sure there all kinds of regions are represented
Jonatan Werpers <jonatan@werpers.com>
parents: 567
diff changeset
312 v = ones(Float64, 11)
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
313 u = fill(1.)
575
5691606851d8 Simplify and extend tests for type inferenca
Jonatan Werpers <jonatan@werpers.com>
parents: 574
diff changeset
314
578
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
315 @inferred apply(e_l, v)
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
316 @inferred apply(e_r, v)
575
5691606851d8 Simplify and extend tests for type inferenca
Jonatan Werpers <jonatan@werpers.com>
parents: 574
diff changeset
317
578
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
318 @inferred apply_transpose(e_l, u, 4)
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
319 @inferred apply_transpose(e_l, u, Index(1,Lower))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
320 @inferred apply_transpose(e_l, u, Index(2,Lower))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
321 @inferred apply_transpose(e_l, u, Index(6,Interior))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
322 @inferred apply_transpose(e_l, u, Index(10,Upper))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
323 @inferred apply_transpose(e_l, u, Index(11,Upper))
575
5691606851d8 Simplify and extend tests for type inferenca
Jonatan Werpers <jonatan@werpers.com>
parents: 574
diff changeset
324
578
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
325 @inferred apply_transpose(e_r, u, 4)
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
326 @inferred apply_transpose(e_r, u, Index(1,Lower))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
327 @inferred apply_transpose(e_r, u, Index(2,Lower))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
328 @inferred apply_transpose(e_r, u, Index(6,Interior))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
329 @inferred apply_transpose(e_r, u, Index(10,Upper))
b24b910a9025 Change inference test to be more explicit about what methods are tested
Jonatan Werpers <jonatan@werpers.com>
parents: 576
diff changeset
330 @inferred apply_transpose(e_r, u, Index(11,Upper))
565
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
331 end
15423a868d28 Restructure and extend tests for BoundaryRestriction
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 562
diff changeset
332
513
547639572208 Get some kind of tested working implementation.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 397
diff changeset
333 end
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
334 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
335 # @testset "NormalDerivative" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
336 # op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
337 # g = EquidistantGrid((5,6), (0.0, 0.0), (4.0,5.0))
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
338 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
339 # d_w = NormalDerivative(op, g, CartesianBoundary{1,Lower}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
340 # d_e = NormalDerivative(op, g, CartesianBoundary{1,Upper}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
341 # d_s = NormalDerivative(op, g, CartesianBoundary{2,Lower}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
342 # d_n = NormalDerivative(op, g, CartesianBoundary{2,Upper}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
343 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
344 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
345 # v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
346 # v∂x = evalOn(g, (x,y)-> 2*x + y)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
347 # v∂y = evalOn(g, (x,y)-> 2*(y-1) + x)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
348 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
349 # @test d_w isa TensorMapping{T,2,1} where T
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
350 # @test d_w' isa TensorMapping{T,1,2} where T
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
351 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
352 # @test domain_size(d_w, (3,2)) == (2,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
353 # @test domain_size(d_e, (3,2)) == (2,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
354 # @test domain_size(d_s, (3,2)) == (3,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
355 # @test domain_size(d_n, (3,2)) == (3,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
356 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
357 # @test size(d_w'*v) == (6,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
358 # @test size(d_e'*v) == (6,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
359 # @test size(d_s'*v) == (5,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
360 # @test size(d_n'*v) == (5,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
361 #
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
362 # @test d_w'*v .≈ v∂x[1,:]
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
363 # @test d_e'*v .≈ v∂x[5,:]
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
364 # @test d_s'*v .≈ v∂y[:,1]
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
365 # @test d_n'*v .≈ v∂y[:,6]
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
366 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
367 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
368 # d_x_l = zeros(Float64, 5)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
369 # d_x_u = zeros(Float64, 5)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
370 # for i ∈ eachindex(d_x_l)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
371 # d_x_l[i] = op.dClosure[i-1]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
372 # d_x_u[i] = -op.dClosure[length(d_x_u)-i]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
373 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
374 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
375 # d_y_l = zeros(Float64, 6)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
376 # d_y_u = zeros(Float64, 6)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
377 # for i ∈ eachindex(d_y_l)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
378 # d_y_l[i] = op.dClosure[i-1]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
379 # d_y_u[i] = -op.dClosure[length(d_y_u)-i]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
380 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
381 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
382 # function prod_matrix(x,y)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
383 # G = zeros(Float64, length(x), length(y))
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
384 # for I ∈ CartesianIndices(G)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
385 # G[I] = x[I[1]]*y[I[2]]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
386 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
387 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
388 # return G
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
389 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
390 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
391 # g_x = [1,2,3,4.0,5]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
392 # g_y = [5,4,3,2,1.0,11]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
393 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
394 # G_w = prod_matrix(d_x_l, g_y)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
395 # G_e = prod_matrix(d_x_u, g_y)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
396 # G_s = prod_matrix(g_x, d_y_l)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
397 # G_n = prod_matrix(g_x, d_y_u)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
398 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
399 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
400 # @test size(d_w*g_y) == (UnknownDim,6)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
401 # @test size(d_e*g_y) == (UnknownDim,6)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
402 # @test size(d_s*g_x) == (5,UnknownDim)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
403 # @test size(d_n*g_x) == (5,UnknownDim)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
404 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
405 # # These tests should be moved to where they are possible (i.e we know what the grid should be)
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
406 # @test_broken d_w*g_y .≈ G_w
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
407 # @test_broken d_e*g_y .≈ G_e
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
408 # @test_broken d_s*g_x .≈ G_s
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
409 # @test_broken d_n*g_x .≈ G_n
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
410 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
411 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
412 # @testset "BoundaryQuadrature" begin
594
cc86b920531a Change the readoperator function to use the .toml format
Jonatan Werpers <jonatan@werpers.com>
parents: 586
diff changeset
413 # op = read_D2_operator(sbp_operators_path()*"standard_diagonal.toml"; order=4)
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
414 # g = EquidistantGrid((10,11), (0.0, 0.0), (1.0,1.0))
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
415 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
416 # H_w = BoundaryQuadrature(op, g, CartesianBoundary{1,Lower}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
417 # H_e = BoundaryQuadrature(op, g, CartesianBoundary{1,Upper}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
418 # H_s = BoundaryQuadrature(op, g, CartesianBoundary{2,Lower}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
419 # H_n = BoundaryQuadrature(op, g, CartesianBoundary{2,Upper}())
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
420 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
421 # v = evalOn(g, (x,y)-> x^2 + (y-1)^2 + x*y)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
422 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
423 # function get_quadrature(N)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
424 # qc = op.quadratureClosure
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
425 # q = (qc..., ones(N-2*closuresize(op))..., reverse(qc)...)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
426 # @assert length(q) == N
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
427 # return q
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
428 # end
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
429 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
430 # v_w = v[1,:]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
431 # v_e = v[10,:]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
432 # v_s = v[:,1]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
433 # v_n = v[:,11]
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
434 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
435 # q_x = spacing(g)[1].*get_quadrature(10)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
436 # q_y = spacing(g)[2].*get_quadrature(11)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
437 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
438 # @test H_w isa TensorOperator{T,1} where T
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
439 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
440 # @test domain_size(H_w, (3,)) == (3,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
441 # @test domain_size(H_n, (3,)) == (3,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
442 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
443 # @test range_size(H_w, (3,)) == (3,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
444 # @test range_size(H_n, (3,)) == (3,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
445 #
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
446 # @test size(H_w*v_w) == (11,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
447 # @test size(H_e*v_e) == (11,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
448 # @test size(H_s*v_s) == (10,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
449 # @test size(H_n*v_n) == (10,)
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
450 #
387
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
451 # @test H_w*v_w .≈ q_y.*v_w
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
452 # @test H_e*v_e .≈ q_y.*v_e
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
453 # @test H_s*v_s .≈ q_x.*v_s
4686c3509b54 Switch to using isapprox operator
Jonatan Werpers <jonatan@werpers.com>
parents: 385
diff changeset
454 # @test H_n*v_n .≈ q_x.*v_n
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
455 #
383
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
456 # @test H_w'*v_w == H_w'*v_w
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
457 # @test H_e'*v_e == H_e'*v_e
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
458 # @test H_s'*v_s == H_s'*v_s
aaf8e331cb80 Remove collects around TensorMappingApplications
Jonatan Werpers <jonatan@werpers.com>
parents: 382
diff changeset
459 # @test H_n'*v_n == H_n'*v_n
314
accb0876da12 Move tests for Laplace from DiffOps/test to SbpOperators/test and add test for Secondderivative
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents: 254
diff changeset
460 # end
338
2b0c9b30ea3b Add test sets for each submodule to make the test output nicer
Jonatan Werpers <jonatan@werpers.com>
parents: 335
diff changeset
461
2b0c9b30ea3b Add test sets for each submodule to make the test output nicer
Jonatan Werpers <jonatan@werpers.com>
parents: 335
diff changeset
462 end