Index: /trunk/anuga_core/source/anuga/file_conversion/sww2dem.py
===================================================================
--- /trunk/anuga_core/source/anuga/file_conversion/sww2dem.py	(revision 8543)
+++ /trunk/anuga_core/source/anuga/file_conversion/sww2dem.py	(revision 8544)
@@ -34,5 +34,5 @@
             cellsize=10,
             number_of_decimal_places=None,
-            NODATA_value=-9999,
+            NODATA_value=-9999.0,
             easting_min=None,
             easting_max=None,
@@ -332,4 +332,6 @@
     outside_indices = interp.get_outside_poly_indices()
 
+    #print outside_indices
+
     if verbose:
         log.critical('Interpolated values are in [%f, %f]'
@@ -342,4 +344,5 @@
 
     for i in outside_indices:
+        #print 'change grid_value',NODATA_value
         grid_values[i] = NODATA_value
 
Index: /trunk/anuga_core/source/anuga_parallel/distribute_mesh.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/distribute_mesh.py	(revision 8543)
+++ /trunk/anuga_core/source/anuga_parallel/distribute_mesh.py	(revision 8544)
@@ -1134,49 +1134,42 @@
 
     i=0
-    i +=1 ; print 'send', i
-    protocol(num.array(setup_array, num.int))
-    pypar.send(setup_array, p, bypass=True)
+
+    x = num.array(setup_array, num.int)
+    pypar.send(x, p, bypass=True)
 
 
     # ghost layer width
-    i +=1 ; print 'send', i
-    protocol(num.array(submesh["ghost_layer_width"][p], num.int))
-    pypar.send(num.array(submesh["ghost_layer_width"][p], num.int), p, bypass=True)
+    x = num.array(submesh["ghost_layer_width"][p], num.int)
+    pypar.send(x, p, bypass=True)
 
 
     # send the number of triangles per processor
-    i +=1 ; print 'send', i
-    protocol(num.array(triangles_per_proc))
-    pypar.send(num.array(triangles_per_proc), p, bypass=True)
+    x = num.array(triangles_per_proc)
+    pypar.send(x, p, bypass=True)
 
     # send the nodes
-    i +=1 ; print 'send', i
-    protocol(num.array(submesh["full_nodes"][p], num.float))
-    #pypar.send(num.array(submesh["full_nodes"][p], num.float), p, bypass=False)
-    pypar.send(num.array(submesh["full_nodes"][p], num.float), p)
-
-
-    i +=1 ; print 'send', i
-    protocol(num.array(submesh["ghost_nodes"][p], num.float))
-    pypar.send(num.array(submesh["ghost_nodes"][p], num.float),p, bypass=False)
+    x = num.array(submesh["full_nodes"][p], num.float)
+    pypar.send(x, p, bypass=True)
+
+    x = num.array(submesh["ghost_nodes"][p], num.float)
+    pypar.send(x, p, bypass=True)
 
     # send the triangles
-
-    i +=1 ; print 'send', i
-    protocol(num.array(submesh["full_triangles"][p],  num.int))
-    pypar.send(num.array(submesh["full_triangles"][p],  num.int), p, bypass=False)
-    i +=1 ; print 'send', i
-    protocol(num.array(submesh["ghost_triangles"][p], num.int))
-    pypar.send(num.array(submesh["ghost_triangles"][p], num.int), p, bypass=False)
+    x = num.array(submesh["full_triangles"][p], num.int)
+    pypar.send(x, p, bypass=True)
+
+    # send ghost triangles
+    x = num.array(submesh["ghost_triangles"][p], num.int)
+    pypar.send(x, p, bypass=True)
+
 
     # send the boundary
-
     bc = []
     for b in submesh["full_boundary"][p]:
         bc.append([b[0], b[1], tagmap[submesh["full_boundary"][p][b]]])
 
-    i +=1 ; print 'send', i
-    protocol(num.array(bc, num.int))
-    pypar.send(num.array(bc, num.int), p, bypass=False)
+    x = num.array(bc, num.int)
+    pypar.send(x, p, bypass=True)
+
 
     bc = []
@@ -1184,31 +1177,26 @@
         bc.append([b[0], b[1], tagmap[submesh["ghost_boundary"][p][b]]])
 
-    i +=1 ; print 'send', i
-    protocol(num.array(bc, num.int))
-    pypar.send(num.array(bc, num.int), p, bypass=False)
+    x = num.array(bc, num.int)
+    pypar.send(x, p, bypass=True)
+
+
 
     # send the communication pattern
-
-    # submesh["ghost_commun"][p] is numpy array
-    i +=1 ; print 'send', i
-    protocol(submesh["ghost_commun"][p])
-    pypar.send(submesh["ghost_commun"][p], p, bypass=False)
-
-    i +=1 ; print 'send', i
-    protocol(num.array(flat_full_commun, num.int))
-    pypar.send(num.array(flat_full_commun, num.int), p, bypass=False)
+    x = submesh["ghost_commun"][p]
+    pypar.send(x, p, bypass=True)
+
+
+    x = num.array(flat_full_commun, num.int)
+    pypar.send(x, p, bypass=True)
+
 
     # send the quantities
-
-    
     for k in submesh["full_quan"]:
-        print 'send full', ++i, k
-        protocol(num.array(submesh["full_quan"][k][p], num.float))
-        pypar.send(num.array(submesh["full_quan"][k][p], num.float), p, bypass=False)
+        x = num.array(submesh["full_quan"][k][p], num.float)
+        pypar.send(x, p, bypass=True)
         
     for k in submesh["ghost_quan"]:
-        print 'send ghost', ++i, k
-        protocol(num.array(submesh["ghost_quan"][k][p], num.float))
-        pypar.send(num.array(submesh["ghost_quan"][k][p], num.float),p, bypass=False)
+        x = num.array(submesh["ghost_quan"][k][p], num.float)
+        pypar.send(x,p, bypass=True)
         
 
@@ -1271,4 +1259,7 @@
 
 
+
+    print 'setup_array', setup_array
+    
     # ghost layer width
     x = num.zeros((1,),num.int)
@@ -1283,25 +1274,31 @@
 
     # receive the full nodes
-#    x = num.zeros((no_full_nodes,),num.int)
-#    pypar.receive(p, buffer=x,  bypass=True)
-#    submesh_cell["full_nodes"] = x
-
-
-    submesh_cell["full_nodes"] = pypar.receive(p)
+    x = num.zeros((no_full_nodes,3),num.float)
+    pypar.receive(p, buffer=x,  bypass=True)
+    submesh_cell["full_nodes"] = x
+
+
     # receive the ghost nodes
-
-    submesh_cell["ghost_nodes"] = pypar.receive(p, bypass=False)
+    x = num.zeros((no_ghost_nodes,3),num.float)
+    pypar.receive(p, buffer=x,  bypass=True)
+    submesh_cell["ghost_nodes"] = x
     
     # receive the full triangles
-
-    submesh_cell["full_triangles"] = pypar.receive(p, bypass=False)
+    x = num.zeros((no_full_triangles,3),num.int)
+    pypar.receive(p, buffer=x,  bypass=True)
+    submesh_cell["full_triangles"] = x
+
     
     # receive the ghost triangles
-
-    submesh_cell["ghost_triangles"] = pypar.receive(p, bypass=False)
+    x = num.zeros((no_ghost_triangles,4),num.int)
+    pypar.receive(p, buffer=x,  bypass=True)
+    submesh_cell["ghost_triangles"] = x
+
+
 
     # receive the full boundary
-
-    bnd_c = pypar.receive(p, bypass=False)
+    x = num.zeros((no_full_boundary,3),num.int)
+    pypar.receive(p, buffer=x,  bypass=True)
+    bnd_c = x
 
     submesh_cell["full_boundary"] = {}
@@ -1309,7 +1306,9 @@
         submesh_cell["full_boundary"][b[0],b[1]]=itagmap[b[2]]
 
+
     # receive the ghost boundary
-
-    bnd_c = pypar.receive(p, bypass=False)
+    x = num.zeros((no_ghost_boundary,3),num.int)
+    pypar.receive(p, buffer=x,  bypass=True)
+    bnd_c = x
 
     submesh_cell["ghost_boundary"] = {}
@@ -1318,10 +1317,12 @@
 
     # receive the ghost communication pattern
-
-    submesh_cell["ghost_commun"] = pypar.receive(p, bypass=False)
+    x = num.zeros((no_ghost_commun,2),num.int)
+    pypar.receive(p, buffer=x,  bypass=True)
+    submesh_cell["ghost_commun"] = x
     
     # receive the full communication pattern
-
-    full_commun = pypar.receive(p, bypass=False)
+    x = num.zeros((no_full_commun,2),num.int)
+    pypar.receive(p, buffer=x,  bypass=True)
+    full_commun = x
 
     submesh_cell["full_commun"] = {}
@@ -1334,15 +1335,14 @@
 
     submesh_cell["full_quan"]={}
-    
     for i in range(no_quantities):
-        tmp = pypar.receive(p, bypass=False)
-        submesh_cell["full_quan"][qkeys[i]]=num.zeros((no_full_triangles,3), num.float)
-        submesh_cell["full_quan"][qkeys[i]][:] = tmp[:]
+        x = num.zeros((no_full_triangles,3), num.float)
+        pypar.receive(p, buffer=x, bypass=True)
+        submesh_cell["full_quan"][qkeys[i]]= x
 
     submesh_cell["ghost_quan"]={}
     for i in range(no_quantities):
-        tmp = pypar.receive(p, bypass=False)
-        submesh_cell["ghost_quan"][qkeys[i]]= num.zeros((no_ghost_triangles,3), num.float)
-        submesh_cell["ghost_quan"][qkeys[i]][:] = tmp[:]
+        x = num.zeros((no_ghost_triangles,3), num.float)
+        pypar.receive(p, buffer=x, bypass=True)
+        submesh_cell["ghost_quan"][qkeys[i]]= x
     
     return submesh_cell, triangles_per_proc,\
Index: /trunk/anuga_core/source/anuga_parallel/parallel_api.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/parallel_api.py	(revision 8543)
+++ /trunk/anuga_core/source/anuga_parallel/parallel_api.py	(revision 8544)
@@ -4,5 +4,5 @@
 """
 
-
+import numpy as num
 
 # The abstract Python-MPI interface
@@ -93,4 +93,5 @@
         boundary_map = domain.boundary_map
         for p in range(1, numprocs):
+            # FIXME SR: Creates cPickle dump
             send(boundary_map, p)
     else:
@@ -127,9 +128,34 @@
             print 'p2s_map', p2s_map
 
+
+        def protocol(x):
+            vanilla=False
+            import pypar
+            control_info, x = pypar.create_control_info(x, vanilla, return_object=True)
+            print 'protocol', control_info[0]
+            
         # Send serial to parallel (s2p) and parallel to serial (p2s) triangle mapping to proc 1 .. numprocs
         for p in range(1, numprocs):
             # FIXME SR: Creates cPickle dump
-            send(s2p_map, p)
+
+            print '*** s2p'
+            protocol(s2p_map)
+
+            n = len(s2p_map)
+            s2p_map_keys_flat = num.reshape(num.array(s2p_map.keys(),num.int), (n,1) )
+
+            print s2p_map_keys_flat.shape
+
+            s2p_map_values_flat = num.array(s2p_map.values(),num.int)
+            print s2p_map_values_flat.shape
+            
+            s2p_map_flat = num.concatenate( (s2p_map_keys_flat, s2p_map_values_flat), axis=1 )
+            #print s2p_map_keys_flat
+            #print s2p_map_values_flat
+            #print s2p_map_flat
+
+            send(s2p_map_flat, p)
             # FIXME SR: Creates cPickle dump
+            #print p2s_map
             send(p2s_map, p)
 
@@ -153,5 +179,7 @@
         
         # Recieve serial to parallel (s2p) and parallel to serial (p2s) triangle mapping
-        s2p_map = receive(0)
+        s2p_map_flat = receive(0)
+        s2p_map = dict.fromkeys(s2p_map_flat[:,0], s2p_map_flat[:,1:2])
+
         p2s_map = receive(0)
 
