Changeset 431
- Timestamp:
- Oct 20, 2004, 3:15:06 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pmesh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pmesh/mesh.py
r420 r431 1568 1568 vert = [float(fragments.pop(0)),float(fragments.pop(0))] 1569 1569 points.append(vert) 1570 ThisVertIndex = len(points)-11571 segment = [PreviousVertIndex, ThisVertIndex]1570 thisVertIndex = len(points)-1 1571 segment = [PreviousVertIndex,thisVertIndex] 1572 1572 segments.append(segment) 1573 PreviousVertIndex = ThisVertIndex1573 PreviousVertIndex = thisVertIndex 1574 1574 line = fd.readline() #Read the next line 1575 1575 i =+ 1 1576 # If the last and first segments are the same, 1576 1577 # Remove the last segment and the last vertex 1577 1578 # then add a segment from the second last vert to the 1st vert 1578 points.pop() 1579 segments.pop() 1580 ThisVertIndex = len(points)-1 1581 segments.append([ThisVertIndex, firstVertIndex]) 1579 thisVertIndex = len(points)-1 1580 firstVert = points[firstVertIndex] 1581 thisVert = points[thisVertIndex] 1582 #print "firstVert",firstVert 1583 #print "thisVert",thisVert 1584 if (firstVert[0] == thisVert[0] and firstVert[1] == thisVert[1]): 1585 points.pop() 1586 segments.pop() 1587 thisVertIndex = len(points)-1 1588 segments.append([thisVertIndex, firstVertIndex]) 1582 1589 1583 1590 line = fd.readline() # read <# of polynomial> <x> <y> OR END -
inundation/ga/storm_surge/pmesh/meshHarness.py
r407 r431 593 593 'same_x_y False failed') 594 594 595 def tes zt_import_mesh(self):595 def test_import_mesh(self): 596 596 597 597 a_att = [5.0,2.0] … … 891 891 self.failUnless(m.userSegments[10].marker == tag, 892 892 'wrong tag.') 893 894 def test_ungenerateFileLoadingII(self): 895 896 fileName = tempfile.mktemp(".txt") 897 file = open(fileName,"w") 898 file.write(" 1 ?? ??\n\ 899 0.0 0.0\n\ 900 1.0 0.0\n\ 901 1.0 1.0\n\ 902 0.0 1.0\n\ 903 0.0 0.0\n\ 904 END\n\ 905 2 ?? ??\n\ 906 10.0 10.0\n\ 907 10.0 20.0\n\ 908 20.0 20.0\n\ 909 END\n\ 910 END\n") 911 file.close() 912 913 914 a = Vertex (0.0, 0.0) #, attributes = [1.1]) 915 b = Vertex (0.0, 40.0) #, attributes = [1.2]) 916 c = Vertex (40.0,40.0) #, attributes = [1.3]) 917 d = Vertex (40.0,0.0) #, attributes = [1.4]) 918 919 s1 = Segment(a,b) 920 s2 = Segment(b,c) 921 s3 = Segment(c,d) 922 s4 = Segment(d,a) 923 924 m = Mesh(userVertices=[a,b,c,d], userSegments=[s1,s2,s3,s4]) 925 dict = importUngenerateFile(fileName) 926 927 tag = "DSG" 928 Segment.set_default_tag(tag) 929 m.addVertsSegs(dict) 930 931 # have to reset this , since it's a class attribute 932 Segment.set_default_tag("") 933 934 self.failUnless(len(m.userSegments) ==10, 935 'Wrong segment list length.') 936 self.failUnless(len(m.userVertices) == 11, 937 'Wrong vertex list length.') 893 938 894 939 #-------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.