changeset 1586:d4a6f9effcdd feature/grids/manifolds

Remove mapped_grid(::Chart) and add equidistant_grid(::Chart)
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 26 Apr 2024 22:49:01 +0200
parents 2a9ec1e2abad
children aef3827ef522 84c3b9d71218 bf5927631b21
files src/Grids/equidistant_grid.jl src/Grids/mapped_grid.jl test/Grids/equidistant_grid_test.jl test/Grids/mapped_grid_test.jl
diffstat 4 files changed, 19 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
diff -r 2a9ec1e2abad -r d4a6f9effcdd src/Grids/equidistant_grid.jl
--- a/src/Grids/equidistant_grid.jl	Fri Apr 26 22:19:30 2024 +0200
+++ b/src/Grids/equidistant_grid.jl	Fri Apr 26 22:49:01 2024 +0200
@@ -130,6 +130,15 @@
 
 equidistant_grid(hb::HyperBox, dims::Vararg{Int}) = equidistant_grid(hb.a, hb.b, dims...)
 
+function equidistant_grid(c::Chart, dims::Vararg{Int})
+    lg = equidistant_grid(parameterspace(c), dims...)
+    return MappedGrid(
+        lg,
+        map(c,lg),
+        map(ξ->jacobian(c, ξ), lg),
+    )
+end
+
 
 CartesianBoundary{D,BID} = TensorGridBoundary{D,BID} # TBD: What should we do about the naming of this boundary?
 
diff -r 2a9ec1e2abad -r d4a6f9effcdd src/Grids/mapped_grid.jl
--- a/src/Grids/mapped_grid.jl	Fri Apr 26 22:19:30 2024 +0200
+++ b/src/Grids/mapped_grid.jl	Fri Apr 26 22:49:01 2024 +0200
@@ -61,14 +61,6 @@
     )
 end
 
-function mapped_grid(c::Chart, size...)
-    lg = equidistant_grid(parameterspace(c), size...)
-    return MappedGrid(
-        lg,
-        map(c,lg),
-        map(ξ->jacobian(c, ξ), lg),
-    )
-end
 
 function jacobian_determinant(g::MappedGrid)
     return map(jacobian(g)) do ∂x∂ξ
diff -r 2a9ec1e2abad -r d4a6f9effcdd test/Grids/equidistant_grid_test.jl
--- a/test/Grids/equidistant_grid_test.jl	Fri Apr 26 22:19:30 2024 +0200
+++ b/test/Grids/equidistant_grid_test.jl	Fri Apr 26 22:49:01 2024 +0200
@@ -151,6 +151,16 @@
 
         @test equidistant_grid(ps, 3,4) == equidistant_grid((0,0), (2,1), 3,4)
     end
+
+
+    @testset "equidistant_grid(::Chart)" begin
+        c = Chart(unitsquare()) do (ξ,η)
+            @SVector[2ξ, 3η]
+        end
+        Grids.jacobian(c::typeof(c), ξ̄) = @SMatrix[2 0; 0 3]
+
+        @test equidistant_grid(c, 5, 4) isa Grid
+    end
 end
 
 
diff -r 2a9ec1e2abad -r d4a6f9effcdd test/Grids/mapped_grid_test.jl
--- a/test/Grids/mapped_grid_test.jl	Fri Apr 26 22:19:30 2024 +0200
+++ b/test/Grids/mapped_grid_test.jl	Fri Apr 26 22:49:01 2024 +0200
@@ -183,15 +183,4 @@
     lg = equidistant_grid((0,0), (1,1), 10, 11)
     @test logicalgrid(mg) == lg
     @test collect(mg) == map(x̄, lg)
-
-
-    @testset "mapped_grid(::Chart)" begin
-        c = Chart(unitsquare()) do (ξ,η)
-            @SVector[2ξ, 3η]
-        end
-        Grids.jacobian(c::typeof(c), ξ̄) = @SMatrix[2 0; 0 3]
-
-        @test mapped_grid(c, 5, 4) isa Grid
-    end
-
 end