Ignore:
Timestamp:
May 16, 2005, 11:22:40 AM (19 years ago)
Author:
duncan
Message:

load_mesh refactoring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pmesh/mesh.py

    r1365 r1395  
    17311731                            self.regions)
    17321732       
    1733         # exportASCIImeshfile   
     1733        # exportASCIImeshfile   - this function is used
    17341734    def export_mesh_file(self,ofile):
    17351735        """
     
    17731773            raise RuntimeError
    17741774        numVertAttrib = str(len(Vertices[0].attributes))
    1775         title = numVert + " " + numVertAttrib + " # <vertex #> <x> <y> [attributes]"
     1775        #title = numVert + " " + numVertAttrib + " # <vertex #> <x> <y> [attributes]"
    17761776
    17771777        #Convert the Vertices to pointlist and pointattributelist
     
    17881788        xya_dict['geo_reference'] = self.geo_reference
    17891789
    1790         load_mesh.loadASCII.export_xya_file(ofile, xya_dict, title, delimiter = " ")
     1790        load_mesh.loadASCII.export_points_file(ofile, xya_dict)
    17911791
    17921792       
     
    27322732def importMeshFromFile(ofile):
    27332733    """returns a mesh object, made from a .xya/.pts or .tsh/.msh file
    2734     Often raises SyntaxError, IOError
     2734    Often raises IOError,RuntimeError
    27352735    """
    27362736    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)
    27592739        dict['points'] = dict['pointlist']
    27602740        dict['outline_segments'] = []
     
    27652745        dict['holes'] = []
    27662746        newmesh= Mesh(geo_reference = dict['geo_reference'])
    2767         newmesh.IOOutline2Mesh(dict) #FIXME use IOOutline2Mesh
     2747        newmesh.IOOutline2Mesh(dict)
    27682748        counter = newmesh.removeDuplicatedUserVertices()
    27692749        if (counter >0):
    2770             print "%i duplicate vertices removed from dataset" % (counter) 
     2750            print "%i duplicate vertices removed from dataset" % (counter)
    27712751    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)
    27732753        #print "********"
    27742754        #print "zq mesh.dict",dict
Note: See TracChangeset for help on using the changeset viewer.