Mercurial > repos > public > sbplib_julia
comparison test/testSbpOperators.jl @ 515:d55008f5e2f3 feature/boundary_ops
Fix the range of the BoundaryRestriction tensor mapping (the range is zero for the 1D operator). Add some documentation and todos.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Tue, 24 Nov 2020 15:28:10 +0100 |
parents | 14e722e8607d |
children | 2edacece1637 |
comparison
equal
deleted
inserted
replaced
514:14e722e8607d | 515:d55008f5e2f3 |
---|---|
180 | 180 |
181 e_l = BoundaryRestriction(g,op.eClosure,Lower()) | 181 e_l = BoundaryRestriction(g,op.eClosure,Lower()) |
182 e_r = BoundaryRestriction(g,op.eClosure,Upper()) | 182 e_r = BoundaryRestriction(g,op.eClosure,Upper()) |
183 | 183 |
184 v = evalOn(g,x->1+x^2) | 184 v = evalOn(g,x->1+x^2) |
185 u = [3.124] #How to handle scalars having to be arrays? It's kind of ugly. | 185 u = fill(3.124) |
186 | 186 |
187 e_l*v isa LazyTensorMappingApplication | 187 e_l*v isa LazyTensorMappingApplication |
188 @test (e_l*v)[Index{Lower}(1)] == v[1] | 188 @test_broken (e_l*v)[Index{Lower}(1)] == v[1] |
189 @test (e_r*v)[Index{Upper}(4)] == v[end] | 189 @test_broken (e_r*v)[Index{Upper}(4)] == v[end] |
190 @test e_l'*u == [u[1], 0, 0, 0] | 190 @test e_l'*u == [u[], 0, 0, 0] |
191 @test e_r'*u == [0, 0, 0, u[1]] | 191 @test e_r'*u == [0, 0, 0, u[]] |
192 @test_throws BoundsError (e_l*v)[Index{Lower}(3)] | 192 @test_throws BoundsError (e_l*v)[Index{Lower}(3)] |
193 @test_throws BoundsError (e_r*v)[Index{Upper}(3)] | 193 @test_throws BoundsError (e_r*v)[Index{Upper}(3)] |
194 | 194 |
195 g = EquidistantGrid((4,5), (0.0, 0.0), (1.0,1.0)) | 195 g = EquidistantGrid((4,5), (0.0, 0.0), (1.0,1.0)) |
196 | 196 |
204 v[:,4] = [1, 2, 3,4] | 204 v[:,4] = [1, 2, 3,4] |
205 v[:,3] = [4, 5, 6, 7] | 205 v[:,3] = [4, 5, 6, 7] |
206 v[:,2] = [7, 8, 9, 10] | 206 v[:,2] = [7, 8, 9, 10] |
207 v[:,1] = [10, 11, 12, 13] | 207 v[:,1] = [10, 11, 12, 13] |
208 | 208 |
209 @test_broken e_w isa TensorMapping{T,1,2} where T | 209 @test e_w isa TensorMapping{T,1,2} where T |
210 @test_broken e_w' isa TensorMapping{T,2,1} where T | 210 @test e_w' isa TensorMapping{T,2,1} where T |
211 | 211 |
212 | 212 |
213 | 213 |
214 @test domain_size(e_w) == (4,5) | 214 @test domain_size(e_w) == (4,5) |
215 @test domain_size(e_e) == (4,5) | 215 @test domain_size(e_e) == (4,5) |