Index: /anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain.py
===================================================================
--- /anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain.py	(revision 4901)
+++ /anuga_core/source/anuga/abstract_2d_finite_volumes/pmesh2domain.py	(revision 4902)
@@ -175,6 +175,7 @@
     point_titles  = mesh_dict['vertex_attribute_titles']
     geo_reference  = mesh_dict['geo_reference']
-    for quantity, value_vector in map (None, point_titles, point_atts):
-        vertex_quantity_dict[quantity] = value_vector
+    if point_atts != None:
+        for quantity, value_vector in map (None, point_titles, point_atts):
+            vertex_quantity_dict[quantity] = value_vector
     tag_dict = pmesh_dict_to_tag_dict(mesh_dict)
     tagged_elements_dict = build_tagged_elements_dictionary(mesh_dict)
Index: /anuga_core/source/anuga/load_mesh/loadASCII.py
===================================================================
--- /anuga_core/source/anuga/load_mesh/loadASCII.py	(revision 4901)
+++ /anuga_core/source/anuga/load_mesh/loadASCII.py	(revision 4902)
@@ -193,5 +193,6 @@
         for fragment in fragments:
             apointattributes.append(float(fragment))
-        pointattributes.append(apointattributes)
+        if apointattributes != []:
+            pointattributes.append(apointattributes)
         
     ######### loading the point title info
@@ -262,5 +263,8 @@
     meshDict = {}
     meshDict['vertices'] = points
-    meshDict['vertex_attributes'] = pointattributes
+    if pointattributes == []:
+        meshDict['vertex_attributes'] = None
+    else:
+        meshDict['vertex_attributes'] = pointattributes
     meshDict['triangles'] = triangles
     meshDict['triangle_tags'] = triangleattributes
@@ -458,5 +462,10 @@
      
     numVert = str(len(vertices))
-    if (numVert == "0") or len(vertices_attributes) == 0:
+    #print "load vertices_attributes", vertices_attributes
+    # Don't understand why we have to do vertices_attributes[0] is None,
+    # but it doesn't work otherwise...
+    if vertices_attributes == None or \
+           (numVert == "0") or \
+           len(vertices_attributes) == 0:
         numVertAttrib = "0"
     else:
@@ -469,5 +478,6 @@
         attlist = ""
         
-        if vertices_attributes == []:
+        if vertices_attributes == None or \
+               vertices_attributes == []:
             attlist = ""
         else:
@@ -640,5 +650,7 @@
     #the triangulation
     mesh['vertices'] = array(mesh['vertices']).astype(Float)
-    mesh['vertex_attributes'] = array(mesh['vertex_attributes']).astype(Float)
+    if mesh['vertex_attributes'] != None:
+        mesh['vertex_attributes'] = \
+               array(mesh['vertex_attributes']).astype(Float)
     mesh['vertex_attribute_titles'] = array(mesh['vertex_attribute_titles']).astype(Character) 
     mesh['segments'] = array(mesh['segments']).astype(IntType)
@@ -690,5 +702,6 @@
                                                    'num_of_dimensions'))
         outfile.variables['vertices'][:] = mesh['vertices']
-        if (mesh['vertex_attributes'].shape[0] > 0 and mesh['vertex_attributes'].shape[1] > 0):
+        if mesh['vertex_attributes']  != None and \
+               (mesh['vertex_attributes'].shape[0] > 0 and mesh['vertex_attributes'].shape[1] > 0):
             outfile.createDimension('num_of_vertex_attributes',
                                     mesh['vertex_attributes'].shape[1])
@@ -829,5 +842,4 @@
     #throws prints to screen if file not present
     fid = NetCDFFile(file_name, 'r') 
-
     mesh = {}
     # Get the variables
@@ -840,7 +852,8 @@
         mesh['vertex_attributes'] = fid.variables['vertex_attributes'][:]
     except KeyError:
-        mesh['vertex_attributes'] = []
-        for ob in mesh['vertices']:
-            mesh['vertex_attributes'].append([])
+        mesh['vertex_attributes'] = None
+        #for ob in mesh['vertices']:
+            #mesh['vertex_attributes'].append([])
+    
     mesh['vertex_attribute_titles'] = []
     try:
Index: /anuga_core/source/anuga/load_mesh/test_loadASCII.py
===================================================================
--- /anuga_core/source/anuga/load_mesh/test_loadASCII.py	(revision 4901)
+++ /anuga_core/source/anuga/load_mesh/test_loadASCII.py	(revision 4902)
@@ -94,5 +94,5 @@
         self.tri_dict['segments'] = [[0,1]]
         self.tri_dict['triangle_tags'] = ['']
-        self.tri_dict['vertex_attributes'] = [[],[],[]]
+        self.tri_dict['vertex_attributes'] = None
         self.tri_dict['triangle_neighbors'] = [[0,0,0]]
         self.tri_dict['segment_tags'] = ['']
@@ -112,5 +112,5 @@
         self.seg_dict['segments'] = [[0,1]]
         self.seg_dict['triangle_tags'] = []
-        self.seg_dict['vertex_attributes'] = [[],[]]
+        self.seg_dict['vertex_attributes'] = None
         self.seg_dict['triangle_neighbors'] = []
         self.seg_dict['segment_tags'] = ['']
