- Timestamp:
- Oct 3, 2006, 5:47:08 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/test_neighbour_mesh.py
r3560 r3684 13 13 from mesh_factory import rectangular 14 14 from anuga.config import epsilon 15 from Numeric import allclose, array 15 from Numeric import allclose, array, Int 16 16 17 17 from anuga.coordinate_transforms.geo_reference import Geo_reference 18 18 from anuga.utilities.polygon import is_inside_polygon 19 from anuga.utilities.numerical_tools import ensure_numeric 19 20 20 21 def distance(x, y): … … 909 910 910 911 912 def xtest_boundary_polygon_VI(self): 913 """test_boundary_polygon_VI(self) 914 915 Create a discontinuous mesh (duplicate vertices) from a real situation that failed 916 and check that boundary is as expected 917 """ 918 919 920 from anuga.utilities.polygon import plot_polygons 921 922 # First do the continuous version of mesh 923 924 points = [[ 6626.85400391, 0. ], 925 [ 0. , 38246.4140625 ], 926 [ 9656.2734375 , 68351.265625 ], 927 [ 20827.25585938, 77818.203125 ], 928 [ 32755.59375 , 58126.9765625 ], 929 [ 35406.3359375 , 79332.9140625 ], 930 [ 31998.23828125, 88799.84375 ], 931 [ 23288.65820313, 104704.296875 ], 932 [ 32187.57617188, 109816.4375 ], 933 [ 50364.08984375, 110763.1328125 ], 934 [ 80468.9453125 , 96184.0546875 ], 935 [ 86149.1015625 , 129886.34375 ], 936 [ 118715.359375 , 129886.34375 ], 937 [ 117768.6640625 , 85770.4296875 ], 938 [ 101485.5390625 , 45251.9453125 ], 939 [ 49985.4140625 , 2272.06396484], 940 [ 51737.94140625, 90559.2109375 ], 941 [ 56659.0703125 , 65907.6796875 ], 942 [ 75735.4765625 , 23762.00585938], 943 [ 52341.70703125, 38563.39453125]] 944 945 triangles = [[19, 0,15], 946 [ 2, 4, 3], 947 [ 4, 2, 1], 948 [ 1,19, 4], 949 [15,18,19], 950 [18,14,17], 951 [19, 1, 0], 952 [ 6, 8, 7], 953 [ 8, 6,16], 954 [10, 9,16], 955 [17, 5, 4], 956 [16,17,10], 957 [17,19,18], 958 [ 5,17,16], 959 [10,14,13], 960 [10,17,14], 961 [ 8,16, 9], 962 [12,11,10], 963 [10,13,12], 964 [19,17, 4], 965 [16, 6, 5]] 966 967 mesh = Mesh(points, triangles) 968 mesh.check_integrity() 969 Pref = mesh.get_boundary_polygon() 970 971 plot_polygons([ensure_numeric(Pref)], 'goodP') 972 973 for p in points: 974 assert is_inside_polygon(p, Pref) 975 976 977 # Then do the discontinuous version 978 import warnings 979 warnings.filterwarnings('ignore') 980 981 982 points = [[ 52341.70703125, 38563.39453125], 983 [ 6626.85400391, 0. ], 984 [ 49985.4140625 , 2272.06396484], 985 [ 9656.2734375 , 68351.265625 ], 986 [ 32755.59375 , 58126.9765625 ], 987 [ 20827.25585938, 77818.203125 ], 988 [ 32755.59375 , 58126.9765625 ], 989 [ 9656.2734375 , 68351.265625 ], 990 [ 0. , 38246.4140625 ], 991 [ 0. , 38246.4140625 ], 992 [ 52341.70703125, 38563.39453125], 993 [ 32755.59375 , 58126.9765625 ], 994 [ 49985.4140625 , 2272.06396484], 995 [ 75735.4765625 , 23762.00585938], 996 [ 52341.70703125, 38563.39453125], 997 [ 75735.4765625 , 23762.00585938], 998 [ 101485.5390625 , 45251.9453125 ], 999 [ 56659.0703125 , 65907.6796875 ], 1000 [ 52341.70703125, 38563.39453125], 1001 [ 0. , 38246.4140625 ], 1002 [ 6626.85400391, 0. ], 1003 [ 31998.23828125, 88799.84375 ], 1004 [ 32187.57617188, 109816.4375 ], 1005 [ 23288.65820313, 104704.296875 ], 1006 [ 32187.57617188, 109816.4375 ], 1007 [ 31998.23828125, 88799.84375 ], 1008 [ 51737.94140625, 90559.2109375 ], 1009 [ 80468.9453125 , 96184.0546875 ], 1010 [ 50364.08984375, 110763.1328125 ], 1011 [ 51737.94140625, 90559.2109375 ], 1012 [ 56659.0703125 , 65907.6796875 ], 1013 [ 35406.3359375 , 79332.9140625 ], 1014 [ 32755.59375 , 58126.9765625 ], 1015 [ 51737.94140625, 90559.2109375 ], 1016 [ 56659.0703125 , 65907.6796875 ], 1017 [ 80468.9453125 , 96184.0546875 ], 1018 [ 56659.0703125 , 65907.6796875 ], 1019 [ 52341.70703125, 38563.39453125], 1020 [ 75735.4765625 , 23762.00585938], 1021 [ 35406.3359375 , 79332.9140625 ], 1022 [ 56659.0703125 , 65907.6796875 ], 1023 [ 51737.94140625, 90559.2109375 ], 1024 [ 80468.9453125 , 96184.0546875 ], 1025 [ 101485.5390625 , 45251.9453125 ], 1026 [ 117768.6640625 , 85770.4296875 ], 1027 [ 80468.9453125 , 96184.0546875 ], 1028 [ 56659.0703125 , 65907.6796875 ], 1029 [ 101485.5390625 , 45251.9453125 ], 1030 [ 32187.57617188, 109816.4375 ], 1031 [ 51737.94140625, 90559.2109375 ], 1032 [ 50364.08984375, 110763.1328125 ], 1033 [ 118715.359375 , 129886.34375 ], 1034 [ 86149.1015625 , 129886.34375 ], 1035 [ 80468.9453125 , 96184.0546875 ], 1036 [ 80468.9453125 , 96184.0546875 ], 1037 [ 117768.6640625 , 85770.4296875 ], 1038 [ 118715.359375 , 129886.34375 ], 1039 [ 52341.70703125, 38563.39453125], 1040 [ 56659.0703125 , 65907.6796875 ], 1041 [ 32755.59375 , 58126.9765625 ], 1042 [ 51737.94140625, 90559.2109375 ], 1043 [ 31998.23828125, 88799.84375 ], 1044 [ 35406.3359375 , 79332.9140625 ]] 1045 1046 #points = ensure_numeric(points, Int)/1000 # Simplify for ease of interpretation 1047 1048 triangles = [[ 0, 1, 2], 1049 [ 3, 4, 5], 1050 [ 6, 7, 8], 1051 [ 9,10,11], 1052 [12,13,14], 1053 [15,16,17], 1054 [18,19,20], 1055 [21,22,23], 1056 [24,25,26], 1057 [27,28,29], 1058 [30,31,32], 1059 [33,34,35], 1060 [36,37,38], 1061 [39,40,41], 1062 [42,43,44], 1063 [45,46,47], 1064 [48,49,50], 1065 [51,52,53], 1066 [54,55,56], 1067 [57,58,59], 1068 [60,61,62]] 1069 1070 mesh = Mesh(points, triangles) 1071 mesh.check_integrity() 1072 P = mesh.get_boundary_polygon() 1073 1074 plot_polygons([ensure_numeric(P)], 'badP') 1075 print P 1076 1077 for p in points: 1078 #assert is_inside_polygon(p, P) 1079 if not is_inside_polygon(p, P): 1080 print 'Point %s is not in P' %(p) 1081 else: 1082 print 'Point %s OK' %(p) 1083 1084 #for i in range(len(Pref)): 1085 # print P[i], Pref[i] 1086 # 1087 #print ensure_numeric(P) - ensure_numeric(Pref) 1088 1089 1090 911 1091 def test_lone_vertices(self): 912 1092 a = [2.0, 1.0]
Note: See TracChangeset
for help on using the changeset viewer.