Index: /trunk/anuga_core/source/anuga_parallel/test_distribute_mesh.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/test_distribute_mesh.py	(revision 8539)
+++ /trunk/anuga_core/source/anuga_parallel/test_distribute_mesh.py	(revision 8540)
@@ -581,4 +581,81 @@
         triangles_per_proc = [5, 6, 5]
 
+
+        quantities = {'stage': num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ],
+       [-0.   , -0.125, -0.   ],
+       [-0.   , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.25 ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ]]),  'elevation': num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ],
+       [-0.   , -0.125, -0.   ],
+       [-0.   , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.25 ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ]]),  'ymomentum': num.array([[ 0.5 ,  0.25,  0.  ],
+       [ 0.5 ,  0.75,  1.  ],
+       [ 0.5 ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  1.  ],
+       [ 0.  ,  0.25,  0.5 ],
+       [ 0.5 ,  0.25,  0.5 ],
+       [ 0.5 ,  0.75,  1.  ],
+       [ 0.5 ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  1.  ],
+       [ 0.  ,  0.25,  0.  ],
+       [ 0.  ,  0.25,  0.5 ],
+       [ 0.  ,  0.25,  0.  ],
+       [ 0.5 ,  0.25,  0.  ],
+       [ 0.5 ,  0.25,  0.5 ]]),  'friction': num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]]),  'xmomentum': num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]])}
 
 
@@ -858,18 +935,66 @@
         submesh = submesh_ghost(submesh, mesh, triangles_per_proc, parameters)
 
-        print submesh
-
-        print 'ghost_triangles', submesh['ghost_triangles']
-        print 'ghost_boundary[0]', submesh['ghost_boundary'][0]
-        print 'ghost_boundary[1]', submesh['ghost_boundary'][1]
-        print 'ghost_boundary[2]', submesh['ghost_boundary'][2]
-        print 'ghost_nodes', submesh['ghost_nodes']
-        print 'ghost_commun', submesh['ghost_commun']
-        
+        #print submesh
+
+        #print 'ghost_triangles', submesh['ghost_triangles']
+        #print 'ghost_boundary', submesh['ghost_boundary']
+        #print 'ghost_nodes', submesh['ghost_nodes']
+        #print 'ghost_commun', submesh['ghost_commun']
+
+
+        true_submesh['ghost_boundary'] = [{(12, 2): 'ghost', (9, 0): 'ghost', (9, 2): 'ghost', \
+        (6, 1): 'ghost', (15, 0): 'ghost', (11, 1): 'bottom', (11, 0): 'ghost', (6, 2): 'ghost'}, \
+        {(0, 1): 'ghost', (1, 2): 'ghost', (1, 0): 'ghost', (11, 1): 'bottom'},\
+        {(5, 1): 'left', (2, 0): 'ghost', (0, 2): 'ghost', (5, 0): 'ghost', (2, 2): 'ghost'}]
+
+
+        true_submesh['ghost_triangles'] = [num.array([[ 6,  1,  9,  4],\
+                                                      [ 9,  5, 10,  4],\
+                                                      [11,  3,  9,  0],\
+                                                      [12,  3, 11,  4],\
+                                                      [15,  4, 11,  7]]), \
+                                           num.array([[ 0,  4,  9,  3],\
+                                                      [ 1,  4, 12,  5],\
+                                                     [11,  3,  9,  0]]),\
+                                           num.array([[ 0,  4,  9,  3],\
+                                                      [ 2,  7, 12,  4],\
+                                                      [ 5,  0,  9,  1]])]
+
+        true_submesh['ghost_nodes'] =  [num.array([[  0.  ,   0.  ,   0.  ],\
+                                                   [  1.  ,   0.  ,   0.5 ],\
+                                                   [ 10.  ,   0.25,   0.75],\
+                                                   [ 11.  ,   0.75,   0.25]]),\
+                                        num.array([[  3.  ,   0.5 ,   0.  ],\
+                                                   [ 12.  ,   0.75,   0.75]]),\
+                                        num.array([[  1.  ,   0.  ,   0.5 ],\
+                                                   [ 12.  ,   0.75,   0.75]])]
+
+        true_submesh['ghost_commun'] = [num.array([[ 6,  1],\
+                                                   [ 9,  1],\
+                                                   [11,  2],\
+                                                   [12,  2],\
+                                                   [15,  2]]),\
+                                        num.array([[ 0,  0],\
+                                                   [ 1,  0],\
+                                                   [11,  2]]),\
+                                        num.array([[0, 0],\
+                                                   [2, 0],\
+                                                   [5, 1]])]
+
+
+
+
         for i in range(3):
+            assert true_submesh['ghost_boundary'][i] == submesh['ghost_boundary'][i]
             assert num.allclose(true_submesh['ghost_triangles'][i],submesh['ghost_triangles'][i])
             assert num.allclose(true_submesh['ghost_nodes'][i],submesh['ghost_nodes'][i])
             assert num.allclose(true_submesh['ghost_commun'][i],submesh['ghost_commun'][i])
 
+
+
+        true_submesh['full_commun'] = [{0: [1, 2], 1: [1], 2: [2], 3: [], 4: []},\
+                                       {5: [2], 6: [0], 7: [], 8: [], 9: [0], 10: []},\
+                                       {11: [0, 1], 12: [0], 13: [], 14: [], 15: [0]}]
+
         assert true_submesh['full_commun'] == submesh['full_commun']
 
