Changeset 1395 for inundation/ga/storm_surge/pmesh/mesh.py
- Timestamp:
- May 16, 2005, 11:22:40 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pmesh/mesh.py
r1365 r1395 1731 1731 self.regions) 1732 1732 1733 # exportASCIImeshfile 1733 # exportASCIImeshfile - this function is used 1734 1734 def export_mesh_file(self,ofile): 1735 1735 """ … … 1773 1773 raise RuntimeError 1774 1774 numVertAttrib = str(len(Vertices[0].attributes)) 1775 title = numVert + " " + numVertAttrib + " # <vertex #> <x> <y> [attributes]"1775 #title = numVert + " " + numVertAttrib + " # <vertex #> <x> <y> [attributes]" 1776 1776 1777 1777 #Convert the Vertices to pointlist and pointattributelist … … 1788 1788 xya_dict['geo_reference'] = self.geo_reference 1789 1789 1790 load_mesh.loadASCII.export_ xya_file(ofile, xya_dict, title, delimiter = " ")1790 load_mesh.loadASCII.export_points_file(ofile, xya_dict) 1791 1791 1792 1792 … … 2732 2732 def importMeshFromFile(ofile): 2733 2733 """returns a mesh object, made from a .xya/.pts or .tsh/.msh file 2734 Often raises SyntaxError, IOError2734 Often raises IOError,RuntimeError 2735 2735 """ 2736 2736 newmesh = None 2737 if ofile[-4:]== ".xya": 2738 #print "loading " + ofile 2739 try: 2740 dict = load_mesh.loadASCII.load_points_file(ofile, delimiter = ',') 2741 except SyntaxError: 2742 dict = load_mesh.loadASCII.load_points_file(ofile, delimiter = ' ') 2743 #print "dict",dict outline_ 2744 dict['segmentlist'] = [] 2745 dict['segmenttaglist'] = [] 2746 dict['regionlist'] = [] 2747 dict['regionattributelist'] = [] 2748 dict['regionmaxarealist'] = [] 2749 dict['holelist'] = [] 2750 newmesh= Mesh() 2751 newmesh.setMesh(dict) #FIXME use IOOutline2Mesh 2752 counter = newmesh.removeDuplicatedUserVertices() 2753 if (counter >0): 2754 print "%i duplicate vertices removed from dataset" % (counter) 2755 elif ofile[-4:]== ".pts": 2756 #print "loading " + ofile 2757 dict = load_mesh.loadASCII.load_points_file(ofile) 2758 #print "dict",dict 2737 if (ofile[-4:]== ".xya" or ofile[-4:]== ".pts"): 2738 dict = load_mesh.loadASCII.import_points_file(ofile) 2759 2739 dict['points'] = dict['pointlist'] 2760 2740 dict['outline_segments'] = [] … … 2765 2745 dict['holes'] = [] 2766 2746 newmesh= Mesh(geo_reference = dict['geo_reference']) 2767 newmesh.IOOutline2Mesh(dict) #FIXME use IOOutline2Mesh2747 newmesh.IOOutline2Mesh(dict) 2768 2748 counter = newmesh.removeDuplicatedUserVertices() 2769 2749 if (counter >0): 2770 print "%i duplicate vertices removed from dataset" % (counter) 2750 print "%i duplicate vertices removed from dataset" % (counter) 2771 2751 elif (ofile[-4:]== ".tsh" or ofile[-4:]== ".msh"): 2772 dict = load_mesh.loadASCII.import_ triangulation(ofile)2752 dict = load_mesh.loadASCII.import_mesh_file(ofile) 2773 2753 #print "********" 2774 2754 #print "zq mesh.dict",dict
Note: See TracChangeset
for help on using the changeset viewer.