Index: /issm/trunk-jpl/src/m/mesh/bamg.py
===================================================================
--- /issm/trunk-jpl/src/m/mesh/bamg.py	(revision 22215)
+++ /issm/trunk-jpl/src/m/mesh/bamg.py	(revision 22216)
@@ -72,4 +72,7 @@
 	bamg_mesh=bamgmesh()
 
+        subdomain_ref = 1
+        hole_ref = 1
+
 	# Bamg Geometry parameters {{{
 	if options.exist('domain'):
@@ -99,6 +102,9 @@
 			bamg_geometry.Vertices=np.vstack((bamg_geometry.Vertices,np.vstack((domaini['x'][0:nods],domaini['y'][0:nods],np.ones((nods)))).T))
 			bamg_geometry.Edges   =np.vstack((bamg_geometry.Edges,np.vstack((np.arange(count+1,count+nods+1),np.hstack((np.arange(count+2,count+nods+1),count+1)),1.*np.ones((nods)))).T))
-			if i:
-				bamg_geometry.SubDomains=np.vstack((bamg_geometry.SubDomains,[2,count+1,1,1]))
+                        if i:
+                            bamg_geometry.SubDomains=np.vstack((bamg_geometry.SubDomains,[2,count+1,1,-subdomain_ref]))
+                            subdomain_ref = subdomain_ref+1;
+                        else:
+                            bamg_geometry.SubDomains=np.vstack((bamg_geometry.SubDomains,[2,count+1,1,0]))
 
 			# bamg_geometry.Vertices=np.hstack((bamg_geometry.Vertices,np.vstack((domaini['x'][0:nods].reshape(-1),domaini['y'][0:nods].reshape(-1),np.ones((nods))))))
Index: /issm/trunk-jpl/test/NightlyRun/test514.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test514.py	(revision 22215)
+++ /issm/trunk-jpl/test/NightlyRun/test514.py	(revision 22216)
@@ -58,3 +58,3 @@
 field_names     =['x1','y1','x2','y2','x3','y3','x4','y4','x5','y5','x6','y6','x7','y7']
 field_tolerances = [2e-10,7e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
-field_values=[x1, y1,	y2, y2,	y3, y3,	y4, y4,	y5, y5,	y6, y6,	y7, y7]
+field_values=[x1, y1,x2, y2,	x3, y3,	x4, y4,	x5, y5,	x6, y6,	x7, y7]
