Index: /inundation/ga/storm_surge/pmesh/load_mesh/loadASCII.py
===================================================================
--- /inundation/ga/storm_surge/pmesh/load_mesh/loadASCII.py	(revision 363)
+++ /inundation/ga/storm_surge/pmesh/load_mesh/loadASCII.py	(revision 364)
@@ -67,4 +67,6 @@
         
     ######### loading the point title info
+    line = fd.readline()
+    #print "point title comments",line
     vertTitle = []
     for index in range(int(NumOfVertAttributes)):        
@@ -75,5 +77,5 @@
     ######### loading the triangle info
     line = fd.readline()
-    #print line
+    #print "triangle comments",line
     fragments = line.split()
     #for fragment in fragments:
@@ -103,5 +105,5 @@
     ######### loading the segment info
     line = fd.readline()
-    #print line
+    print "seg comment line",line
     fragments = line.split()
     #for fragment in fragments:
@@ -306,5 +308,14 @@
     vertices = gen_dict['generatedpointlist']
     vertices_attributes = gen_dict['generatedpointattributelist']
-    vertices_attribute_titles = gen_dict['generatedpointattributetitlelist']
+    try:
+        vertices_attribute_titles = gen_dict['generatedpointattributetitlelist']
+    
+    except KeyError, e:
+        #FIXME is this the best way? 
+        if vertices_attributes == [] or vertices_attributes[0] == []:
+             vertices_attribute_titles = []
+        else:
+            raise KeyError, e 
+        
     triangles = gen_dict['generatedtrianglelist']
     triangles_attributes = gen_dict['generatedtriangleattributelist']
@@ -335,5 +346,5 @@
 
     # write comments for title
-    fd.write(" # attribute column titles ...Triangulation Vertex Titles..." + "\n")
+    fd.write("# attribute column titles ...Triangulation Vertex Titles..." + "\n")
     for title in vertices_attribute_titles:
         fd.write(title + "\n")
Index: /inundation/ga/storm_surge/pmesh/load_mesh/loadASCIIHarness.py
===================================================================
--- /inundation/ga/storm_surge/pmesh/load_mesh/loadASCIIHarness.py	(revision 363)
+++ /inundation/ga/storm_surge/pmesh/load_mesh/loadASCIIHarness.py	(revision 364)
@@ -25,8 +25,8 @@
         e_att = [2,2]
         a_xy = [0.0, 0.0]
-        a = Vertex ( a_xy[0],a_xy[1], attributes =a_att)
-        d = Vertex (0.0, 4.0, attributes =d_att)
-        f = Vertex (4.0,0.0, attributes =f_att)
-        e = Vertex (1.0,1.0, attributes =e_att)
+        a = Vertex ( a_xy[0],a_xy[1]) #, attributes =a_att)
+        d = Vertex (0.0, 4.0) #, attributes =d_att)
+        f = Vertex (4.0,0.0) #, attributes =f_att)
+        e = Vertex (1.0,1.0) #, attributes =e_att)
     
         s1 = Segment(a,d, marker = "50")
@@ -47,5 +47,5 @@
         fileName = tempfile.mktemp(".txt")
         #print "fileName",fileName
-        m.exportASCIItrianglulationfile(fileName)
+        m.export_ASCII_trianglulation_file(fileName)
         
         dict = import_trianglulation(fileName)
@@ -152,12 +152,12 @@
         self.failUnless(m.userVertices[0].y == 0.0,
                         'loadxy, test 2 failed')
-        self.failUnless(m.userVertices[0].attributes == [10.0,0.0],
-                        'loadxy, test 2.2 failed')
+        #self.failUnless(m.userVertices[0].attributes == [10.0,0.0],
+        #                'loadxy, test 2.2 failed')
         self.failUnless(m.userVertices[1].x == 0.0,
                         'loadxy, test 3 failed')
         self.failUnless(m.userVertices[1].y == 1.0,
                         'loadxy, test 4 failed')
