Index: issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py
===================================================================
--- issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 20172)
+++ issm/trunk-jpl/src/m/mesh/planet/gmsh/gmshplanet.py	(revision 20173)
@@ -22,6 +22,6 @@
 
 	#process options
-	options=pairoptions(varargin)
-	options=options.deleteduplicates(1)
+	options=pairoptions(*varargin)
+	#options=deleteduplicates(options,1)
 
 	#recover parameters:
@@ -30,57 +30,57 @@
 
 	#initialize mesh: 
-	mesh=mesh3dsurface()
+	mesh=mesh2d()
 
 	#create .geo file:  {{{
-	fid=fopen('sphere.geo','w')
+	fid=open('sphere.geo','w')
 
-	fprintf(fid,'Mesh.Algorithm = 1\n')
+	fid.write('Mesh.Algorithm = 1\n')
 	if options.exist('refine'):
-		fprintf(fid,'Mesh.Algorithm = 7\n')
-		fprintf(fid,'Mesh.CharacteristicLengthFromPoints= 0\n')
-		fprintf(fid,'Mesh.SmoothRatio= 3\n')
-		fprintf(fid,'Mesh.RemeshAlgorithm= 1\n')
-	fprintf(fid,'resolution=#g\n',resolution)
-	fprintf(fid,'radius=#g\n',radius)
-	fprintf(fid,'Point(1) = [0.0,0.0,0.0,resolution]\n')
-	fprintf(fid,'Point(2) = [radius,0.0,0.0,resolution]\n')
-	fprintf(fid,'Point(3) = [0,radius,0.0,resolution]\n')
-	fprintf(fid,'Circle(1) = [2,1,3]\n')
-	fprintf(fid,'Point(4) = [-radius,0,0.0,resolution]\n')
-	fprintf(fid,'Point(5) = [0,-radius,0.0,resolution]\n')
-	fprintf(fid,'Circle(2) = [3,1,4]\n')
-	fprintf(fid,'Circle(3) = [4,1,5]\n')
-	fprintf(fid,'Circle(4) = [5,1,2]\n')
-	fprintf(fid,'Point(6) = [0,0,-radius,resolution]\n')
-	fprintf(fid,'Point(7) = [0,0,radius,resolution]\n')
-	fprintf(fid,'Circle(5) = [3,1,6]\n')
-	fprintf(fid,'Circle(6) = [6,1,5]\n')
-	fprintf(fid,'Circle(7) = [5,1,7]\n')
-	fprintf(fid,'Circle(8) = [7,1,3]\n')
-	fprintf(fid,'Circle(9) = [2,1,7]\n')
-	fprintf(fid,'Circle(10) = [7,1,4]\n')
-	fprintf(fid,'Circle(11) = [4,1,6]\n')
-	fprintf(fid,'Circle(12) = [6,1,2]\n')
-	fprintf(fid,'Line Loop(13) = [2,8,-10]\n')
-	fprintf(fid,'Ruled Surface(14) = [13]\n')
-	fprintf(fid,'Line Loop(15) = [10,3,7]\n')
-	fprintf(fid,'Ruled Surface(16) = [15]\n')
-	fprintf(fid,'Line Loop(17) = [-8,-9,1]\n')
-	fprintf(fid,'Ruled Surface(18) = [17]\n')
-	fprintf(fid,'Line Loop(19) = [-11,-2,5]\n')
-	fprintf(fid,'Ruled Surface(20) = [19]\n')
-	fprintf(fid,'Line Loop(21) = [-5,-12,-1]\n')
-	fprintf(fid,'Ruled Surface(22) = [21]\n')
-	fprintf(fid,'Line Loop(23) = [-3,11,6]\n')
-	fprintf(fid,'Ruled Surface(24) = [23]\n')
-	fprintf(fid,'Line Loop(25) = [-7,4,9]\n')
-	fprintf(fid,'Ruled Surface(26) = [25]\n')
-	fprintf(fid,'Line Loop(27) = [-4,12,-6]\n')
-	fprintf(fid,'Ruled Surface(28) = [27]\n')
-	fprintf(fid,'Surface Loop(29) = [28,26,16,14,20,24,22,18]\n')
-	fprintf(fid,'Volume(30) = [29]\n')
-	fprintf(fid,'Physical Surface(1) = [28,26,16,14,20,24,22,18]\n')
-	fprintf(fid,'Physical Volume(2) = 30\n')
-	fclose(fid)
+		fid.write('Mesh.Algorithm = 7\n')
+		fid.write('Mesh.CharacteristicLengthFromPoints= 0\n')
+		fid.write('Mesh.SmoothRatio= 3\n')
+		fid.write('Mesh.RemeshAlgorithm= 1\n')
+	fid.write('resolution=#g\n',resolution)
+	fid.write('radius=#g\n',radius)
+	fid.write('Point(1) = [0.0,0.0,0.0,resolution]\n')
+	fid.write('Point(2) = [radius,0.0,0.0,resolution]\n')
+	fid.write('Point(3) = [0,radius,0.0,resolution]\n')
+	fid.write('Circle(1) = [2,1,3]\n')
+	fid.write('Point(4) = [-radius,0,0.0,resolution]\n')
+	fid.write('Point(5) = [0,-radius,0.0,resolution]\n')
+	fid.write('Circle(2) = [3,1,4]\n')
+	fid.write('Circle(3) = [4,1,5]\n')
+	fid.write('Circle(4) = [5,1,2]\n')
+	fid.write('Point(6) = [0,0,-radius,resolution]\n')
+	fid.write('Point(7) = [0,0,radius,resolution]\n')
+	fid.write('Circle(5) = [3,1,6]\n')
+	fid.write('Circle(6) = [6,1,5]\n')
+	fid.write('Circle(7) = [5,1,7]\n')
+	fid.write('Circle(8) = [7,1,3]\n')
+	fid.write('Circle(9) = [2,1,7]\n')
+	fid.write('Circle(10) = [7,1,4]\n')
+	fid.write('Circle(11) = [4,1,6]\n')
+	fid.write('Circle(12) = [6,1,2]\n')
+	fid.write('Line Loop(13) = [2,8,-10]\n')
+	fid.write('Ruled Surface(14) = [13]\n')
+	fid.write('Line Loop(15) = [10,3,7]\n')
+	fid.write('Ruled Surface(16) = [15]\n')
+	fid.write('Line Loop(17) = [-8,-9,1]\n')
+	fid.write('Ruled Surface(18) = [17]\n')
+	fid.write('Line Loop(19) = [-11,-2,5]\n')
+	fid.write('Ruled Surface(20) = [19]\n')
+	fid.write('Line Loop(21) = [-5,-12,-1]\n')
+	fid.write('Ruled Surface(22) = [21]\n')
+	fid.write('Line Loop(23) = [-3,11,6]\n')
+	fid.write('Ruled Surface(24) = [23]\n')
+	fid.write('Line Loop(25) = [-7,4,9]\n')
+	fid.write('Ruled Surface(26) = [25]\n')
+	fid.write('Line Loop(27) = [-4,12,-6]\n')
+	fid.write('Ruled Surface(28) = [27]\n')
+	fid.write('Surface Loop(29) = [28,26,16,14,20,24,22,18]\n')
+	fid.write('Volume(30) = [29]\n')
+	fid.write('Physical Surface(1) = [28,26,16,14,20,24,22,18]\n')
+	fid.write('Physical Volume(2) = 30\n')
+	fid.close()
 	#}}}
 
