Index: /anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
===================================================================
--- /anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py	(revision 4479)
+++ /anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py	(revision 4480)
@@ -1324,11 +1324,54 @@
         
 
+    def test_remove_lone_verts_d(self):
+        verts = [[0,0],[1,0],[0,1]]
+        tris = [[0,1,2]]
+        new_verts, new_tris = remove_lone_verts(verts, tris)
+        assert new_verts == verts
+        assert new_tris == tris
      
 
+    def test_remove_lone_verts_e(self):
+        verts = [[0,0],[1,0],[0,1],[99,99]]
+        tris = [[0,1,2]]
+        new_verts, new_tris = remove_lone_verts(verts, tris)
+        assert new_verts == verts[0:3]
+        assert new_tris == tris
+        
+    def test_remove_lone_verts_a(self):
+        verts = [[99,99],[0,0],[1,0],[99,99],[0,1],[99,99]]
+        tris = [[1,2,4]]
+        new_verts, new_tris = remove_lone_verts(verts, tris)
+        #print "new_verts", new_verts
+        assert new_verts == [[0,0],[1,0],[0,1]]
+        assert new_tris == [[0,1,2]]
+     
+    def test_remove_lone_verts_c(self):
+        verts = [[0,0],[1,0],[99,99],[0,1]]
+        tris = [[0,1,3]]
+        new_verts, new_tris = remove_lone_verts(verts, tris)
+        #print "new_verts", new_verts
+        assert new_verts == [[0,0],[1,0],[0,1]]
+        assert new_tris == [[0,1,2]]
+        
+    def test_remove_lone_verts_b(self):
+        verts = [[0,0],[1,0],[0,1],[99,99],[99,99],[99,99]]
+        tris = [[0,1,2]]
+        new_verts, new_tris = remove_lone_verts(verts, tris)
+        assert new_verts == verts[0:3]
+        assert new_tris == tris
+     
+
+    def test_remove_lone_verts_e(self):
+        verts = [[0,0],[1,0],[0,1],[99,99]]
+        tris = [[0,1,2]]
+        new_verts, new_tris = remove_lone_verts(verts, tris)
+        assert new_verts == verts[0:3]
+        assert new_tris == tris
         
 #-------------------------------------------------------------
 if __name__ == "__main__":
     suite = unittest.makeSuite(Test_Util,'test')
-    #suite = unittest.makeSuite(Test_Util,'test_get_revision_number')
+    #suite = unittest.makeSuite(Test_Util,'test_remove_lone_verts')
     runner = unittest.TextTestRunner()
     runner.run(suite)
Index: /anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
===================================================================
--- /anuga_core/source/anuga/abstract_2d_finite_volumes/util.py	(revision 4479)
+++ /anuga_core/source/anuga/abstract_2d_finite_volumes/util.py	(revision 4480)
@@ -14,4 +14,7 @@
 from shutil import copy
 
+from anuga.utilities.numerical_tools import ensure_numeric
+from Numeric import arange, choose
+    
 from anuga.geospatial_data.geospatial_data import ensure_absolute
 
@@ -1567,11 +1570,47 @@
         raise msg
 
-      
-    
-    
-        
-    
-    
-     
-
-
+
+def remove_lone_verts(verts, triangles):
+    verts = ensure_numeric(verts)
+    triangles = ensure_numeric(triangles)
+    N = len(verts)
+    # initialise the array to easily find the index of the first loner
+    loners=arange(2*N, N, -1) # if N=3 [6,5,4]
+    
+    for i,t in enumerate(triangles):
+        for vert in t:
+            loners[vert]= vert # all non-loners will have loners[i]=i 
+    #print loners
+
+    lone_start = 2*N - max(loners) # The index of the first loner
+
+    if lone_start-1 == N:
+        # no loners
+        pass
+    elif min(loners[lone_start:N]) > N:
+        # All the loners are at the end of the vert array
+        verts = verts[0:lone_start]
+    else:
+        # change the loners list so it can be used to modify triangle
+        # Remove the loners from verts
+        # Could've used X=compress(less(loners,N),loners)
+        # verts=take(verts,X)  to Remove the loners from verts
+        # but I think it would use more memory
+        new_i = 0
+        for i in range(lone_start, N):
+            if loners[i] >= N:
+                # Loner!
+                pass
+            else:
+                loners[i] = new_i
+                verts[new_i] = verts[i]
+                new_i += 1
+        verts = verts[0:new_i]
+
+        # Modify the triangles
+        #print "loners", loners
+        #print "triangles before", triangles
+        triangles = choose(triangles,loners)
+        #print "triangles after", triangles
+    return verts, triangles
+ 
Index: /anuga_core/source/anuga/shallow_water/data_manager.py
===================================================================
--- /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 4479)
+++ /anuga_core/source/anuga/shallow_water/data_manager.py	(revision 4480)
@@ -85,5 +85,6 @@
 from anuga.abstract_2d_finite_volumes.pmesh2domain import \
      pmesh_to_domain_instance
-from anuga.abstract_2d_finite_volumes.util import get_revision_number
+from anuga.abstract_2d_finite_volumes.util import get_revision_number, \
+     remove_lone_verts
 
 # formula mappings
@@ -1930,4 +1931,7 @@
     from anuga.fit_interpolate.interpolate import Interpolate
 
+    # Remove loners from vertex_points, volumes here
+    vertex_points, volumes = remove_lone_verts(vertex_points, volumes)
+    
     interp = Interpolate(vertex_points, volumes, verbose = verbose)
 
