Changeset 1421 for inundation/ga/storm_surge/pmesh/mesh.py
- Timestamp:
- May 18, 2005, 4:19:43 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pmesh/mesh.py
r1401 r1421 811 811 return len(identicalSegs) == 0 812 812 813 def representedAlphaUserSegment(self, v1,v2):814 identicalSegs= [x for x in self.alphaUserSegments if (x.vertices[0] == v1 and x.vertices[1] == v2) or (x.vertices[0] == v2 and x.vertices[1] == v1) ]815 816 if identicalSegs == []:817 return None818 else:819 # Only return the first one.820 return identicalSegs[0]821 822 def representedUserSegment(self, v1,v2):823 identicalSegs= [x for x in self.userSegments if (x.vertices[0] == v1 and x.vertices[1] == v2) or (x.vertices[0] == v2 and x.vertices[1] == v1) ]824 825 if identicalSegs == []:826 return None827 else:828 # Only return the first one.829 return identicalSegs[0]830 813 831 814 def deleteSegsOfVertex(self, delVertex): … … 1307 1290 self.shape = alpha_shape.alpha_shape.Alpha_Shape(points, alpha = alpha) 1308 1291 1292 1309 1293 def _boundary2mesh(self, raw_boundary=True, 1294 remove_holes=False, 1295 smooth_indents=False, 1296 expand_pinch=False): 1297 """ 1298 Precon there must be a shape object. 1299 """ 1300 self.shape.set_boundary_type(raw_boundary=raw_boundary, 1301 remove_holes=remove_holes, 1302 smooth_indents=smooth_indents, 1303 expand_pinch=expand_pinch) 1304 boundary_segs = self.shape.get_boundary() 1305 #print "boundary_segs",boundary_segs 1306 segs2delete = self.alphaUserSegments 1307 #FIXME(DSG-DSG) this algorithm needs comments 1308 #FIXME(DSG-DSG) can it be sped up? It's slow 1309 new_segs = {} 1310 #alpha_segs = [] 1311 #user_segs = [] 1312 for seg in boundary_segs: 1313 v1 = self.userVertices[int(seg[0])] 1314 v2 = self.userVertices[int(seg[1])] 1315 boundary_seg = Segment(v1, v2) 1316 new_segs[(v1,v2)] = boundary_seg 1317 1318 for user_seg in self.userSegments: 1319 if new_segs.has_key((user_seg.vertices[0], 1320 user_seg.vertices[1])): 1321 del new_segs[user_seg.vertices[0], 1322 user_seg.vertices[1]] 1323 elif new_segs.has_key((user_seg.vertices[1], 1324 user_seg.vertices[0])): 1325 del new_segs[user_seg.vertices[1], 1326 user_seg.vertices[0]] 1327 1328 optimum_alpha = self.shape.get_alpha() 1329 alpha_segs_no_user_segs = new_segs.values() 1330 self.alphaUserSegments = alpha_segs_no_user_segs 1331 return alpha_segs_no_user_segs, segs2delete, optimum_alpha 1332 1333 def _boundary2mesh_old(self, raw_boundary=True, 1310 1334 remove_holes=False, 1311 1335 smooth_indents=False, … … 1355 1379 # need to draw newsegs 1356 1380 return new_segs, segs2delete, optimum_alpha 1357 1381 1382 def representedAlphaUserSegment(self, v1,v2): 1383 identicalSegs= [x for x in self.alphaUserSegments if (x.vertices[0] == v1 and x.vertices[1] == v2) or (x.vertices[0] == v2 and x.vertices[1] == v1) ] 1384 1385 if identicalSegs == []: 1386 return None 1387 else: 1388 # Only return the first one. 1389 return identicalSegs[0] 1390 1391 def representedUserSegment(self, v1,v2): 1392 identicalSegs= [x for x in self.userSegments if (x.vertices[0] == v1 and x.vertices[1] == v2) or (x.vertices[0] == v2 and x.vertices[1] == v1) ] 1393 1394 if identicalSegs == []: 1395 return None 1396 else: 1397 # Only return the first one. 1398 return identicalSegs[0] 1399 1358 1400 def joinVertices(self): 1359 1401 """
Note: See TracChangeset
for help on using the changeset viewer.