-        self.failUnless(m.userVertices[1].attributes == [0.0,10.0],
-                        'loadxy, test 5 failed')
+        #self.failUnless(m.userVertices[1].attributes == [0.0,10.0],
+        #                'loadxy, test 5 failed')
 #-------------------------------------------------------------
 if __name__ == "__main__":
Index: /inundation/ga/storm_surge/pmesh/mesh.py
===================================================================
--- /inundation/ga/storm_surge/pmesh/mesh.py	(revision 363)
+++ /inundation/ga/storm_surge/pmesh/mesh.py	(revision 364)
@@ -917,11 +917,14 @@
             index +=1
             self.userSegments.append(segObject)
-        index = 0
-        for att in genDict['pointattributelist']:
-            if att == None:
-                self.userVertices[index].setAttributes([])
-            else:
-                self.userVertices[index].setAttributes(att)
-            index += 1
+
+# Remove the loading of attribute info.
+# Have attribute info added using least_squares in pyvolution
+#         index = 0
+#         for att in genDict['pointattributelist']:
+#             if att == None:
+#                 self.userVertices[index].setAttributes([])
+#             else:
+#                 self.userVertices[index].setAttributes(att)
+#            index += 1
         
         index = 0
@@ -1268,27 +1271,4 @@
         """
         fd = open(ofile,'w')
-        self.writeASCIItrianglulation(fd,
-                                 self.meshVertices,
-                                 self.meshTriangles,
-                                 self.meshSegments)
-        self.writeASCIImesh(fd,
-                            self.userVertices,
-                            self.userSegments,
-                            self.holes,
-                            self.regions)    
-        fd.close()
-
-    def export_ASCII_trianglulation_file(self,ofile):
-        """
-        export a file, ofile, with the format
-        
-        First line:  <# of vertices> <# of attributes>
-        Following lines:  <vertex #> <x> <y> [attributes]
-        One line:  <# of triangles> 
-        Following lines:  <triangle #> <vertex #>  <vertex #> <vertex #> <neigbouring triangle #> <neigbouring triangle #> <neigbouring triangle #> [attribute of region]
-        One line:  <# of segments> 
-        Following lines:  <segment #> <vertex #>  <vertex #> [boundary marker]
-        """
-        fd = open(ofile,'w')
         gen_dict = self.Mesh2MeshList()
         load_mesh.loadASCII.write_ASCII_trianglulation(fd,gen_dict)
@@ -1305,8 +1285,16 @@
         """
         fd = open(ofile,'w')
-        self.writeASCIItrianglulation(fd,
-                                 [],
-                                 [],
-                                 [])
+        meshDict = {}
+        
+        meshDict['generatedpointlist'] = []
+        meshDict['generatedpointattributelist'] = []
+        meshDict['generatedsegmentlist'] = []
+        meshDict['generatedsegmentmarkerlist'] = []
+
+        meshDict['generatedtrianglelist'] = [] 
+        meshDict['generatedtriangleattributelist'] = []
+        meshDict['generatedtriangleneighborlist'] = []
+        
+        load_mesh.loadASCII.write_ASCII_trianglulation(fd,meshDict)
         self.writeASCIIsegmentoutline(fd,
                             self.userVertices,
@@ -1369,64 +1357,5 @@
                             self.holes,
                             self.regions)    