@@ -90,9 +90,9 @@
 
 		#create .pos file with existing mesh and refining metric:  {{{
-		fid=fopen('sphere.pos','w')
+		fid=open('sphere.pos','w')
 
-		fprintf(fid,'View "background mesh" [\n')
+		fid.write('View "background mesh" [\n')
 		for i in range(meshini.numberofelements):
-			fprintf(fid,'ST(#g,#g,#g,#g,#g,#g,#g,#g,#g)[#g,#g,#g]\n',\
+			fid.write('ST(#g,#g,#g,#g,#g,#g,#g,#g,#g)[#g,#g,#g]\n',\
 			meshini.x(meshini.elements(i,0)), meshini.y(meshini.elements(i,0)), meshini.z(meshini.elements(i,0)),\
 			meshini.x(meshini.elements(i,1)), meshini.y(meshini.elements(i,1)), meshini.z(meshini.elements(i,1)),\
@@ -100,7 +100,7 @@
 			metric(meshini.elements(i,0)), metric(meshini.elements(i,1)), metric(meshini.elements(i,2))\
 			)
-		fprintf(fid,']\n')
+		fid.write(']\n')
 		
-		fclose(fid)
+		fid.close()
 		# }}}
 
@@ -113,5 +113,5 @@
 
 	#import mesh:  {{{
-	fid=fopen('sphere.msh','r')
+	fid=open('sphere.msh','r')
 
 	#Get Mesh format
@@ -150,5 +150,5 @@
 	if not strcmp(A,'$EndElements'):
 		raise RuntimeError(['Expecting $EndElements (', A, ')'])
-	fclose(fid) 
+	fid.close() 
 	#}}}
 
