Changeset 8540
- Timestamp:
- Aug 28, 2012, 5:15:43 PM (13 years ago)
- Location:
- trunk/anuga_core/source/anuga_parallel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga_parallel/test_distribute_mesh.py
r8538 r8540 581 581 triangles_per_proc = [5, 6, 5] 582 582 583 584 quantities = {'stage': num.array([[-0.25 , -0.125, -0.25 ], 585 [-0.25 , -0.375, -0.25 ], 586 [-0.5 , -0.375, -0.25 ], 587 [-0.5 , -0.375, -0.5 ], 588 [-0.25 , -0.375, -0.5 ], 589 [-0. , -0.125, -0. ], 590 [-0. , -0.125, -0.25 ], 591 [-0. , -0.125, -0. ], 592 [-0.25 , -0.125, -0. ], 593 [-0.25 , -0.125, -0.25 ], 594 [-0. , -0.125, -0.25 ], 595 [-0.25 , -0.125, -0. ], 596 [-0.25 , -0.375, -0.25 ], 597 [-0.5 , -0.375, -0.25 ], 598 [-0.5 , -0.375, -0.5 ], 599 [-0.25 , -0.375, -0.5 ]]), 'elevation': num.array([[-0.25 , -0.125, -0.25 ], 600 [-0.25 , -0.375, -0.25 ], 601 [-0.5 , -0.375, -0.25 ], 602 [-0.5 , -0.375, -0.5 ], 603 [-0.25 , -0.375, -0.5 ], 604 [-0. , -0.125, -0. ], 605 [-0. , -0.125, -0.25 ], 606 [-0. , -0.125, -0. ], 607 [-0.25 , -0.125, -0. ], 608 [-0.25 , -0.125, -0.25 ], 609 [-0. , -0.125, -0.25 ], 610 [-0.25 , -0.125, -0. ], 611 [-0.25 , -0.375, -0.25 ], 612 [-0.5 , -0.375, -0.25 ], 613 [-0.5 , -0.375, -0.5 ], 614 [-0.25 , -0.375, -0.5 ]]), 'ymomentum': num.array([[ 0.5 , 0.25, 0. ], 615 [ 0.5 , 0.75, 1. ], 616 [ 0.5 , 0.75, 0.5 ], 617 [ 1. , 0.75, 0.5 ], 618 [ 1. , 0.75, 1. ], 619 [ 0. , 0.25, 0.5 ], 620 [ 0.5 , 0.25, 0.5 ], 621 [ 0.5 , 0.75, 1. ], 622 [ 0.5 , 0.75, 0.5 ], 623 [ 1. , 0.75, 0.5 ], 624 [ 1. , 0.75, 1. ], 625 [ 0. , 0.25, 0. ], 626 [ 0. , 0.25, 0.5 ], 627 [ 0. , 0.25, 0. ], 628 [ 0.5 , 0.25, 0. ], 629 [ 0.5 , 0.25, 0.5 ]]), 'friction': num.array([[ 0., 0., 0.], 630 [ 0., 0., 0.], 631 [ 0., 0., 0.], 632 [ 0., 0., 0.], 633 [ 0., 0., 0.], 634 [ 0., 0., 0.], 635 [ 0., 0., 0.], 636 [ 0., 0., 0.], 637 [ 0., 0., 0.], 638 [ 0., 0., 0.], 639 [ 0., 0., 0.], 640 [ 0., 0., 0.], 641 [ 0., 0., 0.], 642 [ 0., 0., 0.], 643 [ 0., 0., 0.], 644 [ 0., 0., 0.]]), 'xmomentum': num.array([[ 2., 2., 2.], 645 [ 2., 2., 2.], 646 [ 2., 2., 2.], 647 [ 2., 2., 2.], 648 [ 2., 2., 2.], 649 [ 2., 2., 2.], 650 [ 2., 2., 2.], 651 [ 2., 2., 2.], 652 [ 2., 2., 2.], 653 [ 2., 2., 2.], 654 [ 2., 2., 2.], 655 [ 2., 2., 2.], 656 [ 2., 2., 2.], 657 [ 2., 2., 2.], 658 [ 2., 2., 2.], 659 [ 2., 2., 2.]])} 583 660 584 661 … … 858 935 submesh = submesh_ghost(submesh, mesh, triangles_per_proc, parameters) 859 936 860 print submesh 861 862 print 'ghost_triangles', submesh['ghost_triangles'] 863 print 'ghost_boundary[0]', submesh['ghost_boundary'][0] 864 print 'ghost_boundary[1]', submesh['ghost_boundary'][1] 865 print 'ghost_boundary[2]', submesh['ghost_boundary'][2] 866 print 'ghost_nodes', submesh['ghost_nodes'] 867 print 'ghost_commun', submesh['ghost_commun'] 868 937 #print submesh 938 939 #print 'ghost_triangles', submesh['ghost_triangles'] 940 #print 'ghost_boundary', submesh['ghost_boundary'] 941 #print 'ghost_nodes', submesh['ghost_nodes'] 942 #print 'ghost_commun', submesh['ghost_commun'] 943 944 945 true_submesh['ghost_boundary'] = [{(12, 2): 'ghost', (9, 0): 'ghost', (9, 2): 'ghost', \ 946 (6, 1): 'ghost', (15, 0): 'ghost', (11, 1): 'bottom', (11, 0): 'ghost', (6, 2): 'ghost'}, \ 947 {(0, 1): 'ghost', (1, 2): 'ghost', (1, 0): 'ghost', (11, 1): 'bottom'},\ 948 {(5, 1): 'left', (2, 0): 'ghost', (0, 2): 'ghost', (5, 0): 'ghost', (2, 2): 'ghost'}] 949 950 951 true_submesh['ghost_triangles'] = [num.array([[ 6, 1, 9, 4],\ 952 [ 9, 5, 10, 4],\ 953 [11, 3, 9, 0],\ 954 [12, 3, 11, 4],\ 955 [15, 4, 11, 7]]), \ 956 num.array([[ 0, 4, 9, 3],\ 957 [ 1, 4, 12, 5],\ 958 [11, 3, 9, 0]]),\ 959 num.array([[ 0, 4, 9, 3],\ 960 [ 2, 7, 12, 4],\ 961 [ 5, 0, 9, 1]])] 962 963 true_submesh['ghost_nodes'] = [num.array([[ 0. , 0. , 0. ],\ 964 [ 1. , 0. , 0.5 ],\ 965 [ 10. , 0.25, 0.75],\ 966 [ 11. , 0.75, 0.25]]),\ 967 num.array([[ 3. , 0.5 , 0. ],\ 968 [ 12. , 0.75, 0.75]]),\ 969 num.array([[ 1. , 0. , 0.5 ],\ 970 [ 12. , 0.75, 0.75]])] 971 972 true_submesh['ghost_commun'] = [num.array([[ 6, 1],\ 973 [ 9, 1],\ 974 [11, 2],\ 975 [12, 2],\ 976 [15, 2]]),\ 977 num.array([[ 0, 0],\ 978 [ 1, 0],\ 979 [11, 2]]),\ 980 num.array([[0, 0],\ 981 [2, 0],\ 982 [5, 1]])] 983 984 985 986 869 987 for i in range(3): 988 assert true_submesh['ghost_boundary'][i] == submesh['ghost_boundary'][i] 870 989 assert num.allclose(true_submesh['ghost_triangles'][i],submesh['ghost_triangles'][i]) 871 990 assert num.allclose(true_submesh['ghost_nodes'][i],submesh['ghost_nodes'][i]) 872 991 assert num.allclose(true_submesh['ghost_commun'][i],submesh['ghost_commun'][i]) 873 992 993 994 995 true_submesh['full_commun'] = [{0: [1, 2], 1: [1], 2: [2], 3: [], 4: []},\ 996 {5: [2], 6: [0], 7: [], 8: [], 9: [0], 10: []},\ 997 {11: [0, 1], 12: [0], 13: [], 14: [], 15: [0]}] 998 874 999 assert true_submesh['full_commun'] == submesh['full_commun'] 875 1000 … … 882 1007 triangles_per_proc) 883 1008 1009 1010 #print submesh['full_quan'] 1011 1012 1013 1014 true_submesh['full_quan'] = {'stage': [num.array([[-0.25 , -0.125, -0.25 ], 1015 [-0.25 , -0.375, -0.25 ], 1016 [-0.5 , -0.375, -0.25 ], 1017 [-0.5 , -0.375, -0.5 ], 1018 [-0.25 , -0.375, -0.5 ]]), num.array([[-0. , -0.125, -0. ], 1019 [-0. , -0.125, -0.25 ], 1020 [-0. , -0.125, -0. ], 1021 [-0.25 , -0.125, -0. ], 1022 [-0.25 , -0.125, -0.25 ], 1023 [-0. , -0.125, -0.25 ]]), num.array([[-0.25 , -0.125, -0. ], 1024 [-0.25 , -0.375, -0.25 ], 1025 [-0.5 , -0.375, -0.25 ], 1026 [-0.5 , -0.375, -0.5 ], 1027 [-0.25 , -0.375, -0.5 ]])], 'elevation': [num.array([[-0.25 , -0.125, -0.25 ], 1028 [-0.25 , -0.375, -0.25 ], 1029 [-0.5 , -0.375, -0.25 ], 1030 [-0.5 , -0.375, -0.5 ], 1031 [-0.25 , -0.375, -0.5 ]]), num.array([[-0. , -0.125, -0. ], 1032 [-0. , -0.125, -0.25 ], 1033 [-0. , -0.125, -0. ], 1034 [-0.25 , -0.125, -0. ], 1035 [-0.25 , -0.125, -0.25 ], 1036 [-0. , -0.125, -0.25 ]]), num.array([[-0.25 , -0.125, -0. ], 1037 [-0.25 , -0.375, -0.25 ], 1038 [-0.5 , -0.375, -0.25 ], 1039 [-0.5 , -0.375, -0.5 ], 1040 [-0.25 , -0.375, -0.5 ]])], 'ymomentum': [num.array([[ 0.5 , 0.25, 0. ], 1041 [ 0.5 , 0.75, 1. ], 1042 [ 0.5 , 0.75, 0.5 ], 1043 [ 1. , 0.75, 0.5 ], 1044 [ 1. , 0.75, 1. ]]), num.array([[ 0. , 0.25, 0.5 ], 1045 [ 0.5 , 0.25, 0.5 ], 1046 [ 0.5 , 0.75, 1. ], 1047 [ 0.5 , 0.75, 0.5 ], 1048 [ 1. , 0.75, 0.5 ], 1049 [ 1. , 0.75, 1. ]]), num.array([[ 0. , 0.25, 0. ], 1050 [ 0. , 0.25, 0.5 ], 1051 [ 0. , 0.25, 0. ], 1052 [ 0.5 , 0.25, 0. ], 1053 [ 0.5 , 0.25, 0.5 ]])], 'friction': [num.array([[ 0., 0., 0.], 1054 [ 0., 0., 0.], 1055 [ 0., 0., 0.], 1056 [ 0., 0., 0.], 1057 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1058 [ 0., 0., 0.], 1059 [ 0., 0., 0.], 1060 [ 0., 0., 0.], 1061 [ 0., 0., 0.], 1062 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1063 [ 0., 0., 0.], 1064 [ 0., 0., 0.], 1065 [ 0., 0., 0.], 1066 [ 0., 0., 0.]])], 'xmomentum': [num.array([[ 2., 2., 2.], 1067 [ 2., 2., 2.], 1068 [ 2., 2., 2.], 1069 [ 2., 2., 2.], 1070 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1071 [ 2., 2., 2.], 1072 [ 2., 2., 2.], 1073 [ 2., 2., 2.], 1074 [ 2., 2., 2.], 1075 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1076 [ 2., 2., 2.], 1077 [ 2., 2., 2.], 1078 [ 2., 2., 2.], 1079 [ 2., 2., 2.]])]} 1080 1081 1082 true_submesh['ghost_quan'] = {'stage': [num.array([[-0. , -0.125, -0.25 ], 1083 [-0.25 , -0.125, -0.25 ], 1084 [-0.25 , -0.125, -0. ], 1085 [-0.25 , -0.375, -0.25 ], 1086 [-0.25 , -0.375, -0.5 ]]), num.array([[-0.25 , -0.125, -0.25 ], 1087 [-0.25 , -0.375, -0.25 ], 1088 [-0.25 , -0.125, -0. ]]), num.array([[-0.25 , -0.125, -0.25 ], 1089 [-0.5 , -0.375, -0.25 ], 1090 [-0. , -0.125, -0. ]])], 'elevation': [num.array([[-0. , -0.125, -0.25 ], 1091 [-0.25 , -0.125, -0.25 ], 1092 [-0.25 , -0.125, -0. ], 1093 [-0.25 , -0.375, -0.25 ], 1094 [-0.25 , -0.375, -0.5 ]]), num.array([[-0.25 , -0.125, -0.25 ], 1095 [-0.25 , -0.375, -0.25 ], 1096 [-0.25 , -0.125, -0. ]]), num.array([[-0.25 , -0.125, -0.25 ], 1097 [-0.5 , -0.375, -0.25 ], 1098 [-0. , -0.125, -0. ]])], 'ymomentum': [num.array([[ 0.5 , 0.25, 0.5 ], 1099 [ 1. , 0.75, 0.5 ], 1100 [ 0. , 0.25, 0. ], 1101 [ 0. , 0.25, 0.5 ], 1102 [ 0.5 , 0.25, 0.5 ]]), num.array([[ 0.5 , 0.25, 0. ], 1103 [ 0.5 , 0.75, 1. ], 1104 [ 0. , 0.25, 0. ]]), num.array([[ 0.5 , 0.25, 0. ], 1105 [ 0.5 , 0.75, 0.5 ], 1106 [ 0. , 0.25, 0.5 ]])], 'friction': [num.array([[ 0., 0., 0.], 1107 [ 0., 0., 0.], 1108 [ 0., 0., 0.], 1109 [ 0., 0., 0.], 1110 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1111 [ 0., 0., 0.], 1112 [ 0., 0., 0.]]), num.array([[ 0., 0., 0.], 1113 [ 0., 0., 0.], 1114 [ 0., 0., 0.]])], 'xmomentum': [num.array([[ 2., 2., 2.], 1115 [ 2., 2., 2.], 1116 [ 2., 2., 2.], 1117 [ 2., 2., 2.], 1118 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1119 [ 2., 2., 2.], 1120 [ 2., 2., 2.]]), num.array([[ 2., 2., 2.], 1121 [ 2., 2., 2.], 1122 [ 2., 2., 2.]])]} 884 1123 885 1124 -
trunk/anuga_core/source/anuga_parallel/test_parallel_distribute_mesh.py
r8281 r8540 196 196 #---------------------------------------------------------------------------------- 197 197 points, vertices, boundary, quantities, \ 198 ghost_recv_dict, full_send_dict, tri_map, node_map 198 ghost_recv_dict, full_send_dict, tri_map, node_map, ghost_layer_width =\ 199 199 extract_hostmesh(submesh, triangles_per_proc) 200 200 … … 210 210 true_full_send = {1: [num.array([0, 1, 2, 4]), num.array([0, 1, 2, 4])], 2: [num.array([0, 1, 2, 3]), num.array([0, 1, 2, 3])]} 211 211 212 assert_(num.allclose(ghost_layer_width, 2)) 212 213 assert_(num.allclose(points, true_points)) 213 214 assert_(num.allclose(vertices, true_vertices)) … … 225 226 points, vertices, boundary, quantities, \ 226 227 ghost_recv_dict, full_send_dict, \ 227 no_full_nodes, no_full_trigs, tri_map, node_map = \228 no_full_nodes, no_full_trigs, tri_map, node_map, ghost_layer_width = \ 228 229 rec_submesh(0, verbose=False) 229 230 … … 243 244 true_node_map = num.array([ 0, 1, 2, 7, 3, 4, -1, 8, 9, 5, 6, 10, 11]) 244 245 246 assert_(num.allclose(ghost_layer_width, 2)) 245 247 assert_(num.allclose(tri_map, true_tri_map)) 246 248 assert_(num.allclose(node_map, true_node_map)) … … 267 269 true_node_map = num.array([ 0, 7, -1, 1, 2, 8 , 3, 4, 9, 5, -1, 6, 10]) 268 270 271 assert_(num.allclose(ghost_layer_width, 2)) 269 272 assert_(num.allclose(tri_map, true_tri_map)) 270 273 assert_(num.allclose(node_map, true_node_map))
Note: See TracChangeset
for help on using the changeset viewer.