changeset 1742:c9c601678a14 feature/grids/curvilinear

Add test for construction of Rn->Rm grid
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 11 Sep 2024 12:09:59 +0200
parents 248304f88e49
children 49bd573ab07f
files test/Grids/mapped_grid_test.jl
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/Grids/mapped_grid_test.jl	Wed Sep 11 12:09:41 2024 +0200
+++ b/test/Grids/mapped_grid_test.jl	Wed Sep 11 12:09:59 2024 +0200
@@ -31,7 +31,6 @@
     @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)
@@ -44,8 +43,19 @@
         @test jacobian(mg) == J
         @test logicalgrid(mg) == lg
 
-        # TODO: Test constructor for different dims of range and domain for the coordinates
-        # TODO: Test constructor with different type than TensorGrid. a dummy type?
+
+        x̄ = map(ξ̄ -> @SVector[ξ̄[1],ξ̄[2], ξ̄[1] + ξ̄[2]], lg)
+        J = map(ξ̄ -> @SMatrix[1 0; 0 1; 1 1], lg)
+        mg = MappedGrid(lg, x̄, J)
+
+        @test mg isa Grid{SVector{3, Float64},2}
+        @test jacobian(mg) isa Array{<:AbstractMatrix}
+        @test logicalgrid(mg) isa Grid
+
+        @test collect(mg) == x̄
+        @test jacobian(mg) == J
+        @test logicalgrid(mg) == lg
+
         # 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))