Changeset 8605
- Timestamp:
- Nov 8, 2012, 2:16:28 PM (12 years ago)
- Location:
- trunk/anuga_core/source/anuga_parallel
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga_parallel/distribute_mesh.py
r8558 r8605 1529 1529 x = num.array(submesh["ghost_quan"][k][p], num.float) 1530 1530 pypar.send(x,p, bypass=True) 1531 1531 1532 1532 1533 1533 1534 ######################################################### … … 1721 1722 number_of_full_nodes, number_of_full_triangles, tri_map, node_map,\ 1722 1723 ghost_layer_width 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1724 1735 1725 1736 … … 1727 1738 # 1728 1739 # Extract the submesh that will belong to the 1729 # "host processor"(i.e. processor zero)1740 # processor 0 (i.e. processor zero) 1730 1741 # 1731 1742 # *) See the documentation for build_submesh … … 1739 1750 # 1740 1751 ######################################################### 1741 def extract_ hostmesh(submesh, triangles_per_proc):1752 def extract_submesh(submesh, triangles_per_proc, p=0): 1742 1753 1743 1754 1744 1755 submesh_cell = {} 1745 submesh_cell["ghost_layer_width"] = submesh["ghost_layer_width"][ 0]1746 submesh_cell["full_nodes"] = submesh["full_nodes"][ 0]1747 submesh_cell["ghost_nodes"] = submesh["ghost_nodes"][ 0]1748 submesh_cell["full_triangles"] = submesh["full_triangles"][ 0]1749 submesh_cell["ghost_triangles"] = submesh["ghost_triangles"][ 0]1750 submesh_cell["full_boundary"] = submesh["full_boundary"][ 0]1751 submesh_cell["ghost_boundary"] = submesh["ghost_boundary"][ 0]1752 submesh_cell["ghost_commun"] = submesh["ghost_commun"][ 0]1753 submesh_cell["full_commun"] = submesh["full_commun"][ 0]1756 submesh_cell["ghost_layer_width"] = submesh["ghost_layer_width"][p] 1757 submesh_cell["full_nodes"] = submesh["full_nodes"][p] 1758 submesh_cell["ghost_nodes"] = submesh["ghost_nodes"][p] 1759 submesh_cell["full_triangles"] = submesh["full_triangles"][p] 1760 submesh_cell["ghost_triangles"] = submesh["ghost_triangles"][p] 1761 submesh_cell["full_boundary"] = submesh["full_boundary"][p] 1762 submesh_cell["ghost_boundary"] = submesh["ghost_boundary"][p] 1763 submesh_cell["ghost_commun"] = submesh["ghost_commun"][p] 1764 submesh_cell["full_commun"] = submesh["full_commun"][p] 1754 1765 submesh_cell["full_quan"] ={} 1755 1766 submesh_cell["ghost_quan"]={} 1756 1767 for k in submesh["full_quan"]: 1757 submesh_cell["full_quan"][k] = submesh["full_quan"][k][0] 1758 submesh_cell["ghost_quan"][k] = submesh["ghost_quan"][k][0] 1768 submesh_cell["full_quan"][k] = submesh["full_quan"][k][p] 1769 submesh_cell["ghost_quan"][k] = submesh["ghost_quan"][k][p] 1770 1771 1772 # FIXME SR: I think there is already a structure with this info in the mesh 1773 lower_t = 0 1774 for i in range(p): 1775 lower_t = lower_t+triangles_per_proc[i] 1776 upper_t = lower_t+triangles_per_proc[p] 1759 1777 1760 1778 numprocs = len(triangles_per_proc) 1761 1779 points, vertices, boundary, quantities, ghost_recv_dict, \ 1762 1780 full_send_dict, tri_map, node_map, ghost_layer_width = \ 1763 build_local_mesh(submesh_cell, 0, triangles_per_proc[0], numprocs)1781 build_local_mesh(submesh_cell, lower_t, upper_t, numprocs) 1764 1782 1765 1783 -
trunk/anuga_core/source/anuga_parallel/parallel_api.py
r8582 r8605 16 16 from anuga_parallel.distribute_mesh import send_submesh 17 17 from anuga_parallel.distribute_mesh import rec_submesh 18 from anuga_parallel.distribute_mesh import extract_ hostmesh18 from anuga_parallel.distribute_mesh import extract_submesh 19 19 20 20 # Mesh partitioning using Metis … … 298 298 points, vertices, boundary, quantities, \ 299 299 ghost_recv_dict, full_send_dict, tri_map, node_map, ghost_layer_width =\ 300 extract_ hostmesh(submesh, triangles_per_proc)300 extract_submesh(submesh, triangles_per_proc,0) 301 301 302 302 # Keep track of the number full nodes and triangles. -
trunk/anuga_core/source/anuga_parallel/parallel_test.py
r8011 r8605 11 11 from anuga_parallel.distribute_mesh import build_submesh 12 12 from anuga_parallel.distribute_mesh import submesh_full, submesh_ghost, submesh_quantities 13 from anuga_parallel.distribute_mesh import extract_ hostmesh, rec_submesh, send_submesh13 from anuga_parallel.distribute_mesh import extract_submesh, rec_submesh, send_submesh 14 14 15 15 from anuga_parallel.interface import myid, numprocs, barrier … … 215 215 216 216 #---------------------------------------------------------------------------------- 217 # Test extract_ hostmesh217 # Test extract_submesh 218 218 #---------------------------------------------------------------------------------- 219 219 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict =\ 220 extract_ hostmesh(submesh, triangles_per_proc)220 extract_submesh(submesh, triangles_per_proc) 221 221 222 222 -
trunk/anuga_core/source/anuga_parallel/run_parallel_merimbula_test.py
r3591 r8605 51 51 from build_submesh import build_submesh 52 52 from build_local import build_local_mesh 53 from build_commun import send_submesh, rec_submesh, extract_ hostmesh53 from build_commun import send_submesh, rec_submesh, extract_submesh 54 54 55 55 … … 111 111 112 112 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \ 113 extract_ hostmesh(submesh, triangles_per_proc)113 extract_submesh(submesh, triangles_per_proc) 114 114 115 115 # read in the mesh partition that belongs to this -
trunk/anuga_core/source/anuga_parallel/run_parallel_sw_merimbula_test.py
r7615 r8605 58 58 from distribute_mesh import build_submesh 59 59 from distribute_mesh import build_local_mesh 60 from distribute_mesh import send_submesh, rec_submesh, extract_ hostmesh60 from distribute_mesh import send_submesh, rec_submesh, extract_submesh 61 61 62 62 … … 139 139 140 140 points, vertices, boundary, quantities, ghost_recv_dict, full_send_dict = \ 141 extract_ hostmesh(submesh, triangles_per_proc)141 extract_submesh(submesh, triangles_per_proc) 142 142 143 143 # Read in the mesh partition that belongs to this -
trunk/anuga_core/source/anuga_parallel/test_distribute_mesh.py
r8540 r8605 12 12 from anuga_parallel.distribute_mesh import build_submesh 13 13 from anuga_parallel.distribute_mesh import submesh_full, submesh_ghost, submesh_quantities 14 from anuga_parallel.distribute_mesh import extract_ hostmesh, rec_submesh, send_submesh14 from anuga_parallel.distribute_mesh import extract_submesh, rec_submesh, send_submesh 15 15 16 16 import numpy as num … … 1132 1132 1133 1133 1134 1135 1134 def test_build_extract_submesh_3(self): 1135 """ 1136 Test 3 way extract_submesh 1137 """ 1138 1139 nodes = [[0.0, 0.0], [0.0, 0.5], [0.0, 1.0], [0.5, 0.0], [0.5, 0.5], [0.5, 1.0], [1.0, 0.0], \ 1140 [1.0, 0.5], [1.0, 1.0], [0.25, 0.25], [0.25, 0.75], [0.75, 0.25], [0.75, 0.75]] 1141 1142 1143 triangles = [[4, 9, 3], [4, 12, 5], [7, 12, 4], [8, 12, 7], [5, 12, 8], [0, 9, 1], \ 1144 [1, 9, 4], [1, 10, 2], [4, 10, 1], [5, 10, 4], [2, 10, 5], [3, 9, 0], [3, 11, 4], \ 1145 [6, 11, 3], [7, 11, 6], [4, 11, 7]] 1146 1147 1148 boundary = {(13, 1): 'bottom', (7, 1): 'left', (3, 1): 'right', (14, 1): 'right', \ 1149 (11, 1): 'bottom', (10, 1): 'top', (5, 1): 'left', (4, 1): 'top'} 1150 1151 triangles_per_proc = [5, 6, 5] 1152 1153 1154 quantities = {'stage': num.array([[-0.25 , -0.125, -0.25 ], 1155 [-0.25 , -0.375, -0.25 ], 1156 [-0.5 , -0.375, -0.25 ], 1157 [-0.5 , -0.375, -0.5 ], 1158 [-0.25 , -0.375, -0.5 ], 1159 [-0. , -0.125, -0. ], 1160 [-0. , -0.125, -0.25 ], 1161 [-0. , -0.125, -0. ], 1162 [-0.25 , -0.125, -0. ], 1163 [-0.25 , -0.125, -0.25 ], 1164 [-0. , -0.125, -0.25 ], 1165 [-0.25 , -0.125, -0. ], 1166 [-0.25 , -0.375, -0.25 ], 1167 [-0.5 , -0.375, -0.25 ], 1168 [-0.5 , -0.375, -0.5 ], 1169 [-0.25 , -0.375, -0.5 ]]), 'elevation': num.array([[-0.25 , -0.125, -0.25 ], 1170 [-0.25 , -0.375, -0.25 ], 1171 [-0.5 , -0.375, -0.25 ], 1172 [-0.5 , -0.375, -0.5 ], 1173 [-0.25 , -0.375, -0.5 ], 1174 [-0. , -0.125, -0. ], 1175 [-0. , -0.125, -0.25 ], 1176 [-0. , -0.125, -0. ], 1177 [-0.25 , -0.125, -0. ], 1178 [-0.25 , -0.125, -0.25 ], 1179 [-0. , -0.125, -0.25 ], 1180 [-0.25 , -0.125, -0. ], 1181 [-0.25 , -0.375, -0.25 ], 1182 [-0.5 , -0.375, -0.25 ], 1183 [-0.5 , -0.375, -0.5 ], 1184 [-0.25 , -0.375, -0.5 ]]), 'ymomentum': num.array([[ 0.5 , 0.25, 0. ], 1185 [ 0.5 , 0.75, 1. ], 1186 [ 0.5 , 0.75, 0.5 ], 1187 [ 1. , 0.75, 0.5 ], 1188 [ 1. , 0.75, 1. ], 1189 [ 0. , 0.25, 0.5 ], 1190 [ 0.5 , 0.25, 0.5 ], 1191 [ 0.5 , 0.75, 1. ], 1192 [ 0.5 , 0.75, 0.5 ], 1193 [ 1. , 0.75, 0.5 ], 1194 [ 1. , 0.75, 1. ], 1195 [ 0. , 0.25, 0. ], 1196 [ 0. , 0.25, 0.5 ], 1197 [ 0. , 0.25, 0. ], 1198 [ 0.5 , 0.25, 0. ], 1199 [ 0.5 , 0.25, 0.5 ]]), 'friction': num.array([[ 0., 0., 0.], 1200 [ 0., 0., 0.], 1201 [ 0., 0., 0.], 1202 [ 0., 0., 0.], 1203 [ 0., 0., 0.], 1204 [ 0., 0., 0.], 1205 [ 0., 0., 0.], 1206 [ 0., 0., 0.], 1207 [ 0., 0., 0.], 1208 [ 0., 0., 0.], 1209 [ 0., 0., 0.], 1210 [ 0., 0., 0.], 1211 [ 0., 0., 0.], 1212 [ 0., 0., 0.], 1213 [ 0., 0., 0.], 1214 [ 0., 0., 0.]]), 'xmomentum': num.array([[ 2., 2., 2.], 1215 [ 2., 2., 2.], 1216 [ 2., 2., 2.], 1217 [ 2., 2., 2.], 1218 [ 2., 2., 2.], 1219 [ 2., 2., 2.], 1220 [ 2., 2., 2.], 1221 [ 2., 2., 2.], 1222 [ 2., 2., 2.], 1223 [ 2., 2., 2.], 1224 [ 2., 2., 2.], 1225 [ 2., 2., 2.], 1226 [ 2., 2., 2.], 1227 [ 2., 2., 2.], 1228 [ 2., 2., 2.], 1229 [ 2., 2., 2.]])} 1230 1231 1232 1233 true_submesh = {'full_boundary': [{(3, 1): 'right', (4, 1): 'top'},\ 1234 {(5, 1): 'left', (10, 1): 'top', (7, 1): 'left'}, \ 1235 {(13, 1): 'bottom', (14, 1): 'right', (11, 1): 'bottom'}], 1236 'ghost_nodes': [num.array([[ 0. , 0. , 0. ], 1237 [ 1. , 0. , 0.5 ], 1238 [ 2. , 0. , 1. ], 1239 [ 6. , 1. , 0. ], 1240 [ 10. , 0.25, 0.75], 1241 [ 11. , 0.75, 0.25]]), num.array([[ 3. , 0.5 , 0. ], 1242 [ 7. , 1. , 0.5 ], 1243 [ 8. , 1. , 1. ], 1244 [ 11. , 0.75, 0.25], 1245 [ 12. , 0.75, 0.75]]), num.array([[ 1. , 0. , 0.5 ], 1246 [ 5. , 0.5 , 1. ], 1247 [ 8. , 1. , 1. ], 1248 [ 12. , 0.75, 0.75]])], 1249 'full_nodes': [num.array([[ 3. , 0.5 , 0. ], 1250 [ 4. , 0.5 , 0.5 ], 1251 [ 5. , 0.5 , 1. ], 1252 [ 7. , 1. , 0.5 ], 1253 [ 8. , 1. , 1. ], 1254 [ 9. , 0.25, 0.25], 1255 [ 12. , 0.75, 0.75]]), num.array([[ 0. , 0. , 0. ], 1256 [ 1. , 0. , 0.5 ], 1257 [ 2. , 0. , 1. ], 1258 [ 4. , 0.5 , 0.5 ], 1259 [ 5. , 0.5 , 1. ], 1260 [ 9. , 0.25, 0.25], 1261 [ 10. , 0.25, 0.75]]), num.array([[ 0. , 0. , 0. ], 1262 [ 3. , 0.5 , 0. ], 1263 [ 4. , 0.5 , 0.5 ], 1264 [ 6. , 1. , 0. ], 1265 [ 7. , 1. , 0.5 ], 1266 [ 9. , 0.25, 0.25], 1267 [ 11. , 0.75, 0.25]])], 1268 'ghost_triangles': [num.array([[ 5, 0, 9, 1], 1269 [ 6, 1, 9, 4], 1270 [ 8, 4, 10, 1], 1271 [ 9, 5, 10, 4], 1272 [10, 2, 10, 5], 1273 [11, 3, 9, 0], 1274 [12, 3, 11, 4], 1275 [13, 6, 11, 3], 1276 [14, 7, 11, 6], 1277 [15, 4, 11, 7]]), num.array([[ 0, 4, 9, 3], 1278 [ 1, 4, 12, 5], 1279 [ 2, 7, 12, 4], 1280 [ 4, 5, 12, 8], 1281 [11, 3, 9, 0], 1282 [12, 3, 11, 4]]), num.array([[ 0, 4, 9, 3], 1283 [ 1, 4, 12, 5], 1284 [ 2, 7, 12, 4], 1285 [ 3, 8, 12, 7], 1286 [ 5, 0, 9, 1], 1287 [ 6, 1, 9, 4]])], 1288 'ghost_boundary': [{(13, 1): 'ghost', (8, 0): 'ghost', (14, 1): 'ghost', \ 1289 (11, 1): 'ghost', (10, 1): 'ghost', (5, 1): 'ghost', (10, 2): 'ghost'}, \ 1290 {(12, 2): 'ghost', (12, 0): 'ghost', (2, 1): 'ghost', (11, 1): 'ghost',\ 1291 (2, 2): 'ghost', (4, 1): 'ghost', (4, 0): 'ghost'}, {(3, 2): 'ghost', \ 1292 (6, 1): 'ghost', (3, 1): 'ghost', (5, 1): 'ghost', (1, 0): 'ghost', (1, 1): 'ghost'}], 1293 'full_triangles': [[[4, 9, 3], [4, 12, 5], [7, 12, 4], [8, 12, 7], [5, 12, 8]], \ 1294 [[0, 9, 1], [1, 9, 4], [1, 10, 2], [4, 10, 1], [5, 10, 4], [2, 10, 5]], \ 1295 [[3, 9, 0], [3, 11, 4], [6, 11, 3], [7, 11, 6], [4, 11, 7]]], 1296 'full_commun': [{0: [1, 2], 1: [1, 2], 2: [1, 2], 3: [2], 4: [1]}, \ 1297 {5: [0, 2], 6: [0, 2], 7: [], 8: [0], 9: [0], 10: [0]}, \ 1298 {11: [0, 1], 12: [0, 1], 13: [0], 14: [0], 15: [0]}], 1299 'ghost_commun': [num.array([[ 5, 1], 1300 [ 6, 1], 1301 [ 8, 1], 1302 [ 9, 1], 1303 [10, 1], 1304 [11, 2], 1305 [12, 2], 1306 [13, 2], 1307 [14, 2], 1308 [15, 2]]), num.array([[ 0, 0], 1309 [ 1, 0], 1310 [ 2, 0], 1311 [ 4, 0], 1312 [11, 2], 1313 [12, 2]]), num.array([[0, 0], 1314 [1, 0], 1315 [2, 0], 1316 [3, 0], 1317 [5, 1], 1318 [6, 1]])], 'ghost_quan': {'stage': [num.array([[-0. , -0.125, -0. ], 1319 [-0. , -0.125, -0.25 ], 1320 [-0.25 , -0.125, -0. ], 1321 [-0.25 , -0.125, -0.25 ], 1322 [-0. , -0.125, -0.25 ], 1323 [-0.25 , -0.125, -0. ], 1324 [-0.25 , -0.375, -0.25 ], 1325 [-0.5 , -0.375, -0.25 ], 1326 [-0.5 , -0.375, -0.5 ], 1327 [-0.25 , -0.375, -0.5 ]]), num.array([[-0.25 , -0.125, -0.25 ], 1328 [-0.25 , -0.375, -0.25 ], 1329 [-0.5 , -0.375, -0.25 ], 1330 [-0.25 , -0.375, -0.5 ], 1331 [-0.25 , -0.125, -0. ], 1332 [-0.25 , -0.375, -0.25 ]]), num.array([[-0.25 , -0.125, -0.25 ], 1333 [-0.25 , -0.375, -0.25 ], 1334 [-0.5 , -0.375, -0.25 ], 1335 [-0.5 , -0.375, -0.5 ], 1336 [-0. , -0.125, -0. ], 1337 [-0. , -0.125, -0.25 ]])], 'elevation': [num.array([[-0. , -0.125, -0. ], 1338 [-0. , -0.125, -0.25 ], 1339 [-0.25 , -0.125, -0. ], 1340 [-0.25 , -0.125, -0.25 ], 1341 [-0. , -0.125, -0.25 ], 1342 [-0.25 , -0.125, -0. ], 1343 [-0.25 , -0.375, -0.25 ], 1344 [-0.5 , -0.375, -0.25 ], 1345 [-0.5 , -0.375, -0.5 ], 1346 [-0.25 , -0.375, -0.5 ]]), num.array([[-0.25 , -0.125, -0.25 ], 1347 [-0.25 , -0.375, -0.25 ], 1348 [-0.5 , -0.375, -0.25 ], 1349 [-0.25 , -0.375, -0.5 ], 1350 [-0.25 , -0.125, -0. ], 1351 [-0.25 , -0.375, -0.25 ]]), num.array([[-0.25 , -0.125, -0.25 ], 1352 [-0.25 , -0.375, -0.25 ], 1353 [-0.5 , -0.375, -0.25 ], 1354 [-0.5 , -0.375, -0.5 ], 1355 [-0. , -0.125, -0. ], 1356 [-0. , -0.125, -0.25 ]])], 'ymomentum': [num.array([[ 0. , 0.25, 0.5 ], 1357 [ 0.5 , 0.25, 0.5 ], 1358 [ 0.5 , 0.75, 0.5 ], 1359 [ 1. , 0.75, 0.5 ], 1360 [ 1. , 0.75, 1. ], 1361 [ 0. , 0.25, 0. ], 1362 [ 0. , 0.25, 0.5 ], 1363 [ 0. , 0.25, 0. ], 1364 [ 0.5 , 0.25, 0. ], 1365 [ 0.5 , 0.25, 0.5 ]]), num.array([[ 0.5 , 0.25, 0. ], 1366 [ 0.5 , 0.75, 1. ], 1367 [ 0.5 , 0.75, 0.5 ], 1368 [ 1. , 0.75, 1. ], 1369 [ 0. , 0.25, 0. ], 1370 [ 0. , 0.25, 0.5 ]]), num.array([[ 0.5 , 0.25, 0. ], 1371 [ 0.5 , 0.75, 1. ], 1372 [ 0.5 , 0.75, 0.5 ], 1373 [ 1. , 0.75, 0.5 ], 1374 [ 0. , 0.25, 0.5 ], 1375 [ 0.5 , 0.25, 0.5 ]])], 'friction': [num.array([[ 0., 0., 0.], 1376 [ 0., 0., 0.], 1377 [ 0., 0., 0.], 1378 [ 0., 0., 0.], 1379 [ 0., 0., 0.], 1380 [ 0., 0., 0.], 1381 [ 0., 0., 0.], 1382 [ 0., 0., 0.], 1383 [ 0., 0., 0.], 1384 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1385 [ 0., 0., 0.], 1386 [ 0., 0., 0.], 1387 [ 0., 0., 0.], 1388 [ 0., 0., 0.], 1389 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1390 [ 0., 0., 0.], 1391 [ 0., 0., 0.], 1392 [ 0., 0., 0.], 1393 [ 0., 0., 0.], 1394 [ 0., 0., 0.]])], 'xmomentum': [num.array([[ 2., 2., 2.], 1395 [ 2., 2., 2.], 1396 [ 2., 2., 2.], 1397 [ 2., 2., 2.], 1398 [ 2., 2., 2.], 1399 [ 2., 2., 2.], 1400 [ 2., 2., 2.], 1401 [ 2., 2., 2.], 1402 [ 2., 2., 2.], 1403 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1404 [ 2., 2., 2.], 1405 [ 2., 2., 2.], 1406 [ 2., 2., 2.], 1407 [ 2., 2., 2.], 1408 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1409 [ 2., 2., 2.], 1410 [ 2., 2., 2.], 1411 [ 2., 2., 2.], 1412 [ 2., 2., 2.], 1413 [ 2., 2., 2.]])]}, 'full_quan': {'stage': [num.array([[-0.25 , -0.125, -0.25 ], 1414 [-0.25 , -0.375, -0.25 ], 1415 [-0.5 , -0.375, -0.25 ], 1416 [-0.5 , -0.375, -0.5 ], 1417 [-0.25 , -0.375, -0.5 ]]), num.array([[-0. , -0.125, -0. ], 1418 [-0. , -0.125, -0.25 ], 1419 [-0. , -0.125, -0. ], 1420 [-0.25 , -0.125, -0. ], 1421 [-0.25 , -0.125, -0.25 ], 1422 [-0. , -0.125, -0.25 ]]), num.array([[-0.25 , -0.125, -0. ], 1423 [-0.25 , -0.375, -0.25 ], 1424 [-0.5 , -0.375, -0.25 ], 1425 [-0.5 , -0.375, -0.5 ], 1426 [-0.25 , -0.375, -0.5 ]])], 'elevation': [num.array([[-0.25 , -0.125, -0.25 ], 1427 [-0.25 , -0.375, -0.25 ], 1428 [-0.5 , -0.375, -0.25 ], 1429 [-0.5 , -0.375, -0.5 ], 1430 [-0.25 , -0.375, -0.5 ]]), num.array([[-0. , -0.125, -0. ], 1431 [-0. , -0.125, -0.25 ], 1432 [-0. , -0.125, -0. ], 1433 [-0.25 , -0.125, -0. ], 1434 [-0.25 , -0.125, -0.25 ], 1435 [-0. , -0.125, -0.25 ]]), num.array([[-0.25 , -0.125, -0. ], 1436 [-0.25 , -0.375, -0.25 ], 1437 [-0.5 , -0.375, -0.25 ], 1438 [-0.5 , -0.375, -0.5 ], 1439 [-0.25 , -0.375, -0.5 ]])], 'ymomentum': [num.array([[ 0.5 , 0.25, 0. ], 1440 [ 0.5 , 0.75, 1. ], 1441 [ 0.5 , 0.75, 0.5 ], 1442 [ 1. , 0.75, 0.5 ], 1443 [ 1. , 0.75, 1. ]]), num.array([[ 0. , 0.25, 0.5 ], 1444 [ 0.5 , 0.25, 0.5 ], 1445 [ 0.5 , 0.75, 1. ], 1446 [ 0.5 , 0.75, 0.5 ], 1447 [ 1. , 0.75, 0.5 ], 1448 [ 1. , 0.75, 1. ]]), num.array([[ 0. , 0.25, 0. ], 1449 [ 0. , 0.25, 0.5 ], 1450 [ 0. , 0.25, 0. ], 1451 [ 0.5 , 0.25, 0. ], 1452 [ 0.5 , 0.25, 0.5 ]])], 'friction': [num.array([[ 0., 0., 0.], 1453 [ 0., 0., 0.], 1454 [ 0., 0., 0.], 1455 [ 0., 0., 0.], 1456 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1457 [ 0., 0., 0.], 1458 [ 0., 0., 0.], 1459 [ 0., 0., 0.], 1460 [ 0., 0., 0.], 1461 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1462 [ 0., 0., 0.], 1463 [ 0., 0., 0.], 1464 [ 0., 0., 0.], 1465 [ 0., 0., 0.]])], 'xmomentum': [num.array([[ 2., 2., 2.], 1466 [ 2., 2., 2.], 1467 [ 2., 2., 2.], 1468 [ 2., 2., 2.], 1469 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1470 [ 2., 2., 2.], 1471 [ 2., 2., 2.], 1472 [ 2., 2., 2.], 1473 [ 2., 2., 2.], 1474 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1475 [ 2., 2., 2.], 1476 [ 2., 2., 2.], 1477 [ 2., 2., 2.], 1478 [ 2., 2., 2.]])]}} 1479 1480 1481 # Subdivide into non-overlapping partitions 1482 submesh = build_submesh(nodes, triangles, boundary, quantities, 1483 triangles_per_proc, parameters = None) 1484 1485 1486 for i in range(3): 1487 assert num.allclose(true_submesh['full_triangles'][i],submesh['full_triangles'][i]) 1488 assert num.allclose(true_submesh['full_nodes'][i],submesh['full_nodes'][i]) 1489 assert num.allclose(true_submesh['ghost_triangles'][i],submesh['ghost_triangles'][i]) 1490 assert num.allclose(true_submesh['ghost_nodes'][i],submesh['ghost_nodes'][i]) 1491 assert num.allclose(true_submesh['ghost_commun'][i],submesh['ghost_commun'][i]) 1492 1493 assert true_submesh['full_boundary'] == submesh['full_boundary'] 1494 assert true_submesh['full_commun'] == submesh['full_commun'] 1495 1496 for key, value in true_submesh['ghost_quan'].iteritems(): 1497 for i in range(3): 1498 assert num.allclose(true_submesh['ghost_quan'][key][i],submesh['ghost_quan'][key][i]) 1499 assert num.allclose(true_submesh['full_quan'][key][i],submesh['full_quan'][key][i]) 1500 1501 1502 # Now test the extract_submesh for the 3 processors 1503 1504 submesh_cell_0 = extract_submesh(submesh,triangles_per_proc,0) 1505 submesh_cell_1 = extract_submesh(submesh,triangles_per_proc,1) 1506 submesh_cell_2 = extract_submesh(submesh,triangles_per_proc,2) 1507 1508 1509 from pprint import pprint 1510 1511 pprint(submesh_cell_1) 1136 1512 1137 1513 #------------------------------------------------------------- -
trunk/anuga_core/source/anuga_parallel/test_parallel_distribute_mesh.py
r8540 r8605 13 13 from anuga_parallel.distribute_mesh import build_submesh 14 14 from anuga_parallel.distribute_mesh import submesh_full, submesh_ghost, submesh_quantities 15 from anuga_parallel.distribute_mesh import extract_ hostmesh, rec_submesh, send_submesh15 from anuga_parallel.distribute_mesh import extract_submesh, rec_submesh, send_submesh 16 16 17 17 from anuga_parallel import myid, numprocs, barrier, finalize … … 193 193 194 194 #---------------------------------------------------------------------------------- 195 # Test extract_ hostmesh195 # Test extract_submesh 196 196 #---------------------------------------------------------------------------------- 197 197 points, vertices, boundary, quantities, \ 198 198 ghost_recv_dict, full_send_dict, tri_map, node_map, ghost_layer_width =\ 199 extract_ hostmesh(submesh, triangles_per_proc)199 extract_submesh(submesh, triangles_per_proc) 200 200 201 201
Note: See TracChangeset
for help on using the changeset viewer.