comparison test/Grids/manifolds_test.jl @ 1934:1b012e2d5db1 feature/grids/manifolds

Add function for getting boundaries from CartesianAtlas
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 07 Feb 2025 11:11:54 +0100
parents 2801507dbee1
children 378d38bab1df
comparison
equal deleted inserted replaced
1933:2801507dbee1 1934:1b012e2d5db1
34 a = CartesianAtlas([c c; c c]) 34 a = CartesianAtlas([c c; c c])
35 @test charts(a) == [c c; c c] 35 @test charts(a) == [c c; c c]
36 end 36 end
37 37
38 @testset "connections" begin 38 @testset "connections" begin
39 # 2D
40 a = CartesianAtlas(fill(Chart(identity, unitsquare()), 2,3))
41 west = CartesianBoundary{1,LowerBoundary} 39 west = CartesianBoundary{1,LowerBoundary}
42 east = CartesianBoundary{1,UpperBoundary} 40 east = CartesianBoundary{1,UpperBoundary}
43 south = CartesianBoundary{2,LowerBoundary} 41 south = CartesianBoundary{2,LowerBoundary}
44 north = CartesianBoundary{2,UpperBoundary} 42 north = CartesianBoundary{2,UpperBoundary}
43 bottom = CartesianBoundary{3, LowerBoundary}
44 top = CartesianBoundary{3, UpperBoundary}
45
46 # 2D
47 a = CartesianAtlas(fill(Chart(identity, unitsquare()), 2,3))
45 48
46 @test Set(connections(a)) == Set([ 49 @test Set(connections(a)) == Set([
47 (MultiBlockBoundary{(1,1), east}(), MultiBlockBoundary{(2,1), west}()), 50 (MultiBlockBoundary{(1,1), east}(), MultiBlockBoundary{(2,1), west}()),
48 (MultiBlockBoundary{(1,1), north}(), MultiBlockBoundary{(1,2), south}()), 51 (MultiBlockBoundary{(1,1), north}(), MultiBlockBoundary{(1,2), south}()),
49 (MultiBlockBoundary{(2,1), north}(), MultiBlockBoundary{(2,2), south}()), 52 (MultiBlockBoundary{(2,1), north}(), MultiBlockBoundary{(2,2), south}()),
53 (MultiBlockBoundary{(1,3), east}(), MultiBlockBoundary{(2,3), west}()), 56 (MultiBlockBoundary{(1,3), east}(), MultiBlockBoundary{(2,3), west}()),
54 ]) 57 ])
55 58
56 # 3D 59 # 3D
57 a = CartesianAtlas(fill(Chart(identity, unitsquare()), 2,2,3)) 60 a = CartesianAtlas(fill(Chart(identity, unitsquare()), 2,2,3))
58 bottom = CartesianBoundary{3, LowerBoundary}
59 top = CartesianBoundary{3, UpperBoundary}
60 @test Set(connections(a)) == Set([ 61 @test Set(connections(a)) == Set([
61 (MultiBlockBoundary{(1,1,1), east}(), MultiBlockBoundary{(2,1,1), west}()), 62 (MultiBlockBoundary{(1,1,1), east}(), MultiBlockBoundary{(2,1,1), west}()),
62 (MultiBlockBoundary{(1,1,1), north}(), MultiBlockBoundary{(1,2,1), south}()), 63 (MultiBlockBoundary{(1,1,1), north}(), MultiBlockBoundary{(1,2,1), south}()),
63 (MultiBlockBoundary{(2,1,1), north}(), MultiBlockBoundary{(2,2,1), south}()), 64 (MultiBlockBoundary{(2,1,1), north}(), MultiBlockBoundary{(2,2,1), south}()),
64 (MultiBlockBoundary{(1,2,1), east}(), MultiBlockBoundary{(2,2,1), west}()), 65 (MultiBlockBoundary{(1,2,1), east}(), MultiBlockBoundary{(2,2,1), west}()),
82 (MultiBlockBoundary{(2,1,2), top}(), MultiBlockBoundary{(2,1,3), bottom}()), 83 (MultiBlockBoundary{(2,1,2), top}(), MultiBlockBoundary{(2,1,3), bottom}()),
83 (MultiBlockBoundary{(1,2,2), top}(), MultiBlockBoundary{(1,2,3), bottom}()), 84 (MultiBlockBoundary{(1,2,2), top}(), MultiBlockBoundary{(1,2,3), bottom}()),
84 (MultiBlockBoundary{(2,2,2), top}(), MultiBlockBoundary{(2,2,3), bottom}()), 85 (MultiBlockBoundary{(2,2,2), top}(), MultiBlockBoundary{(2,2,3), bottom}()),
85 ]) 86 ])
86 end 87 end
88
89 @testset "boundaries" begin
90 west = CartesianBoundary{1,LowerBoundary}
91 east = CartesianBoundary{1,UpperBoundary}
92 south = CartesianBoundary{2,LowerBoundary}
93 north = CartesianBoundary{2,UpperBoundary}
94 bottom = CartesianBoundary{3, LowerBoundary}
95 top = CartesianBoundary{3, UpperBoundary}
96
97 # 2D
98 a = CartesianAtlas(fill(Chart(identity, unitsquare()), 2,3))
99 @test Set(boundaries(a)) == Set([
100 MultiBlockBoundary{(1,1), south}(),
101 MultiBlockBoundary{(2,1), south}(),
102 MultiBlockBoundary{(2,1), east}(),
103 MultiBlockBoundary{(2,2), east}(),
104 MultiBlockBoundary{(2,3), east}(),
105 MultiBlockBoundary{(1,3), north}(),
106 MultiBlockBoundary{(2,3), north}(),
107 MultiBlockBoundary{(1,1), west}(),
108 MultiBlockBoundary{(1,2), west}(),
109 MultiBlockBoundary{(1,3), west}(),
110 ])
111
112 # 3D
113 a = CartesianAtlas(fill(Chart(identity, unitsquare()), 2,2,3))
114 @test Set(boundaries(a)) == Set([
115 MultiBlockBoundary{(1,1,1), bottom}(),
116 MultiBlockBoundary{(2,1,1), bottom}(),
117 MultiBlockBoundary{(1,2,1), bottom}(),
118 MultiBlockBoundary{(2,2,1), bottom}(),
119
120 MultiBlockBoundary{(1,1,3), top}(),
121 MultiBlockBoundary{(2,1,3), top}(),
122 MultiBlockBoundary{(1,2,3), top}(),
123 MultiBlockBoundary{(2,2,3), top}(),
124
125 MultiBlockBoundary{(1,1,1), west}(),
126 MultiBlockBoundary{(1,2,1), west}(),
127 MultiBlockBoundary{(1,1,2), west}(),
128 MultiBlockBoundary{(1,2,2), west}(),
129 MultiBlockBoundary{(1,1,3), west}(),
130 MultiBlockBoundary{(1,2,3), west}(),
131
132 MultiBlockBoundary{(2,1,1), east}(),
133 MultiBlockBoundary{(2,2,1), east}(),
134 MultiBlockBoundary{(2,1,2), east}(),
135 MultiBlockBoundary{(2,2,2), east}(),
136 MultiBlockBoundary{(2,1,3), east}(),
137 MultiBlockBoundary{(2,2,3), east}(),
138
139 MultiBlockBoundary{(1,1,1), south}(),
140 MultiBlockBoundary{(2,1,1), south}(),
141 MultiBlockBoundary{(1,1,2), south}(),
142 MultiBlockBoundary{(2,1,2), south}(),
143 MultiBlockBoundary{(1,1,3), south}(),
144 MultiBlockBoundary{(2,1,3), south}(),
145
146 MultiBlockBoundary{(1,2,1), north}(),
147 MultiBlockBoundary{(2,2,1), north}(),
148 MultiBlockBoundary{(1,2,2), north}(),
149 MultiBlockBoundary{(2,2,2), north}(),
150 MultiBlockBoundary{(1,2,3), north}(),
151 MultiBlockBoundary{(2,2,3), north}(),
152 ])
153 end
87 end 154 end
88 155
89 @testset "UnstructuredAtlas" begin 156 @testset "UnstructuredAtlas" begin
90 @test_broken false 157 @test_broken false
91 end 158 end