changeset 1738:7573c9244e47 feature/grids/curvilinear

Factor out testset for construct and remove some Todos
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 10 Sep 2024 22:23:42 +0200
parents a4e1721a7109
children e1ae5d8e30c3
files test/Grids/mapped_grid_test.jl
diffstat 1 files changed, 25 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/test/Grids/mapped_grid_test.jl	Tue Sep 10 22:17:01 2024 +0200
+++ b/test/Grids/mapped_grid_test.jl	Tue Sep 10 22:23:42 2024 +0200
@@ -28,22 +28,24 @@
 end
 
 @testset "MappedGrid" begin
-    lg = equidistant_grid((0,0), (1,1), 11, 21)
-    x̄ = map(ξ̄ -> 2ξ̄, lg)
-    J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg)
-    mg = MappedGrid(lg, x̄, J)
+    @testset "Constructor" begin
+        lg = equidistant_grid((0,0), (1,1), 11, 21)
+        x̄ = map(ξ̄ -> 2ξ̄, lg)
+        J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg)
+        mg = MappedGrid(lg, x̄, J)
 
-    # TODO: Test constructor for different dims of range and domain for the coordinates
-    # TODO: Test constructor with different type than TensorGrid. a dummy type?
-    # TODO: Test that the element types agree
+        # TODO: Test constructor for different dims of range and domain for the coordinates
+        # TODO: Test constructor with different type than TensorGrid. a dummy type?
+        # TODO: Test that the element types agree
 
-    @test_broken false # @test_throws ArgumentError("Sizes must match") MappedGrid(lg, map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11))
+        @test_broken false # @test_throws ArgumentError("Sizes must match") MappedGrid(lg, map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11))
 
 
-    @test mg isa Grid{SVector{2, Float64},2}
+        @test mg isa Grid{SVector{2, Float64},2}
 
-    @test jacobian(mg) isa Array{<:AbstractMatrix}
-    @test logicalgrid(mg) isa Grid
+        @test jacobian(mg) isa Array{<:AbstractMatrix}
+        @test logicalgrid(mg) isa Grid
+    end
 
     @testset "Indexing Interface" begin
         lg = equidistant_grid((0,0), (1,1), 11, 21)
@@ -88,9 +90,13 @@
             @test lastindex(mg, 2) == 21
         end
     end
-    # TODO: Test with different types of logical grids
 
     @testset "Iterator interface" begin
+        lg = equidistant_grid((0,0), (1,1), 11, 21)
+        x̄ = map(ξ̄ -> 2ξ̄, lg)
+        J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg)
+        mg = MappedGrid(lg, x̄, J)
+
         sg = MappedGrid(
             equidistant_grid((0,0), (1,1), 15, 11),
             map(ξ̄ -> @SArray[ξ̄[1], ξ̄[2], -ξ̄[1]], lg), rand(SMatrix{2,3,Float64},15,11)
@@ -131,6 +137,11 @@
     end
 
     @testset "Base" begin
+        lg = equidistant_grid((0,0), (1,1), 11, 21)
+        x̄ = map(ξ̄ -> 2ξ̄, lg)
+        J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg)
+        mg = MappedGrid(lg, x̄, J)
+
         @test ndims(mg) == 2
     end
 
@@ -160,7 +171,7 @@
     end
 
     @testset "boundary_identifiers" begin
-        lg = equidistant_grid((0,0), (1,1), 11, 11) # TODO: Change dims of the grid to be different
+        lg = equidistant_grid((0,0), (1,1), 11, 15)
         x̄ = map(ξ̄ -> 2ξ̄, lg)
         J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg)
         mg = MappedGrid(lg, x̄, J)
@@ -168,7 +179,7 @@
     end
 
     @testset "boundary_indices" begin
-        lg = equidistant_grid((0,0), (1,1), 11, 11) # TODO: Change dims of the grid to be different
+        lg = equidistant_grid((0,0), (1,1), 11, 15)
         x̄ = map(ξ̄ -> 2ξ̄, lg)
         J = map(ξ̄ -> @SArray(fill(2., 2, 2)), lg)
         mg = MappedGrid(lg, x̄, J)