@@ -882,4 +1007,118 @@
                                  triangles_per_proc)
 
+
+        #print submesh['full_quan']
+
+
+
+        true_submesh['full_quan'] = {'stage': [num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ]]), num.array([[-0.   , -0.125, -0.   ],
+       [-0.   , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.25 ]]), num.array([[-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ]])], 'elevation': [num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ]]), num.array([[-0.   , -0.125, -0.   ],
+       [-0.   , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.125, -0.25 ],
+       [-0.   , -0.125, -0.25 ]]), num.array([[-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.5  , -0.375, -0.5  ],
+       [-0.25 , -0.375, -0.5  ]])], 'ymomentum': [num.array([[ 0.5 ,  0.25,  0.  ],
+       [ 0.5 ,  0.75,  1.  ],
+       [ 0.5 ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  1.  ]]), num.array([[ 0.  ,  0.25,  0.5 ],
+       [ 0.5 ,  0.25,  0.5 ],
+       [ 0.5 ,  0.75,  1.  ],
+       [ 0.5 ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  0.5 ],
+       [ 1.  ,  0.75,  1.  ]]), num.array([[ 0.  ,  0.25,  0.  ],
+       [ 0.  ,  0.25,  0.5 ],
+       [ 0.  ,  0.25,  0.  ],
+       [ 0.5 ,  0.25,  0.  ],
+       [ 0.5 ,  0.25,  0.5 ]])], 'friction': [num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]]), num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]]), num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]])], 'xmomentum': [num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]]), num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]]), num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]])]}
+
+
+        true_submesh['ghost_quan'] = {'stage': [num.array([[-0.   , -0.125, -0.25 ],
+       [-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.25 , -0.375, -0.5  ]]), num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.25 , -0.125, -0.   ]]), num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.   , -0.125, -0.   ]])], 'elevation': [num.array([[-0.   , -0.125, -0.25 ],
+       [-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.125, -0.   ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.25 , -0.375, -0.5  ]]), num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.25 , -0.375, -0.25 ],
+       [-0.25 , -0.125, -0.   ]]), num.array([[-0.25 , -0.125, -0.25 ],
+       [-0.5  , -0.375, -0.25 ],
+       [-0.   , -0.125, -0.   ]])], 'ymomentum': [num.array([[ 0.5 ,  0.25,  0.5 ],
+       [ 1.  ,  0.75,  0.5 ],
+       [ 0.  ,  0.25,  0.  ],
+       [ 0.  ,  0.25,  0.5 ],
+       [ 0.5 ,  0.25,  0.5 ]]), num.array([[ 0.5 ,  0.25,  0.  ],
+       [ 0.5 ,  0.75,  1.  ],
+       [ 0.  ,  0.25,  0.  ]]), num.array([[ 0.5 ,  0.25,  0.  ],
+       [ 0.5 ,  0.75,  0.5 ],
+       [ 0.  ,  0.25,  0.5 ]])], 'friction': [num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]]), num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]]), num.array([[ 0.,  0.,  0.],
+       [ 0.,  0.,  0.],
+       [ 0.,  0.,  0.]])], 'xmomentum': [num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]]), num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]]), num.array([[ 2.,  2.,  2.],
+       [ 2.,  2.,  2.],
+       [ 2.,  2.,  2.]])]}
 
 
Index: /trunk/anuga_core/source/anuga_parallel/test_parallel_distribute_mesh.py
===================================================================
--- /trunk/anuga_core/source/anuga_parallel/test_parallel_distribute_mesh.py	(revision 8539)
+++ /trunk/anuga_core/source/anuga_parallel/test_parallel_distribute_mesh.py	(revision 8540)
@@ -196,5 +196,5 @@
         #----------------------------------------------------------------------------------
         points, vertices, boundary, quantities, \
-                ghost_recv_dict, full_send_dict, tri_map, node_map  =\
+                ghost_recv_dict, full_send_dict, tri_map, node_map, ghost_layer_width =\
         extract_hostmesh(submesh, triangles_per_proc)
 
@@ -210,4 +210,5 @@
         true_full_send = {1: [num.array([0, 1, 2, 4]), num.array([0, 1, 2, 4])], 2: [num.array([0, 1, 2, 3]), num.array([0, 1, 2, 3])]}
 
+        assert_(num.allclose(ghost_layer_width,  2))
         assert_(num.allclose(points,   true_points))
         assert_(num.allclose(vertices, true_vertices))
@@ -225,5 +226,5 @@
         points, vertices, boundary, quantities, \
                 ghost_recv_dict, full_send_dict, \
-                no_full_nodes, no_full_trigs, tri_map, node_map  = \
+                no_full_nodes, no_full_trigs, tri_map, node_map, ghost_layer_width  = \
                 rec_submesh(0, verbose=False)    
 
@@ -243,4 +244,5 @@
             true_node_map = num.array([ 0,  1,  2,  7,  3,  4, -1,  8,  9,  5,  6, 10, 11])
 
+            assert_(num.allclose(ghost_layer_width,  2))
             assert_(num.allclose(tri_map,   true_tri_map))
             assert_(num.allclose(node_map,   true_node_map))
@@ -267,4 +269,5 @@
             true_node_map = num.array([ 0,  7, -1,  1,  2,  8 , 3,  4,  9,  5, -1,  6, 10])
 
+            assert_(num.allclose(ghost_layer_width,  2))
             assert_(num.allclose(tri_map,   true_tri_map))
             assert_(num.allclose(node_map,   true_node_map))