@@ -476,6 +476,9 @@
             self.failUnless(ob  == ldob,
                         fail_string + ' failed!! Test triangle_tags')
-        self.failUnless(loaded_dict['vertex_attributes']  ==
-                        dict['vertex_attributes'],
+        # A bit hacky
+        self.failUnless((loaded_dict['vertex_attributes']  ==
+                        dict['vertex_attributes']) or \
+                        (loaded_dict['vertex_attributes']  == None and \
+                         dict['vertex_attributes'] == []),
                         fail_string + ' failed!! Test vertex_attributes')
  
@@ -545,5 +548,5 @@
 
     suite = unittest.makeSuite(loadASCIITestCase,'test')
-    #suite = unittest.makeSuite(loadASCIITestCase,'test_rs')
+    #suite = unittest.makeSuite(loadASCIITestCase,'test_read_write_tsh_file4')
     runner = unittest.TextTestRunner() #verbosity=2)
     runner.run(suite)
Index: /anuga_core/source/anuga/mesh_engine/mesh_engine.py
===================================================================
--- /anuga_core/source/anuga/mesh_engine/mesh_engine.py	(revision 4901)
+++ /anuga_core/source/anuga/mesh_engine/mesh_engine.py	(revision 4902)
@@ -155,4 +155,6 @@
             mesh_dict['generatedtriangleattributelist'] = None
             
+        if mesh_dict['generatedpointattributelist'].shape[1] == 0:
+            mesh_dict['generatedpointattributelist'] = None
         if trianglelist.shape[0] == 0:
             # There are no triangles.
Index: /anuga_core/source/anuga/pmesh/graphical_mesh_generator.py
===================================================================
--- /anuga_core/source/anuga/pmesh/graphical_mesh_generator.py	(revision 4901)
+++ /anuga_core/source/anuga/pmesh/graphical_mesh_generator.py	(revision 4902)
@@ -1115,5 +1115,5 @@
                                     self.canvas,
                                     self.SCALE)
-    def normalise4ObjMesh(self):
+    def obsolete_normalise4ObjMesh(self):
         if self.mesh:
             self.clearSelections()
@@ -1124,5 +1124,5 @@
             self.ResizeToFit()
             
-    def normaliseMesh(self):
+    def obsolete_nnormaliseMesh(self):
         if self.mesh:
             self.clearSelections()
Index: /anuga_core/source/anuga/pmesh/mesh.py
===================================================================
--- /anuga_core/source/anuga/pmesh/mesh.py	(revision 4901)
+++ /anuga_core/source/anuga/pmesh/mesh.py	(revision 4902)
@@ -522,4 +522,6 @@
                  triangle_neighbors,
                  segment_tags,
+                 vertex_attributes,
+                 vertex_attribute_titles=None
                  ):
        
@@ -531,5 +533,13 @@
         self.segment_tags = segment_tags # list of strings
         self.vertices = ensure_numeric(vertices)
