|
203 | 203 | @test size_with_halo(sf) == (npoint,) |
204 | 204 | end |
205 | 205 |
|
206 | | -@testset "Sparse function coordinates, n=$n" for n in ( (10,11), (10,11,12) ) |
| 206 | +@testset "Sparse function coordinates, Real, n=$n" for n in ( (10,11), (10,11,12) ) |
207 | 207 | grid = Grid(shape=n, dtype=Float32) |
208 | 208 | sf = SparseFunction(name="sf", npoint=10, grid=grid) |
209 | 209 | @test typeof(coordinates(sf)) <: SubFunction{Float32,2} |
|
216 | 216 | @test _sf_coords ≈ x |
217 | 217 | end |
218 | 218 |
|
| 219 | +@testset "Sparse function coordinates, Complex, n=$n" for n in ( (10,11), (10,11,12) ) |
| 220 | + grid = Grid(shape=n, dtype=Float32) |
| 221 | + sf = SparseFunction(name="sf", npoint=10, grid=grid, dtype=Complex{Float32}) |
| 222 | + @test typeof(coordinates(sf)) <: SubFunction{Float32,2} |
| 223 | + sf_coords = coordinates_data(sf) |
| 224 | + @test isa(sf_coords, Devito.DevitoArray) |
| 225 | + @test size(sf_coords) == (length(n),10) |
| 226 | + x = rand(length(n),10) |
| 227 | + sf_coords .= x |
| 228 | + _sf_coords = coordinates_data(sf) |
| 229 | + @test _sf_coords ≈ x |
| 230 | +end |
| 231 | + |
219 | 232 | @testset "SparseFunction from PyObject, T=$T, n=$n, npoint=$npoint" for T in (Float32, Float64), n in ((3,4),(3,4,5)), npoint in (1,5,10) |
220 | 233 | g = Grid(shape=n, dtype=T) |
221 | 234 | sf = SparseFunction(name="sf", grid=g, npoint=npoint) |
@@ -520,11 +533,11 @@ end |
520 | 533 | apply(op) |
521 | 534 | for j in 1:div(size,factr)+1 |
522 | 535 | @test data(f)[j] == data(g)[(j-1)*factr+1] |
523 | | - end |
524 | | - if ENV["DEVITO_BRANCH"] in ("main", "devitopro") |
525 | | - @test data(f)[end] == data(g)[end] |
526 | | - else |
527 | | - @test_broken data(f)[end] == data(g)[end] |
| 536 | + if get(ENV,"DEVITO_BRANCH","main") in ("main", "devitopro") |
| 537 | + @test data(f)[end] == data(g)[end] |
| 538 | + else |
| 539 | + @test_broken data(f)[end] == data(g)[end] |
| 540 | + end |
528 | 541 | end |
529 | 542 | end |
530 | 543 |
|
|
0 commit comments