diff test/Grids/manifolds_test.jl @ 1928:96b3e9c516fe feature/grids/manifolds

Make cartesian atlas work for any dimension
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Feb 2025 09:12:41 +0100
parents fe18cdad2b27
children c5affb342e73
line wrap: on
line diff
--- a/test/Grids/manifolds_test.jl	Fri Feb 07 08:44:36 2025 +0100
+++ b/test/Grids/manifolds_test.jl	Fri Feb 07 09:12:41 2025 +0100
@@ -36,6 +36,7 @@
 
     @testset "connections" begin
         a = CartesianAtlas(fill(c, 2,3))
+        # 2D
         west = CartesianBoundary{1,LowerBoundary}
         east = CartesianBoundary{1,UpperBoundary}
         south = CartesianBoundary{2,LowerBoundary}
@@ -50,6 +51,37 @@
             (MultiBlockBoundary{(2,2), north}(), MultiBlockBoundary{(2,3), south}()),
             (MultiBlockBoundary{(1,3), east}(), MultiBlockBoundary{(2,3), west}()),
         ])
+
+        # 3D
+        a = CartesianAtlas(fill(c, 2,2,3))
+        bottom = CartesianBoundary{3, LowerBoundary}
+        top = CartesianBoundary{3, UpperBoundary}
+        @test Set(connections(a)) == Set([
+            (MultiBlockBoundary{(1,1,1), east}(),  MultiBlockBoundary{(2,1,1), west}()),
+            (MultiBlockBoundary{(1,1,1), north}(), MultiBlockBoundary{(1,2,1), south}()),
+            (MultiBlockBoundary{(2,1,1), north}(), MultiBlockBoundary{(2,2,1), south}()),
+            (MultiBlockBoundary{(1,2,1), east}(),  MultiBlockBoundary{(2,2,1), west}()),
+
+            (MultiBlockBoundary{(1,1,2), east}(),  MultiBlockBoundary{(2,1,2), west}()),
+            (MultiBlockBoundary{(1,1,2), north}(), MultiBlockBoundary{(1,2,2), south}()),
+            (MultiBlockBoundary{(2,1,2), north}(), MultiBlockBoundary{(2,2,2), south}()),
+            (MultiBlockBoundary{(1,2,2), east}(),  MultiBlockBoundary{(2,2,2), west}()),
+
+            (MultiBlockBoundary{(1,1,3), east}(),  MultiBlockBoundary{(2,1,3), west}()),
+            (MultiBlockBoundary{(1,1,3), north}(), MultiBlockBoundary{(1,2,3), south}()),
+            (MultiBlockBoundary{(2,1,3), north}(), MultiBlockBoundary{(2,2,3), south}()),
+            (MultiBlockBoundary{(1,2,3), east}(),  MultiBlockBoundary{(2,2,3), west}()),
+
+            (MultiBlockBoundary{(1,1,1), top}(), MultiBlockBoundary{(1,1,2), bottom}()),
+            (MultiBlockBoundary{(2,1,1), top}(), MultiBlockBoundary{(2,1,2), bottom}()),
+            (MultiBlockBoundary{(1,2,1), top}(), MultiBlockBoundary{(1,2,2), bottom}()),
+            (MultiBlockBoundary{(2,2,1), top}(), MultiBlockBoundary{(2,2,2), bottom}()),
+
+            (MultiBlockBoundary{(1,1,2), top}(), MultiBlockBoundary{(1,1,3), bottom}()),
+            (MultiBlockBoundary{(2,1,2), top}(), MultiBlockBoundary{(2,1,3), bottom}()),
+            (MultiBlockBoundary{(1,2,2), top}(), MultiBlockBoundary{(1,2,3), bottom}()),
+            (MultiBlockBoundary{(2,2,2), top}(), MultiBlockBoundary{(2,2,3), bottom}()),
+        ])
     end
 end