@@ -393,4 +393,41 @@ using JET
393
393
@test_opt ifelsekernel! (S, ρ)
394
394
end
395
395
396
+ @testset " dss of FieldVectors" begin
397
+ function field_vec (center_space, face_space)
398
+ Y = Fields. FieldVector (
399
+ c = map (Fields. coordinate_field (center_space)) do coord
400
+ FT = Spaces. undertype (center_space)
401
+ (; ρ = FT (0 ), uₕ = Geometry. Covariant12Vector (FT (0 ), FT (0 )))
402
+ end ,
403
+ f = map (Fields. coordinate_field (face_space)) do coord
404
+ FT = Spaces. undertype (face_space)
405
+ (; w = Geometry. Covariant3Vector (FT (0 )))
406
+ end ,
407
+ )
408
+ return Y
409
+ end
410
+
411
+ fv = field_vec (toy_sphere (Float64)... )
412
+
413
+ # Test that dss_buffer is created and has the correct keys and buffer types
414
+ dss_buffer = Spaces. create_dss_buffer (fv)
415
+ @test haskey (dss_buffer, :c )
416
+ @test haskey (dss_buffer, :f )
417
+ @test getproperty (dss_buffer, :c ) isa Topologies. DSSBuffer
418
+ @test getproperty (dss_buffer, :f ) isa Topologies. DSSBuffer
419
+
420
+ c_copy = copy (getproperty (fv, :c ))
421
+ f_copy = copy (getproperty (fv, :f ))
422
+
423
+ # Test weighted_dss! with and without preallocated buffer
424
+ p = @allocated Spaces. weighted_dss! (fv, dss_buffer) # DSS2
425
+ @test getproperty (fv, :c ) ≈ c_copy
426
+ @test getproperty (fv, :f ) ≈ f_copy
427
+
428
+ Spaces. weighted_dss! (fv)
429
+ @test getproperty (fv, :c ) ≈ c_copy
430
+ @test getproperty (fv, :f ) ≈ f_copy
431
+ end
432
+
396
433
nothing
0 commit comments