-
+        # This is needed for __cmp__
+        if vertex_attributes is None:
+            self.vertex_attributes = []
+        else:
+            self.vertex_attributes = ensure_numeric(vertex_attributes)
+        if vertex_attribute_titles is None:
+            self.vertex_attribute_titles = []
+        else:
+            self.vertex_attribute_titles = vertex_attribute_titles
        
     def draw_triangulation(self, canvas, scale=1, xoffset=0, yoffset=0,
@@ -1094,13 +1104,25 @@
         self.userSegments = []
         self.alphaUserSegments = []
-                
+
+       #FIXME see where this is used. return an array instead
     def getTriangulation(self):
-        return self.meshTriangles
+        #return self.meshTriangles
+        return self.tri_mesh.triangles.tolist()
     
     def getMeshVertices(self):
-        return self.meshVertices
+        #return self.meshVertices
+        return self.tri_mesh.vertices
  
+    def getMeshVerticeAttributes(self):
+        #return self.meshVertices
+        return self.tri_mesh.vertex_attributes
+    
     def getMeshSegments(self):
-        return self.meshSegments
+        #return self.meshSegments
+        return self.tri_mesh.segments
+    
+    def getMeshSegmentTags(self):
+        #return self.meshSegments
+        return self.tri_mesh.segment_tags
     
     def getHoles(self):
@@ -1233,5 +1255,6 @@
         #FIXME (DSG-DSG)  move above section into generate_mesh.py
        
-        if generatedMesh['generatedpointattributelist'].shape[1] ==0:
+        if generatedMesh['generatedpointattributelist'] is None or \
+               generatedMesh['generatedpointattributelist'].shape[1] ==0:
             self.attributeTitles = []
         generatedMesh['generatedpointattributetitlelist']= \
@@ -1444,4 +1467,6 @@
         Convert the Mesh to a dictionary of lists describing the
         triangulation variables;
+
+        This is used by __cmp__
         generated point list: [(x1,y1),(x2,y2),...] (Tuples of doubles)
         generated point attribute list: [(a11,a12,...),(a21,a22),...]
@@ -1463,52 +1488,31 @@
         """
         
-        meshDict = {}        
-        pointlist=[]
-        pointattributelist=[]
-
-
-        self.maxVertexIndex=0
-        for vertex in self.meshVertices:
-            vertex.index = self.maxVertexIndex 
-            pointlist.append((vertex.x,vertex.y))
-            pointattributelist.append((vertex.attributes))           
-            self.maxVertexIndex += 1
-
-        meshDict['generatedpointlist'] = pointlist
-        meshDict['generatedpointattributelist'] = pointattributelist
-        meshDict['generatedpointattributetitlelist'] = self.attributeTitles
-        #segments
-        segmentlist=[]
-        segmenttaglist=[]
-        for seg in self.meshSegments:
-            segmentlist.append((seg.vertices[0].index,seg.vertices[1].index))
-            segmenttaglist.append(seg.tag)
-        meshDict['generatedsegmentlist'] =segmentlist 
-        meshDict['generatedsegmenttaglist'] =segmenttaglist 
-
-        # Make sure that the indexation is correct
-        index = 0
-        for tri in self.meshTriangles:
-            tri.index = index           
-            index += 1
-
-        trianglelist = []
-        triangleattributelist = []
-        triangleneighborlist = []
-        for tri in self.meshTriangles:  
-            trianglelist.append((tri.vertices[0].index,tri.vertices[1].index,
-                                 tri.vertices[2].index))  
-            triangleattributelist.append([tri.attribute])
-            neighborlist = [-1,-1,-1]
-            for neighbor,index in map(None,tri.neighbors,
-                                      range(len(tri.neighbors))):
-                if neighbor:    
-                    neighborlist[index] = neighbor.index
-            triangleneighborlist.append(neighborlist)
-        
-        meshDict['generatedtrianglelist'] = trianglelist 
-        meshDict['generatedtriangleattributelist'] = triangleattributelist
-        meshDict['generatedtriangleneighborlist'] = triangleneighborlist
-        
+        meshDict = {}   
+        #print "old meshDict['generatedpointattributetitlelist']",meshDict['generatedpointattributetitlelist']
+        #print "self.tri_mesh", self.tri_mesh
+        if self.tri_mesh is not None:
+            #print "self.tri_mesh.triangles.tolist()", self.tri_mesh.triangles.tolist()
+            meshDict['generatedtrianglelist'] = self.tri_mesh.triangles.tolist()
+            meshDict['generatedtriangleattributelist'] = self.tri_mesh.triangle_tags
+            meshDict['generatedtriangleneighborlist'] = self.tri_mesh.triangle_neighbors.tolist()
+            meshDict['generatedpointlist'] = self.tri_mesh.vertices.tolist()
+            if  self.tri_mesh.vertex_attributes == []:
+                meshDict['generatedpointattributelist'] = []
+            #meshDict['generatedpointattributelist'] = self.tri_mesh.vertex_attributes
+            meshDict['generatedpointattributetitlelist'] = \
+                       self.tri_mesh.vertex_attribute_titles
+            meshDict['generatedsegmentlist'] = self.tri_mesh.segments.tolist()
+            meshDict['generatedsegmenttaglist'] = self.tri_mesh.segment_tags
+        else:
+            meshDict['generatedtrianglelist'] = []
+            meshDict['generatedtriangleattributelist'] = []
+            meshDict['generatedtriangleneighborlist'] = []
+            meshDict['generatedpointlist'] = []
+            meshDict['generatedpointattributelist'] = []
+            meshDict['generatedpointattributetitlelist'] = []
+            meshDict['generatedsegmentlist'] = []
+            meshDict['generatedsegmenttaglist'] = []
+            
+        #print "new meshDict['generatedpointattributetitlelist']",meshDict['generatedpointattributetitlelist']
         #print "mesh.Mesh2MeshList*)*)"
         #print meshDict
@@ -1535,10 +1539,10 @@
         generated point list: [(x1,y1),(x2,y2),...] (Tuples of doubles)  
         generated point attribute list:[(P1att1,P1attt2, ...),
-            (P2att1,P2attt2,...),...]
+            (P2att1,P2attt2,...),...]- not implemented
         generated point attribute title list:[A1Title, A2Title ...]
-            (list of strings)
+            (list of strings) - not implemented
         generated segment list: [(point1,point2),(p3,p4),...]
             (Tuples of integers)
-        generated segment marker list: [S1Tag, S2Tag, ...] (list of ints)
+        generated segment marker list: [S1Tag, S2Tag, ...] (list of strings)
         triangle list:  [(point1,point2, point3),(p5,p4, p1),...]
             (Tuples of integers)
@@ -1546,75 +1550,7 @@
             (t5,t4, t1),...] (Tuples of integers)
             -1 means there's no triangle neighbor
-        triangle attribute list: [(T1att), (T2att), ...]
-
-        """
-        #Clear the current generated mesh values
-        self.meshTriangles=[]
-        self.attributeTitles=[]
-        self.meshSegments=[]
-        self.meshVertices=[]
-
-        #print "mesh.setTriangulation@#@#@#"
-        #print genDict
-        #print "@#@#@#"
-
-        self.maxVertexIndex = 0
-        for point in genDict['generatedpointlist']:
-            v=Vertex(point[0], point[1])
-            v.index =  self.maxVertexIndex
-            self.maxVertexIndex +=1
-            self.meshVertices.append(v)
-
-        self.attributeTitles = genDict['generatedpointattributetitlelist']
-
-        index = 0
-        for seg,marker in map(None,genDict['generatedsegmentlist'],
-                              genDict['generatedsegmentmarkerlist']):
-            segObject = Segment( self.meshVertices[int(seg[0])],
-                           self.meshVertices[int(seg[1])], tag = marker )
-            segObject.index = index
-            index +=1
-            self.meshSegments.append(segObject)
-
-        index = 0
-        for triangle in genDict['generatedtrianglelist']:
-            tObject =Triangle( self.meshVertices[int(triangle[0])],
-                        self.meshVertices[int(triangle[1])],
-                        self.meshVertices[int(triangle[2])] )
-            tObject.index = index
-            index +=1
-            self.meshTriangles.append(tObject)
-
-        if genDict['generatedtriangleattributelist'] is not None:
-            index = 0
-            for att in genDict['generatedtriangleattributelist']:
-                if att == []:
-                    self.meshTriangles[index].setAttribute("")
-                else:
-                    self.meshTriangles[index].setAttribute(att)
-                index += 1
-            
-        index = 0
-        for att in genDict['generatedpointattributelist']:
-            if att == None:
-                self.meshVertices[index].setAttributes([])
-            else:
-                self.meshVertices[index].setAttributes(att)
-            index += 1
-    
-        index = 0
-        for triangle in genDict['generatedtriangleneighborlist']:
-            # Build a list of triangle object neighbors
-            ObjectNeighbor = []
-            for neighbor in triangle:
-                if ( neighbor != -1):
-                    ObjectNeighbor.append(self.meshTriangles[int(neighbor)])
-                else:
-                    ObjectNeighbor.append(None)
-            self.meshTriangles[index].setNeighbors(ObjectNeighbor[0],
-                                                   ObjectNeighbor[1],
-                                                   ObjectNeighbor[2])
-            index += 1
-        
+        triangle attribute list: [(T1att), (T2att), ...](list of strings)
+
+        """
         # Setting up the rigid triangulation
         self.tri_mesh = Rigid_triangulation(
@@ -1625,4 +1561,6 @@
             ,genDict['generatedtriangleneighborlist']
             ,genDict['generatedsegmentmarkerlist']
+            ,genDict['generatedpointattributelist']
+            ,genDict['generatedpointattributetitlelist']
             )
             
@@ -2195,53 +2133,5 @@
         Used to produce .tsh file
         """
-        
-        meshDict = {}        
-        vertices=[]
-        vertex_attributes=[]
-
-        self.maxVertexIndex=0
-        for vertex in self.meshVertices:
-            vertex.index = self.maxVertexIndex 
-            vertices.append([vertex.x,vertex.y])
-            vertex_attributes.append(vertex.attributes)           
-            self.maxVertexIndex += 1
-
-        meshDict['vertices'] = vertices
-        meshDict['vertex_attributes'] = vertex_attributes
-        meshDict['vertex_attribute_titles'] = self.attributeTitles
-        #segments
-        segments=[]
-        segment_tags=[]
-        for seg in self.meshSegments:
-            segments.append([seg.vertices[0].index,seg.vertices[1].index])
-            segment_tags.append(seg.tag)
-        meshDict['segments'] =segments 
-        meshDict['segment_tags'] =segment_tags
-
-        # Make sure that the indexation is correct
-        index = 0
-        for tri in self.meshTriangles:
-            tri.index = index           
-            index += 1
-
-        triangles = []
-        triangle_tags = []
-        triangle_neighbors = []
-        for tri in self.meshTriangles:  
-            triangles.append([tri.vertices[0].index,
-                              tri.vertices[1].index,
-                              tri.vertices[2].index])  
-            triangle_tags.append(tri.attribute)
-            neighborlist = [-1,-1,-1]
-            for neighbor,index in map(None,tri.neighbors,
-                                      range(len(tri.neighbors))):
-                if neighbor:    
-                    neighborlist[index] = neighbor.index
-            triangle_neighbors.append(neighborlist)
-        
-        meshDict['triangles'] = triangles
-        meshDict['triangle_tags'] = triangle_tags
-        meshDict['triangle_neighbors'] = triangle_neighbors
-        
+        meshDict = {}
         if self.tri_mesh is not None:
             meshDict['triangles'] = self.tri_mesh.triangles
@@ -2249,8 +2139,19 @@
             #print "mesh meshDict['triangle_tags']", meshDict['triangle_tags']
             meshDict['triangle_neighbors'] = self.tri_mesh.triangle_neighbors
+            meshDict['vertices'] = self.tri_mesh.vertices
+            meshDict['vertex_attributes'] = self.tri_mesh.vertex_attributes
+            meshDict['vertex_attribute_titles'] = \
+                               self.tri_mesh.vertex_attribute_titles
+            meshDict['segments'] = self.tri_mesh.segments 
+            meshDict['segment_tags'] = self.tri_mesh.segment_tags
         else:
             meshDict['triangles'] = []
             meshDict['triangle_tags'] = []
             meshDict['triangle_neighbors'] = []
+            meshDict['vertices'] = []
+            meshDict['vertex_attributes'] = []
+            meshDict['vertex_attribute_titles'] = []
+            meshDict['segments'] = []
+            meshDict['segment_tags'] = []
         #print "mesh.Mesh2IOTriangulationDict*)*)"
         #print meshDict
@@ -2335,70 +2236,6 @@
         """
         #Clear the current generated mesh values
-        self.meshTriangles = []
-        self.attributeTitles = []
-        self.meshSegments = []
-        self.meshVertices = []
         self.tri_mesh = None
         
-        #print "mesh.setTriangulation@#@#@#"
-        #print genDict
-        #print "@#@#@#"
-
-        self.maxVertexIndex = 0
-        for point in genDict['vertices']:
-            v=Vertex(point[0], point[1])
-            v.index =  self.maxVertexIndex
-            self.maxVertexIndex +=1
-            self.meshVertices.append(v)
-
-        self.attributeTitles = genDict['vertex_attribute_titles']
-
-        index = 0
-        for seg,tag in map(None,genDict['segments'],genDict['segment_tags']):
-            segObject = Segment( self.meshVertices[int(seg[0])],
-                           self.meshVertices[int(seg[1])], tag = tag )
-            segObject.index = index
-            index +=1
-            self.meshSegments.append(segObject)
-
-        index = 0
-        for triangle in genDict['triangles']:
-            tObject =Triangle( self.meshVertices[int(triangle[0])],
-                        self.meshVertices[int(triangle[1])],
-                        self.meshVertices[int(triangle[2])] )
-            tObject.index = index
-            index +=1
-            self.meshTriangles.append(tObject)
-
-        index = 0
-        for att in genDict['triangle_tags']:
-            if att == []:
-                self.meshTriangles[index].setAttribute("")
-            else:
-                self.meshTriangles[index].setAttribute(att)
-            index += 1
-            
-        index = 0
-        for att in genDict['vertex_attributes']:
-            if att == None:
-                self.meshVertices[index].setAttributes([])
-            else:
-                self.meshVertices[index].setAttributes(att)
-            index += 1
-    
-        index = 0
-        for triangle in genDict['triangle_neighbors']:
-            # Build a list of triangle object neighbors
-            ObjectNeighbor = []
-            for neighbor in triangle:
-                if ( neighbor != -1):
-                    ObjectNeighbor.append(self.meshTriangles[int(neighbor)])
-                else:
-                    ObjectNeighbor.append(None)
-            self.meshTriangles[index].setNeighbors(ObjectNeighbor[0],
-                                                   ObjectNeighbor[1],
-                                                   ObjectNeighbor[2])
-            index += 1
-
         self.tri_mesh = Rigid_triangulation(
             genDict['triangles']
@@ -2408,6 +2245,11 @@
             ,genDict['triangle_neighbors']
             ,genDict['segment_tags']
+            ,genDict['vertex_attributes']
+            ,genDict['vertex_attribute_titles']
             )
-
+        self.attributeTitles = genDict['vertex_attribute_titles']
+        self.maxVertexIndex = len(genDict['vertices'])
+        #print "self.maxVertexIndex ", self.maxVertexIndex
+        
     def IOOutline2Mesh(self, genDict):
         """
Index: /anuga_core/source/anuga/pmesh/test_mesh.py
===================================================================
--- /anuga_core/source/anuga/pmesh/test_mesh.py	(revision 4901)
+++ /anuga_core/source/anuga/pmesh/test_mesh.py	(revision 4902)
@@ -107,9 +107,15 @@
         result = 1.414214
         delta  = 0.00001
-        
-        self.failUnless((m.meshTriangles[1].vertices[0].x < result + delta) or
-                        (m.meshTriangles[1].vertices[0].x > result - delta),
+        tri = m.getTriangulation()
+        verts = m.getMeshVertices()
+        x = verts[tri[1][0]][0]
+        #self.failUnless((m.meshTriangles[1].vertices[0].x < result + delta) or
+         #               (m.meshTriangles[1].vertices[0].x > result - delta),
+          #              'generated mesh is wrong!')
+
+        self.failUnless((x < result + delta) or
+                        (x > result - delta),
                         'generated mesh is wrong!')
-
+        
     def test_regionalMaxArea(self):
         v0 = Vertex (0.0, 0.0)
@@ -133,5 +139,5 @@
         #print "len(m.meshTriangles)",len(m.meshTriangles)
 
-        self.failUnless(len(m.meshTriangles) == 2, 
+        self.failUnless(len(m.getTriangulation()) == 2, 
                         'test_regionalMaxArea 1:generated mesh is wrong!')
         
@@ -143,5 +149,5 @@
         m.generateMesh("Q", maxArea = 36 )
         
-        self.failUnless(len(m.meshTriangles) >= 6,
+        self.failUnless(len(m.getTriangulation()) >= 6,
                         'testregion_with_maxarea 2: # of tris is wrong!')    
        
@@ -155,5 +161,5 @@
         #print "len(m.meshTriangles)",len(m.meshTriangles)
         
-        self.failUnless(len(m.meshTriangles) >= 8,
+        self.failUnless(len(m.getTriangulation()) >= 8,
                         'testregion_with_maxarea 3: # of tris is wrong!')
                 
@@ -165,5 +171,5 @@
                  regions=[r1,r2] )
         m.generateMesh("Q", maxArea = 8 ) 
-        self.failUnless(len(m.meshTriangles) >= 8,
+        self.failUnless(len(m.getTriangulation()) >= 8,
                         'testregion_with_maxarea 4: # of tris is wrong!')    
 
@@ -175,5 +181,5 @@
                  regions=[r1,r2] )
         m.generateMesh("Q", maxArea = 36,isRegionalMaxAreas = False )      
-        self.failUnless(len(m.meshTriangles) == 2, 
+        self.failUnless(len(m.getTriangulation()) == 2, 
                         'test_regionalMaxArea 5:generated mesh is wrong!')
         
@@ -184,5 +190,5 @@
                  regions=[r1,r2] )
         m.generateMesh("Q",isRegionalMaxAreas = False )
-        self.failUnless(len(m.meshTriangles) == 2, 
+        self.failUnless(len(m.getTriangulation()) == 2, 
                         'test_regionalMaxArea 5:generated mesh is wrong!')
         
@@ -206,5 +212,5 @@
         m.generate_mesh(maximum_triangle_area=36,verbose=False)         
 
-        self.failUnless(len(m.meshTriangles) == 2, 
+        self.failUnless(len(m.getTriangulation()) == 2, 
                         'test_regionalMaxArea 1:generated mesh is wrong!')
         
@@ -216,5 +222,5 @@
         m.generate_mesh(maximum_triangle_area=36,verbose=False)  
         
-        self.failUnless(len(m.meshTriangles) >= 6,
+        self.failUnless(len(m.getTriangulation()) >= 6,
                         'testregion_with_maxarea 2: # of tris is wrong!')    
                
@@ -225,7 +231,7 @@
                  regions=[r1,r2] )
         m.generate_mesh(maximum_triangle_area=36,verbose=False)         
-        #print "len(m.meshTriangles)",len(m.meshTriangles)
-        
-        self.failUnless(len(m.meshTriangles) >= 8,
+        #print "len(m.getTriangulation())",len(m.getTriangulation())
+        
+        self.failUnless(len(m.getTriangulation()) >= 8,
                         'testregion_with_maxarea 3: # of tris is wrong!')
                          
@@ -236,5 +242,5 @@
                  regions=[r1,r2] )
         m.generate_mesh(maximum_triangle_area=8,verbose=False)    
-        self.failUnless(len(m.meshTriangles) >= 8,
+        self.failUnless(len(m.getTriangulation()) >= 8,
                         'testregion_with_maxarea 4: # of tris is wrong!')    
 
@@ -244,6 +250,6 @@
         userSegments=[s1,s2,s3,s4,s5], regions=[r1,r2] )
         m.generate_mesh(verbose=False)
-        #print "en(m.meshTriangles)", len(m.meshTriangles)
-        self.failUnless(len(m.meshTriangles) >= 8,
+        #print "en(m.getTriangulation())", len(m.getTriangulation())
+        self.failUnless(len(m.getTriangulation()) >= 8,
         'You have issues!')
         
@@ -418,6 +424,8 @@
         m = Mesh(userVertices=[a,b,c,d,e,f,g], userSegments=[s1,s2,s3,s4,s5,s6,s7,s8,s9,s10], regions=[r1,r2,r3] )
         m.generateMesh("Q", maxArea = 2.1 )
-        
-        Triangulation =  m.getTriangulation()
+
+        # FIXME test the region
+        #Triangulation =  m.getTriangulation()
+        Triangulation = m.tri_mesh.triangle_tags
         #print Triangulation[0].attribute
         #print Triangulation[1].attribute 
@@ -426,9 +434,9 @@
         #print Triangulation[4].attribute
        
-        self.failUnless(Triangulation[0].attribute == "" and
-                        Triangulation[1].attribute == "22" and
-                        Triangulation[2].attribute == "" and
-                        Triangulation[3].attribute == "11" and
-                        Triangulation[4].attribute == "22" ,
+        self.failUnless(Triangulation[0] == "" and
+                        Triangulation[1] == "22" and
+                        Triangulation[2] == "" and
+                        Triangulation[3] == "11" and
+                        Triangulation[4] == "22" ,
                         'region attributes are wrong!')   
 
@@ -449,11 +457,11 @@
         m.generateMesh("Q", maxArea = 2.1)
 
-        vert = m.getMeshVertices()
-        
-        self.failUnless(vert[0].attributes == [12.0, 2.0] and
-                        vert[1].attributes == [9.0, 7.0] and
-                        vert[2].attributes == [14.0,3.0] and
-                        vert[3].attributes == [12.232233047033631, 4.4142135623730949] and
-                        vert[4].attributes == [13.0, 2.5] ,
+        vert = m.getMeshVerticeAttributes()
+        
+        self.failUnless(vert[0] == [12.0, 2.0] and
+                        vert[1] == [9.0, 7.0] and
+                        vert[2] == [14.0,3.0] and
+                        vert[3] == [12.232233047033631, 4.4142135623730949] and
+                        vert[4] == [13.0, 2.5] ,
                         'vertex attributes are wrong!')
 
@@ -476,10 +484,7 @@
         m.generateMesh("Q", maxArea = 2.1 )
 
-        vert = m.getMeshVertices()
-        self.failUnless(vert[0].attributes == [] and
-                        vert[1].attributes == [] and
-                        vert[2].attributes == [] and
-                        vert[3].attributes == [] and
-                        vert[4].attributes == [],
+        vert = m.getMeshVerticeAttributes()
+        #print "vert", vert
+        self.failUnless(vert == [],
                         'vertex attributes are wrong!')
 
@@ -499,5 +504,5 @@
 
         #m.export_mesh_file("from_test_mesh.tsh")
-        seg = m.getMeshSegments()
+        seg = m.getMeshSegmentTags()
         #print "seg",seg
         #print "seg[0].tag"
@@ -505,9 +510,9 @@
         #print "seg[0].tag"
         
-        self.failUnless(seg[0].tag == 5 and
-                        seg[1].tag == 7 and
-                        seg[2].tag == 9 and
-                        seg[3].tag == 7 and
-                        seg[4].tag == 9,
+        self.failUnless(seg[0] == 5 and
+                        seg[1] == 7 and
+                        seg[2] == 9 and
+                        seg[3] == 7 and
+                        seg[4] == 9,
                         'seg tags are wrong')
             
@@ -529,10 +534,10 @@
         m.generateMesh("Q", maxArea = 2.1)
 
-        seg = m.getMeshSegments()
-        self.failUnless(seg[0].tag == "exterior" and
-                        seg[1].tag == "exterior" and
-                        seg[2].tag == "exterior" and
-                        seg[3].tag == "" and
-                        seg[4].tag == "exterior",
+        seg = m.getMeshSegmentTags()
+        self.failUnless(seg[0] == "exterior" and
+                        seg[1] == "exterior" and
+                        seg[2] == "exterior" and
+                        seg[3] == "" and
+                        seg[4] == "exterior",
                         '2nd seg tags are wrong')
 
@@ -821,5 +826,5 @@
                         'loading and saving of a mesh geo refs failed')
 
-    def test_normaliseMesh(self):
+    def DONTtest_normaliseMesh(self):
         
         a_att = [5.0,2.0]
@@ -890,7 +895,5 @@
 
         #Trim mesh, so it should like like m_returned
-        m.meshVertices = []
-        m.meshTriangles = []
-        m.meshSegments = []
+        m.tri_mesh = None
         m.userVertices=[a,b,c]
         #print "mesh ***************dsg*", m
@@ -1556,5 +1559,5 @@
                  userSegments=[s1,s2,s3,s4],
                  regions=[r1])
-        titles = ['ele','friction']
+        titles = ['ele','friction'] #Feed in directly!
         m.attributeTitles = titles
         m.generateMesh("Qa2.1")
@@ -1562,4 +1565,6 @@
         seg = m.getMeshSegments()
         verts = m.getMeshVertices()
+        vert_as = m.getMeshVerticeAttributes()
+        seg_tags = m.getMeshSegmentTags()
         dict = m.Mesh2IOTriangulationDict()
         #print "dict",dict 
@@ -1574,24 +1579,22 @@
                          'test_Mesh2IOTriangulationDict failed. test 2')
 
-        
-        for pimport,pactual,pimpatt in map(None,dict['vertices'],
-                                           verts,dict['vertex_attributes']):
-            #assert all_close( pimport, (pactual.x,pactual.y))
-            self.failUnless( pimport == [pactual.x,pactual.y],
-                        'test_Mesh2IOTriangulationDict failed. test 2.1')
-            self.failUnless( pimpatt == pactual.attributes,
-                        'test_Mesh2IOTriangulationDict failed. test 2.2')
+        self.failUnless( dict['vertices'] == verts,
+                         'test_Mesh2IOTriangulationDict failed. test vert')
+        self.failUnless( dict['vertex_attributes'] == vert_as,
+                         'test_Mesh2IOTriangulationDict failed. test vert ats')
+
         self.failUnless( dict['segments'][0] == [0,1],
-                        'test_Mesh2IOTriangulationDict failed. test 3')
-        for segimp,segactual in map(None,dict['segment_tags'],seg):
-            self.failUnless( segimp == segactual.tag,
-                        'test_Mesh2IOTriangulationDict failed. test 4')
+                        'test_Mesh2IODict failed. test 3')
+        
+        self.failUnless( dict['segment_tags'] == seg_tags,
+                        'test_Mesh2IODict failed. test 3')
         #print " dict['triangles'][0]", dict['triangles'][0] 
         self.failUnless( dict['triangles'][0] == [3,2,4],
-                        'test_Mesh2IOTriangulationDict failed. test 5')
+                        'test_Mesh2IODict failed. test 5')
         self.failUnless( dict['triangle_neighbors'][0] == [-1,2,3],
-                        'test_Mesh2IOTriangulationDict failed. test 6')
+                        'test_Mesh2IODict failed. test 6')
+        #print "dict['triangle_tags'][0]", dict['triangle_tags'][0]
         self.failUnless( dict['triangle_tags'][0] == "1.3",
-                         'test_Mesh2IOTriangulationDict failed. test 7')
+                         'test_Mesh2IODict failed. test 7')
 
   
@@ -1623,5 +1626,7 @@
         seg = m.getMeshSegments()
         verts = m.getMeshVertices()
+        vert_as = m.getMeshVerticeAttributes()
         dict = m.Mesh2IODict()
+        seg_tags = m.getMeshSegmentTags()
         #print "dict",dict 
         
@@ -1635,17 +1640,14 @@
                          'test_Mesh2IOTriangulationDict failed. test 2')
 
-        
-        for pimport,pactual,pimpatt in map(None,dict['vertices'],
-                                           verts,dict['vertex_attributes']):
-            #assert all_close( pimport, (pactual.x,pactual.y))
-            self.failUnless( pimport == [pactual.x,pactual.y],
-                        'test_Mesh2IODict failed. test 2.1')
-            self.failUnless( pimpatt == pactual.attributes,
-                        'test_Mesh2IODict failed. test 2.2')
+        self.failUnless( dict['vertices'] == verts,
+                         'test_Mesh2IOTriangulationDict failed. test vert')
+        self.failUnless( dict['vertex_attributes'] == vert_as,
+                         'test_Mesh2IOTriangulationDict failed. test vert ats')
+
         self.failUnless( dict['segments'][0] == [0,1],
                         'test_Mesh2IODict failed. test 3')
-        for segimp,segactual in map(None,dict['segment_tags'],seg):
-            self.failUnless( segimp == segactual.tag,
-                        'test_Mesh2IODict failed. test 4')
+        
+        self.failUnless( dict['segment_tags'] == seg_tags,
+                        'test_Mesh2IODict failed. test 3')
         #print " dict['triangles'][0]", dict['triangles'][0] 
         self.failUnless( dict['triangles'][0] == [3,2,4],
@@ -2358,6 +2360,7 @@
     #suite = unittest.makeSuite(meshTestCase,'mode_string_float_problems')
     #suite = unittest.makeSuite(meshTestCase,'test_import_mesh')
-    #suite = unittest.makeSuite(meshTestCase,'test_Mesh2IODict')
-    runner = unittest.TextTestRunner() # verbosity=2)
+    #suite = unittest.makeSuite(meshTestCase,'test_asciiFile')
+    #suite = unittest.makeSuite(meshTestCase,'test_mesh2IO')
+    runner = unittest.TextTestRunner() #verbosity=2)
     runner.run(suite)
     
Index: /anuga_core/source/anuga/pmesh/test_mesh_interface.py
===================================================================
--- /anuga_core/source/anuga/pmesh/test_mesh_interface.py	(revision 4901)
+++ /anuga_core/source/anuga/pmesh/test_mesh_interface.py	(revision 4902)
@@ -387,7 +387,7 @@
         
         #print "file_name",file_name 
-        self.failUnless(len(m.meshTriangles) <= 900,
-                        'Test mesh interface failed!')
-        self.failUnless(len(m.meshTriangles) >= 200,
+        self.failUnless(len(m.getTriangulation()) <= 900,
+                        'Test mesh interface failed!')
+        self.failUnless(len(m.getTriangulation()) >= 200,
                         'Test mesh interface failed!')
         
@@ -403,5 +403,5 @@
         
         #print "len(m.meshTriangles)",len(m.meshTriangles) 
-        self.failUnless(len(m.meshTriangles) <= 100,
+        self.failUnless(len(m.getTriangulation()) <= 100,
                         'Test mesh interface failed!')
 
@@ -442,8 +442,8 @@
         #print "file_name",file_name
         #print "len(m.meshTriangles",len(m.meshTriangles) 
-        self.failUnless(len(m.meshTriangles) <= 2000, 
+        self.failUnless(len(m.getTriangulation()) <= 2000, 
                         'Test mesh interface failed!')
  
-        self.failUnless(len(m.meshTriangles) >= 900,
+        self.failUnless(len(m.getTriangulation()) >= 900,
                         'Test mesh interface failed!')
 
@@ -489,8 +489,8 @@
         #print "file_name",file_name
         #print "len(m.meshTriangles",len(m.meshTriangles) 
-        self.failUnless(len(m.meshTriangles) <= 2000, 
+        self.failUnless(len(m.getTriangulation()) <= 2000, 
                         'Test mesh interface failed!')
  
-        self.failUnless(len(m.meshTriangles) >= 900,
+        self.failUnless(len(m.getTriangulation()) >= 900,
                         'Test mesh interface failed!')
 
@@ -538,8 +538,8 @@
         #print "file_name",file_name
         #print "len(m.meshTriangles",len(m.meshTriangles) 
-        self.failUnless(len(m.meshTriangles) <= 3000, 
+        self.failUnless(len(m.getTriangulation()) <= 3000, 
                         'Test mesh interface failed!')
  
-        self.failUnless(len(m.meshTriangles) >= 2000,
+        self.failUnless(len(m.getTriangulation()) >= 2000,
                         'Test mesh interface failed!')
 