-                
-    def writeASCIItrianglulation(self,
-                                 fd,
-                                 meshVertices,
-                                 meshTriangles,
-                                 meshSegments):
-    
-        numVert = str(len(meshVertices))
-        if (numVert == "0"):
-            numVertAttrib = "0"
-        else:
-            numVertAttrib = str(len(meshVertices[0].attributes))
-        fd.write(numVert + " " + numVertAttrib + " # <vertex #> <x> <y> [attributes] ...Triangulation Vertices..." + "\n")
-        
-        #<vertex #> <x> <y> [attributes]
-        index = 0 
-        for vert in meshVertices:
-            vert.index = index
-            index += 1
-            attlist = ""
-            for att in vert.attributes:
-                attlist = attlist + str(att)+" "
-            attlist.strip()
-            fd.write(str(vert.index) + " "
-                     + str(vert.x) + " "
-                     + str(vert.y) + " "
-                     + attlist + "\n")
-        #<# of triangles> 
-        fd.write(str(len(meshTriangles)) + " # <triangle #> [<vertex #>] [<neigbouring triangle #>] [attribute of region] ...Triangulation Triangles..." + "\n")
-        
-        # <triangle #> <vertex #>  <vertex #> <vertex #> <neigbouring triangle #> <neigbouring triangle #> <neigbouring triangle #> [attribute of region]
-        for tri in meshTriangles:
-            neighbors = ""
-
-            for neighbor in tri.neighbors:
-                if neighbor:
-                    neighbors += str(neighbor.index) + " "
-                else:
-                    neighbors +=  "-1  "
-                
-            #for att in vert.attributes:
-            #    attlist = attlist + str(att)+" "
-            fd.write(str(tri.index) + " "
-                     + str(tri.vertices[0].index) + " " 
-                     + str(tri.vertices[1].index) + " " 
-                     + str(tri.vertices[2].index) + " " 
-                     + neighbors + " "
-                     + str(tri.attribute) + "\n")
-            
-        #One line:  <# of segments> 
-        fd.write(str(len(meshSegments)) + 
-                 " # <segment #> <vertex #>  <vertex #> [boundary marker] ...Triangulation Segments..." + "\n")
-        
-        #Following lines:  <segment #> <vertex #>  <vertex #> [boundary marker]
-        for seg in meshSegments:
-            fd.write(str(seg.index) + " "
-                     + str(seg.vertices[0].index) + " " 
-                     + str(seg.vertices[1].index) + " " 
-                     + str(seg.marker) + "\n")
-        
+           
     def exportASCIImeshfile(self,ofile):
         """
@@ -1554,5 +1483,5 @@
         xya_dict['pointattributelist'] = pointattributes
 
-        load_mesh.loadASCII.export_xya_file(ofile, xya_dict, title)
+        load_mesh.loadASCII.export_xya_file(ofile, xya_dict, title, delimiter = " ")
 
 
Index: /inundation/ga/storm_surge/pmesh/meshHarness.py
===================================================================
--- /inundation/ga/storm_surge/pmesh/meshHarness.py	(revision 363)
+++ /inundation/ga/storm_surge/pmesh/meshHarness.py	(revision 364)
@@ -390,8 +390,8 @@
     def test_asciiFile(self):
     
-        a = Vertex (0.0, 0.0, attributes = [1.1])
-        d = Vertex (0.0, 4.0, attributes = [1.2])
-        f = Vertex (4.0,0.0, attributes = [1.3])
-        e = Vertex (1.0,1.0, attributes = [1.4])
+        a = Vertex (0.0, 0.0)  #, attributes = [1.1])
+        d = Vertex (0.0, 4.0)  #, attributes = [1.2])
+        f = Vertex (4.0,0.0)  #, attributes = [1.3])
+        e = Vertex (1.0,1.0)  #, attributes = [1.4])
     
         s1 = Segment(a,d)
@@ -417,56 +417,62 @@
         #    print l,"<"
         #print "@^@^"
-        self.failUnless(lFile[0] == "5 1 # <vertex #> <x> <y> [attributes] ...Triangulation Vertices..."
+
+        self.failUnless(lFile[0] == "5 0 # <vertex #> <x> <y> [attributes] ...Triangulation Vertices..."
                         ,
                         'Ascii file is wrong, vertex title')
-        self.failUnless(lFile[1] == "0 0.0 0.0 1.1 " and
-                        lFile[2] == "1 0.0 4.0 1.2 " and
-                        lFile[3] == "2 4.0 0.0 1.3 " and
-                        lFile[4] == "3 1.0 1.0 1.4 " and
-                        lFile[5] == "4 2.0 2.0 1.25 " 
+        self.failUnless(lFile[1] == "0 0.0 0.0 " and #1.1 " and
+                        lFile[2] == "1 0.0 4.0 " and #1.2 " and
+                        lFile[3] == "2 4.0 0.0 " and #1.3 " and
+                        lFile[4] == "3 1.0 1.0 " and #1.4 " and
+                        lFile[5] == "4 2.0 2.0 "  #1.25 " 
                         ,
                         'Ascii file is wrong, vertex')
-        self.failUnless(lFile[6] == "4 # <triangle #> [<vertex #>] [<neigbouring triangle #>] [attribute of region] ...Triangulation Triangles..." and
-                        lFile[7] == "0 3 2 4 -1  2 3  " and
-                        lFile[8] == "1 1 0 3 3 2 -1   " and
-                        lFile[9] == "2 3 4 1 -1  1 0  " and
-                        lFile[10] == "3 2 3 0 1 -1  0  "
+        
+        self.failUnless(lFile[6] == "# attribute column titles ...Triangulation Vertex Titles..."
+                        ,
+                        'Ascii file is wrong, attribute column title')
+        self.failUnless(lFile[7] == "4 # <triangle #> [<vertex #>] [<neigbouring triangle #>] [attribute of region] ...Triangulation Triangles..." and
+                        lFile[8] == "0 3 2 4 -1 2 3  " and
+                        lFile[9] == "1 1 0 3 3 2 -1  " and
+                        lFile[10] == "2 3 4 1 -1 1 0  " and
+                        lFile[11] == "3 2 3 0 1 -1 0  "
                         ,
                         'Ascii file is wrong, triangle') 
 
-        self.failUnless(lFile[11] == "5 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Triangulation Segments..." and
-                        lFile[12] == "0 0 1 external" and
-                        lFile[13] == "1 1 4 external" and
-                        lFile[14] == "2 2 0 external" and
-                        lFile[15] == "3 0 3 internal" and
-                        lFile[16] == "4 4 2 external" ,
+        self.failUnless(lFile[12] == "5 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Triangulation Segments..." and
+                        lFile[13] == "0 0 1 external" and
+                        lFile[14] == "1 1 4 external" and
+                        lFile[15] == "2 2 0 external" and
+                        lFile[16] == "3 0 3 internal" and
+                        lFile[17] == "4 4 2 external" ,
                         'Ascii file is wrong, segment')
         
-        self.failUnless(lFile[17] == '4 1 # <vertex #> <x> <y> [attributes] ...Mesh Vertices...',
+        self.failUnless(lFile[18] == '4 0 # <vertex #> <x> <y> [attributes] ...Mesh Vertices...',
                         'Ascii file is wrong, Mesh Vertices Title')
         
-        self.failUnless(lFile[18] == '0 0.0 0.0 1.1 ' and
-                        lFile[19] == '1 0.0 4.0 1.2 ' and
-                        lFile[20] == '2 4.0 0.0 1.3 ' and
-                        lFile[21] == '3 1.0 1.0 1.4 ',
+        self.failUnless(lFile[19] == '0 0.0 0.0 ' and #1.1 ' and
+                        lFile[20] == '1 0.0 4.0 ' and #1.2 ' and
+                        lFile[21] == '2 4.0 0.0 ' and #1.3 ' and
+                        lFile[22] == '3 1.0 1.0 ' #1.4 '
+                        ,
                         'Ascii file is wrong, Mesh Vertices II')
         
-        self.failUnless(lFile[22] == '4 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Mesh Segments...' and
-                        lFile[23] == '0 0 1 ' and
-                        lFile[24] == '1 1 2 ' and
-                        lFile[25] == '2 0 2 ' and
-                        lFile[26] == '3 0 3 ' and
-                        lFile[27] == '0 # <Hole #> <x> <y> ...Mesh Holes...' and
-                        lFile[28] == '0 # <Region #> <x> <y> <tag>...Mesh Regions...'
+        self.failUnless(lFile[23] == '4 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Mesh Segments...' and
+                        lFile[24] == '0 0 1 ' and
+                        lFile[25] == '1 1 2 ' and
+                        lFile[26] == '2 0 2 ' and
+                        lFile[27] == '3 0 3 ' and
+                        lFile[28] == '0 # <Hole #> <x> <y> ...Mesh Holes...' and
+                        lFile[29] == '0 # <Region #> <x> <y> <tag>...Mesh Regions...'
                         ,
                         'Ascii file is wrong, Mesh Segments')       
+
   
-
     def test_ascii_file(self):
     
-        a = Vertex (0.0, 0.0, attributes = [1.1])
-        d = Vertex (0.0, 4.0, attributes = [1.2])
-        f = Vertex (4.0,0.0, attributes = [1.3])
-        e = Vertex (1.0,1.0, attributes = [1.4])
+        a = Vertex (0.0, 0.0) #, attributes = [1.1])
+        d = Vertex (0.0, 4.0) #, attributes = [1.2])
+        f = Vertex (4.0,0.0) #, attributes = [1.3])
+        e = Vertex (1.0,1.0) #, attributes = [1.4])
     
         s1 = Segment(a,d)
@@ -482,5 +488,5 @@
         
         fileName = tempfile.mktemp(".txt")
-        m.export_ASCII_trianglulation_file(fileName)
+        m.exportASCIItrianglulationfile(fileName)
         file = open(fileName)
         lFile = file.read().split('\n')
@@ -488,50 +494,55 @@
         os.remove(fileName)
         
-        print "@^@^"
-        for l in lFile:
-            print l,"<"
-        print "@^@^"
-        self.failUnless(lFile[0] == "5 1 # <vertex #> <x> <y> [attributes] ...Triangulation Vertices..."
+        #print "@^@^"
+        #for l in lFile:
+        #    print l,"<"
+        #print "@^@^"
+        self.failUnless(lFile[0] == "5 0 # <vertex #> <x> <y> [attributes] ...Triangulation Vertices..."
                         ,
                         'Ascii file is wrong, vertex title')
-        self.failUnless(lFile[1] == "0 0.0 0.0 1.1 " and
-                        lFile[2] == "1 0.0 4.0 1.2 " and
-                        lFile[3] == "2 4.0 0.0 1.3 " and
-                        lFile[4] == "3 1.0 1.0 1.4 " and
-                        lFile[5] == "4 2.0 2.0 1.25 " 
+        self.failUnless(lFile[1] == "0 0.0 0.0 " and #1.1 " and
+                        lFile[2] == "1 0.0 4.0 " and #1.2 " and
+                        lFile[3] == "2 4.0 0.0 " and #1.3 " and
+                        lFile[4] == "3 1.0 1.0 " and #1.4 " and
+                        lFile[5] == "4 2.0 2.0 "  #1.25 " 
                         ,
                         'Ascii file is wrong, vertex')
-        self.failUnless(lFile[6] == "4 # <triangle #> [<vertex #>] [<neigbouring triangle #>] [attribute of region] ...Triangulation Triangles..." and
-                        lFile[7] == "0 3 2 4 -1 2 3  " and
-                        lFile[8] == "1 1 0 3 3 2 -1  " and
-                        lFile[9] == "2 3 4 1 -1 1 0  " and
-                        lFile[10] == "3 2 3 0 1 -1 0  "
+        
+        self.failUnless(lFile[6] == "# attribute column titles ...Triangulation Vertex Titles..."
+                        ,
+                        'Ascii file is wrong, attribute column title')
+        self.failUnless(lFile[7] == "4 # <triangle #> [<vertex #>] [<neigbouring triangle #>] [attribute of region] ...Triangulation Triangles..." and
+                        lFile[8] == "0 3 2 4 -1 2 3  " and
+                        lFile[9] == "1 1 0 3 3 2 -1  " and
+                        lFile[10] == "2 3 4 1 -1 1 0  " and
+                        lFile[11] == "3 2 3 0 1 -1 0  "
                         ,
                         'Ascii file is wrong, triangle') 
 
-        self.failUnless(lFile[11] == "5 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Triangulation Segments..." and
-                        lFile[12] == "0 0 1 external" and
-                        lFile[13] == "1 1 4 external" and
-                        lFile[14] == "2 2 0 external" and
-                        lFile[15] == "3 0 3 internal" and
-                        lFile[16] == "4 4 2 external" ,
+        self.failUnless(lFile[12] == "5 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Triangulation Segments..." and
+                        lFile[13] == "0 0 1 external" and
+                        lFile[14] == "1 1 4 external" and
+                        lFile[15] == "2 2 0 external" and
+                        lFile[16] == "3 0 3 internal" and
+                        lFile[17] == "4 4 2 external" ,
                         'Ascii file is wrong, segment')
         
-        self.failUnless(lFile[17] == '4 1 # <vertex #> <x> <y> [attributes] ...Mesh Vertices...',
+        self.failUnless(lFile[18] == '4 0 # <vertex #> <x> <y> [attributes] ...Mesh Vertices...',
                         'Ascii file is wrong, Mesh Vertices Title')
         
-        self.failUnless(lFile[18] == '0 0.0 0.0 1.1 ' and
-                        lFile[19] == '1 0.0 4.0 1.2 ' and
-                        lFile[20] == '2 4.0 0.0 1.3 ' and
-                        lFile[21] == '3 1.0 1.0 1.4 ',
+        self.failUnless(lFile[19] == '0 0.0 0.0 ' and #1.1 ' and
+                        lFile[20] == '1 0.0 4.0 ' and #1.2 ' and
+                        lFile[21] == '2 4.0 0.0 ' and #1.3 ' and
+                        lFile[22] == '3 1.0 1.0 ' #1.4 '
+                        ,
                         'Ascii file is wrong, Mesh Vertices II')
         
-        self.failUnless(lFile[22] == '4 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Mesh Segments...' and
-                        lFile[23] == '0 0 1 ' and
-                        lFile[24] == '1 1 2 ' and
-                        lFile[25] == '2 0 2 ' and
-                        lFile[26] == '3 0 3 ' and
-                        lFile[27] == '0 # <Hole #> <x> <y> ...Mesh Holes...' and
-                        lFile[28] == '0 # <Region #> <x> <y> <tag>...Mesh Regions...'
+        self.failUnless(lFile[23] == '4 # <segment #> <vertex #>  <vertex #> [boundary marker] ...Mesh Segments...' and
+                        lFile[24] == '0 0 1 ' and
+                        lFile[25] == '1 1 2 ' and
+                        lFile[26] == '2 0 2 ' and
+                        lFile[27] == '3 0 3 ' and
+                        lFile[28] == '0 # <Hole #> <x> <y> ...Mesh Holes...' and
+                        lFile[29] == '0 # <Region #> <x> <y> <tag>...Mesh Regions...'
                         ,
                         'Ascii file is wrong, Mesh Segments')       
@@ -589,8 +600,8 @@
         e_att = [2.0,2.0]
         a_xy = [0.0, 0.0]
-        a = Vertex ( a_xy[0],a_xy[1], attributes =a_att)
-        d = Vertex (0.0, 4.0, attributes =d_att)
-        f = Vertex (4.0,0.0, attributes =f_att)
-        e = Vertex (1.0,1.0, attributes =e_att)
+        a = Vertex ( a_xy[0],a_xy[1]) #, attributes =a_att)
+        d = Vertex (0.0, 4.0) #, attributes =d_att)
+        f = Vertex (4.0,0.0) #, attributes =f_att)
+        e = Vertex (1.0,1.0) #, attributes =e_att)
     
         s1 = Segment(a,d, marker = "50")
@@ -609,7 +620,10 @@
         #print "****************** fileName", fileName
         m.exportASCIItrianglulationfile(fileName)
-        #print m
+        print "******************"
+        print "m", m
+        print "******************"
         m_returned = importMeshFromFile(fileName)
-        #print m_returned
+        print "m_returned",m_returned
+        print "******************"
         #print "****************** fileName", fileName
         os.remove(fileName)
