Index: /issm/trunk-jpl/scripts/mToPy.py
===================================================================
--- /issm/trunk-jpl/scripts/mToPy.py	(revision 13455)
+++ /issm/trunk-jpl/scripts/mToPy.py	(revision 13455)
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#
+program =               'mToPy.py'
+version =               '1.0'
+versionReleaseDate =    '09/24/12'
+origAuthor =            'Mike Pellegrin'
+desc = '\nMain control unit for converting an matlab script file to python'
+#
+#   Note: Output will be put in the same (absolute) location as the input.
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#				History
+#	Date		Developer           Modification
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#	09/24/12	Michael Pellegrin	Initial Release         V1.0
+#
+#
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+import sys, os, shutil
+import translateToPy
+import mToPy   # touch mToPy to assertain location of installation
+
+def convert ( inputFile ):
+    try:
+      if os.path.exists( inputFile + '.m') and os.path.isfile( inputFile + '.m'):
+        checkBackupOutputFile( inputFile )
+        convertMToPy( inputFile )
+      else:
+        print 'Specified input file: ' + inputFile + '.m doesn\'t appear to exist'
+    finally:
+      print ''
+
+def convertMToPy ( inputFileName ):
+    translateToPy.convertToPython ( inputFileName + '.m', inputFileName + '.py' )
+
+def checkBackupOutputFile ( inputFile ):
+    mFile = inputFile + '.m'
+    pyFile = inputFile + '.py'
+    if os.path.exists( pyFile ):
+        i=1
+        bkupName = pyFile + str(i)
+        while os.path.exists( bkupName ):
+            i+=1
+            bkupName = pyFile + str(i)
+        os.rename( pyFile, bkupName )
+
+    shutil.copyfile(mFile, pyFile)
+
+if __name__ == "__main__":
+    convert( sys.argv[1])
+
Index: /issm/trunk-jpl/scripts/translateToPy.py
===================================================================
--- /issm/trunk-jpl/scripts/translateToPy.py	(revision 13455)
+++ /issm/trunk-jpl/scripts/translateToPy.py	(revision 13455)
@@ -0,0 +1,220 @@
+
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#
+program =               'translateToPy.py'
+version =               '1.0'
+versionReleaseDate =    '09/24/12'
+origAuthor =            'Mike Pellegrin'
+desc = '\nMatlab script conversion into python'
+#
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#				History
+#	Date		Developer           Modification
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#	09/24/12 Michael Pellegrin	Initial Release     V1.0
+#
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+import codecs, unicodedata
+import sys, re, datetime, os
+import decimal, operator
+
+
+outputLocation = sys.stdout
+inputFile = ""
+
+# other global vars
+indentLevel = 0
+
+
+def setupOutputLocation ( outFile ):
+    if outFile != sys.stdout:
+		globals()['outputLocation'] = open( outFile, 'w' ) # clobber
+
+def translateFile ( inputFile ):
+	f = codecs.open( inputFile, encoding='utf-8' )
+	try:
+		for line in f:
+			# print "in: " +line
+
+			asciiLine = unicodedata.normalize('NFKD', line).encode('ascii','ignore')
+			line = asciiLine
+
+			translateLine( line )
+
+	finally:
+		f.close()
+
+def translateLine ( line ):
+
+	if len(line) == 1:	# blank line
+		output( line )
+
+	elif line.split()[0][0] == '%':		# comment line
+		output("# " + line.replace('%','') )
+
+	else:		# needs cleanup.  this is a real-quick-n-dirty implimentation
+		#print line
+		res = line.replace('{','[')
+		res = res.replace('}',']')
+		res = res.replace('model','model()')
+		res = res.replace('SolutionEnum','SolutionEnum()')
+		res = res.replace('StressTensorEnum','StressTensorEnum()')
+		res = res.replace('.par','.py')
+		res = res.replace('=extrude(md,','.extrude(')
+
+		res = res.replace('thickness(pos)','thickness[pos]')
+		res = res.replace('find(md.','numpy.nonzero(md.')
+
+		res = res.replace('...','\\')
+		res = res.replace(';','')
+		res = res.replace('\n','')
+
+		res = convertFieldValues( res )
+
+		output(res)
+
+def convertFieldValues ( currentLine ):
+	# before utilizing regex's {starting w/ eg. \([0-9]\) } for special case: ...(#)...
+	# i noticed what i'm looking for is only TransientSolution(*). So, ...
+
+	res = currentLine
+	if 'md.results' in currentLine:
+		res = res.replace('(md.results.','md.results[\'')
+
+		if 'TransientSolution(' in currentLine:		# got a TransientSolution([0-9..]) case
+			res = res.replace('TransientSolution(','TransientSolution\'][')
+			parts = res.split(')')
+			res = parts[0] + '][\'' + parts[1].replace('.','') + '\']' + parts[2]
+
+		else:				# handle the other cases for md.results
+			
+			res = res.replace('Solution.Vx)','Solution\'][1][\'Vx\']')
+			res = res.replace('Solution.Vy)','Solution\'][1][\'Vy\']')
+			res = res.replace('Solution.Vz)','Solution\'][1][\'Vz\']')
+			res = res.replace('Solution.Vel)','Solution\'][1][\'Vel\']')
+
+			res = res.replace('Solution.Pressure)','Solution\'][1][\'Pressure\']')
+
+			res = res.replace('Solution.StressTensorxx)','Solution\'][1][\'StressTensorxx\']')
+			res = res.replace('Solution.StressTensorxy)','Solution\'][1][\'StressTensorxy\']')
+			res = res.replace('Solution.StressTensoryy)','Solution\'][1][\'StressTensoryy\']')
+			res = res.replace('Solution.StressTensorzz)','Solution\'][1][\'StressTensorzz\']')
+			res = res.replace('Solution.StressTensorxz)','Solution\'][1][\'StressTensorxz\']')
+			res = res.replace('Solution.StressTensoryz)','Solution\'][1][\'StressTensoryz\']')
+
+			res = res.replace('Solution.Thickness)','Solution\'][1][\'Thickness\']')
+
+			res = res.replace('Solution.Temperature)','Solution\'][1][\'Temperature\']')
+
+			res = res.replace('Solution.BasalforcingsMeltingRate)','Solution\'][1][\'BasalforcingsMeltingRate\']')
+
+			res = res.replace('Solution.SurfaceSlopeX)','Solution\'][1][\'SurfaceSlopeX\']')
+			res = res.replace('Solution.SurfaceSlopeY)','Solution\'][1][\'SurfaceSlopeY\']')
+			res = res.replace('Solution.SurfaceSlopeZ)','Solution\'][1][\'SurfaceSlopeZ\']')
+
+			res = res.replace('Solution.BedSlopeX)','Solution\'][1][\'BedSlopeX\']')
+			res = res.replace('Solution.BedSlopeY)','Solution\'][1][\'BedSlopeY\']')
+			res = res.replace('Solution.BedSlopeZ)','Solution\'][1][\'BedSlopeZ\']')
+
+			res = res.replace('Solution.Enthalpy)','Solution\'][1][\'Enthalpy\']')
+			res = res.replace('Solution.Waterfraction)','Solution\'][1][\'Waterfraction\']')
+			res = res.replace('Solution.Temperature)','Solution\'][1][\'Temperature\']')
+	return res
+
+def output ( line ):
+	numTabs = indentLevel
+	while numTabs:
+		numTabs -= 1
+		print >> outputLocation, '\t',
+	print >> outputLocation, line
+
+def outputTopOfSript( inputFile ):
+
+	global indentLevel
+
+	output("\"\"\"")
+	output("== == == == == == == == == == == == == == == == == == ==")
+	output("Auto generated python script for ISSM:   %s" % (inputFile) )
+	output("Created on %s via %s Ver %s by %s" % ( datetime.date.today(), program, version, os.getlogin()))
+	output("== == == == == == == == == == == == == == == == == == ==")
+	#output("")
+	output(desc)
+	output("%s Author: Michael Pellegrin" % (program))
+	output("%s Date: %s" % (program, versionReleaseDate))
+	output("== == == == == == == == == == == == == == == == == == ==")
+	output("\"\"\"")
+	output("")
+
+def outputBottomOfScript():
+
+	global indentLevel
+
+	output("")
+	
+def genericImports ():
+	output("from MatlabFuncs import *")
+	output("from model import *")
+	output("from EnumDefinitions import *")
+	output("from numpy import *")
+
+def createImports ( inputFile ):
+	genericImports()
+
+	# cycle through eachline to assertain import needs
+	f = codecs.open( inputFile, encoding='utf-8' )
+	try:
+		for line in f:
+			# print "in: " +line
+
+			# toss blank lines
+			if len(line) == 1:
+				continue
+
+			asciiLine = unicodedata.normalize('NFKD', line).encode('ascii','ignore')
+			line = asciiLine
+
+			for il in importList:
+				if line.find(il) != -1:
+					output( "from %s import *" % (il) )
+					importList.remove(il)	# already got it
+
+	finally:
+		output("")
+		f.close()
+
+
+def initImportList ():
+	global importList
+	
+	importList = [ \
+		'triangle'	,\
+		'setmask'	,\
+		'parameterize'	,\
+		'setflowequation'	,\
+		'meshconvert'	,\
+		'solve'	,\
+		#'zeros'					# -> numpy
+		]
+	
+
+
+def convertToPython ( inFile, outFile = sys.stdout ):
+    #print ' in cnvrt to python w/ file:' + inFile
+    initImportList()
+    setupOutputLocation( outFile )
+    outputTopOfSript( inFile )
+    createImports( inFile )
+    translateFile( inFile )
+    #    outputBottomOfScript()
+
+	
+if __name__ == "__main__":
+    #print ' in main w/ arg:' + sys.argv[1]+' '+sys.argv[2]
+    if len(sys.argv)==2:
+        convertToPython( sys.argv[1], sys.argv[2] )
+    else:
+        convertToPython( sys.argv[1] )
+
+
+
Index: /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
===================================================================
--- /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 13454)
+++ /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 13455)
@@ -1,4 +1,5 @@
 import os
 import numpy
+from ContourToMesh import ContourToMesh
 
 def SetIceShelfBC(md,icefrontfile=''):
@@ -24,6 +25,6 @@
 		if not os.path.exists(icefrontfile):
 			raise IOError("SetIceShelfBC error message: ice front file '%s' not found." % icefrontfile)
-		nodeinsideicefront=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2)
-		nodeonicefront=double(md.mesh.vertexonboundary and nodeinsideicefront)
+		nodeinsideicefront=ContourToMesh((md.mesh.elements).reshape(-1,1),(md.mesh.x).reshape(-1,1),(md.mesh.y).reshape(-1,1),icefrontfile,'node',2)
+		nodeonicefront= numpy.bitwise_and( map(int,md.mesh.vertexonboundary), map(int,nodeinsideicefront[0].ravel()) )
 	else:
 		nodeonicefront=numpy.zeros(md.mesh.numberofvertices)
Index: /issm/trunk-jpl/src/m/classes/flowequation.py
===================================================================
--- /issm/trunk-jpl/src/m/classes/flowequation.py	(revision 13454)
+++ /issm/trunk-jpl/src/m/classes/flowequation.py	(revision 13455)
@@ -1,3 +1,4 @@
 #module imports
+import copy
 import numpy
 from fielddisplay import fielddisplay
@@ -81,4 +82,6 @@
 
 	def marshall(self,fid):    # {{{
+		#print "marshalling flowequation-1"
+		#print self.vertex_equation
 		WriteData(fid,'object',self,'fieldname','ismacayealpattyn','format','Boolean')
 		WriteData(fid,'object',self,'fieldname','ishutter','format','Boolean')
@@ -89,5 +92,6 @@
 		WriteData(fid,'object',self,'fieldname','borderstokes','format','DoubleMat','mattype',1)
 		#convert approximations to enums
-		data=self.vertex_equation
+		## data=list(self.vertex_equation)
+		data=copy.deepcopy(self.vertex_equation)
 		data[numpy.nonzero(data==0)]=NoneApproximationEnum()
 		data[numpy.nonzero(data==1)]=HutterApproximationEnum()
@@ -100,5 +104,6 @@
 		data[numpy.nonzero(data==8)]=L1L2ApproximationEnum()
 		WriteData(fid,'data',data,'enum',FlowequationVertexEquationEnum(),'format','DoubleMat','mattype',1)
-		data=self.element_equation
+		########data=self.element_equation
+		data=copy.deepcopy(self.element_equation)
 		data[numpy.nonzero(data==0)]=NoneApproximationEnum()
 		data[numpy.nonzero(data==1)]=HutterApproximationEnum()
@@ -111,4 +116,6 @@
 		data[numpy.nonzero(data==8)]=L1L2ApproximationEnum()
 		WriteData(fid,'data',data,'enum',FlowequationElementEquationEnum(),'format','DoubleMat','mattype',2)
+		#print "marshalling flowequation-4"
+		#print self.vertex_equation
 	# }}}
 
Index: /issm/trunk-jpl/src/modules/python/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/modules/python/Makefile.am	(revision 13454)
+++ /issm/trunk-jpl/src/modules/python/Makefile.am	(revision 13455)
@@ -14,4 +14,5 @@
 						NodeConnectivity.la\
 						StringToEnum.la\
+						ContourToMesh.la\
 						TriMesh.la
 endif 
@@ -94,4 +95,8 @@
 StringToEnum_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
 
+ContourToMesh_la_SOURCES = ../ContourToMesh/ContourToMesh.cpp\
+								  ../ContourToMesh/ContourToMesh.h
+ContourToMesh_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
 TriMesh_la_SOURCES = ../TriMesh/TriMesh.cpp\
 							../TriMesh/TriMesh.h
Index: /issm/trunk-jpl/test/NightlyRun/test201.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test201.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test201.py	(revision 13455)
@@ -0,0 +1,26 @@
+from model import *
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from EnumDefinitions import *
+from solve import *
+from MatlabFuncs import *
+from ContourToMesh import *
+
+md=triangle(model(),'../Exp/Square.exp',150000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelf.py')
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md=solve(md,DiagnosticSolutionEnum())
+
+#Fields and tolerances to track changes
+field_names     =['Vx','Vy','Vel','Pressure']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13]
+field_values=[\
+	md.results['DiagnosticSolution'][1]['Vx'],\
+	md.results['DiagnosticSolution'][1]['Vy'],\
+	md.results['DiagnosticSolution'][1]['Vel'],\
+	md.results['DiagnosticSolution'][1]['Pressure'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3001.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3001.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3001.py	(revision 13455)
@@ -0,0 +1,47 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3001.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',50000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.diagnostic.requested_outputs=StressTensorEnum()
+md.autodiff.isautodiff=true
+md=solve(md,DiagnosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Vx','Vy','Vel','Pressure',\
+	'StressTensorxx','StressTensoryy','StressTensorxy']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,\
+	1e-13,1e-13,1e-13]
+field_values=[\
+	md.results['DiagnosticSolution'][1]['Vx'],\
+	md.results['DiagnosticSolution'][1]['Vy'],\
+	md.results['DiagnosticSolution'][1]['Vel'],\
+	md.results['DiagnosticSolution'][1]['Pressure'],\
+	md.results['DiagnosticSolution'][1]['StressTensorxx'],\
+	md.results['DiagnosticSolution'][1]['StressTensoryy'],\
+	md.results['DiagnosticSolution'][1]['StressTensorxy'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3002.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3002.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3002.py	(revision 13455)
@@ -0,0 +1,43 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3002.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',180000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md.extrude(3,2)
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.autodiff.isautodiff=true
+md=solve(md,DiagnosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Vx','Vy','Vz','Vel','Pressure']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13]
+field_values=[\
+	md.results['DiagnosticSolution'][1]['Vx'],\
+	md.results['DiagnosticSolution'][1]['Vy'],\
+	md.results['DiagnosticSolution'][1]['Vz'],\
+	md.results['DiagnosticSolution'][1]['Vel'],\
+	md.results['DiagnosticSolution'][1]['Pressure'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3003.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3003.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3003.py	(revision 13455)
@@ -0,0 +1,52 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3003.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',180000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md.extrude(3,2)
+md=setflowequation(md,'pattyn','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.diagnostic.requested_outputs=StressTensorEnum()
+md.autodiff.isautodiff=true
+md=solve(md,DiagnosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Vx','Vy','Vz','Vel','Pressure',\
+	'StressTensorxx','StressTensoryy','StressTensorzz','StressTensorxy','StressTensorxz','StressTensoryz']
+field_tolerances=[1e-09,1e-09,1e-09,1e-09,1e-09,\
+	1e-09,1e-09,1e-09,1e-09,1e-09,1e-09]
+field_values=[\
+	md.results['DiagnosticSolution'][1]['Vx'],\
+	md.results['DiagnosticSolution'][1]['Vy'],\
+	md.results['DiagnosticSolution'][1]['Vz'],\
+	md.results['DiagnosticSolution'][1]['Vel'],\
+	md.results['DiagnosticSolution'][1]['Pressure'],\
+	md.results['DiagnosticSolution'][1]['StressTensorxx'],\
+	md.results['DiagnosticSolution'][1]['StressTensoryy'],\
+	md.results['DiagnosticSolution'][1]['StressTensorzz'],\
+	md.results['DiagnosticSolution'][1]['StressTensorxy'],\
+	md.results['DiagnosticSolution'][1]['StressTensorxz'],\
+	md.results['DiagnosticSolution'][1]['StressTensoryz'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3004.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3004.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3004.py	(revision 13455)
@@ -0,0 +1,43 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3004.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',180000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md.extrude(3,2)
+md=setflowequation(md,'stokes','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.autodiff.isautodiff=true
+md=solve(md,DiagnosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Vx','Vy','Vz','Vel','Pressure']
+field_tolerances=[1e-08,1e-08,1e-07,1e-08,1e-08]
+field_values=[\
+	md.results['DiagnosticSolution'][1]['Vx'],\
+	md.results['DiagnosticSolution'][1]['Vy'],\
+	md.results['DiagnosticSolution'][1]['Vz'],\
+	md.results['DiagnosticSolution'][1]['Vel'],\
+	md.results['DiagnosticSolution'][1]['Pressure'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3005.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3005.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3005.py	(revision 13455)
@@ -0,0 +1,38 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3005.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',150000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.autodiff.isautodiff=true
+md=solve(md,PrognosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Thickness']
+field_tolerances=[1e-13]
+field_values=[\
+	md.results['PrognosticSolution'][1]['Thickness'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3006.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3006.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3006.py	(revision 13455)
@@ -0,0 +1,42 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3006.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from meshconvert import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',150000)
+md=meshconvert(md)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.prognostic.stabilization=3
+md.prognostic.spcthickness=md.geometry.thickness
+md.autodiff.isautodiff=true
+md=solve(md,PrognosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Thickness']
+field_tolerances=[1e-13]
+field_values=[\
+	md.results['PrognosticSolution'][1]['Thickness'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3007.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3007.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3007.py	(revision 13455)
@@ -0,0 +1,39 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3007.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',150000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md=setflowequation(md,'macayeal','all')
+md.extrude(5,3)
+md.cluster=generic('name',oshostname(),'np',3)
+md.autodiff.isautodiff=true
+md=solve(md,PrognosticSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Thickness']
+field_tolerances=[1e-13]
+field_values=[\
+	md.results['PrognosticSolution'][1]['Thickness'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3008.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3008.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3008.py	(revision 13455)
@@ -0,0 +1,41 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3008.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',180000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md.extrude(3,1)
+md=setflowequation(md,'macayeal','all')
+md.timestepping.time_step=0
+md.cluster=generic('name',oshostname(),'np',3)
+md.autodiff.isautodiff=true
+md=solve(md,ThermalSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Temperature','BasalforcingsMeltingRate']
+field_tolerances=[1e-13,1e-13]
+field_values=[\
+	md.results['ThermalSolution'][1]['Temperature'],\
+	md.results['ThermalSolution'][1]['BasalforcingsMeltingRate'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3009.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3009.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3009.py	(revision 13455)
@@ -0,0 +1,44 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3009.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',180000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md.extrude(3,1)
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.transient.isdiagnostic=0
+md.transient.isprognostic=0
+md.transient.isthermal=1
+md.transient.isgroundingline=0
+md.autodiff.isautodiff=true
+md=solve(md,TransientSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Temperature','BasalforcingsMeltingRate']
+field_tolerances=[1e-13,1e-13]
+field_values=[\
+	md.results['TransientSolution'][1]['Temperature'],\
+	md.results['TransientSolution'][1]['BasalforcingsMeltingRate'],\
+	]
Index: /issm/trunk-jpl/test/NightlyRun/test3010.py
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/test3010.py	(revision 13455)
+++ /issm/trunk-jpl/test/NightlyRun/test3010.py	(revision 13455)
@@ -0,0 +1,66 @@
+"""
+== == == == == == == == == == == == == == == == == == ==
+Auto generated python script for ISSM:   test3010.m
+Created on 2012-09-25 via translateToPy.py Ver 1.0 by mikep
+== == == == == == == == == == == == == == == == == == ==
+
+Matlab script conversion into python
+translateToPy.py Author: Michael Pellegrin
+translateToPy.py Date: 09/24/12
+== == == == == == == == == == == == == == == == == == ==
+"""
+
+from MatlabFuncs import *
+from model import *
+from EnumDefinitions import *
+import numpy
+from triangle import *
+from setmask import *
+from parameterize import *
+from setflowequation import *
+from solve import *
+
+md=triangle(model(),'../Exp/Square.exp',150000)
+md=setmask(md,'all','')
+md=parameterize(md,'../Par/SquareShelfConstrained.py')
+md=setflowequation(md,'macayeal','all')
+md.cluster=generic('name',oshostname(),'np',3)
+md.transient.requested_outputs=IceVolumeEnum()
+
+
+md.autodiff.isautodiff=true
+md=solve(md,TransientSolutionEnum())
+
+
+# Fields and tolerances to track changes
+
+field_names     =['Vx1','Vy1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Volume1','Vx2','Vy2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Volume2','Vx3','Vy3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Volume3']
+field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+						1e-13,1e-13,1e-13,1e-13,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=[\
+	md.results['TransientSolution'][1]['Vx'],\
+	md.results['TransientSolution'][1]['Vy'],\
+	md.results['TransientSolution'][1]['Vel'],\
+	md.results['TransientSolution'][1]['Pressure'],\
+	md.results['TransientSolution'][1]['Bed'],\
+	md.results['TransientSolution'][1]['Surface'],\
+	md.results['TransientSolution'][1]['Thickness'],\
+	md.results['TransientSolution'][1]['IceVolume'],\
+	md.results['TransientSolution'][2]['Vx'],\
+	md.results['TransientSolution'][2]['Vy'],\
+	md.results['TransientSolution'][2]['Vel'],\
+	md.results['TransientSolution'][2]['Pressure'],\
+	md.results['TransientSolution'][2]['Bed'],\
+	md.results['TransientSolution'][2]['Surface'],\
+	md.results['TransientSolution'][2]['Thickness'],\
+	md.results['TransientSolution'][2]['IceVolume'],\
+	md.results['TransientSolution'][3]['Vx'],\
+	md.results['TransientSolution'][3]['Vy'],\
+	md.results['TransientSolution'][3]['Vel'],\
+	md.results['TransientSolution'][3]['Pressure'],\
+	md.results['TransientSolution'][3]['Bed'],\
+	md.results['TransientSolution'][3]['Surface'],\
+	md.results['TransientSolution'][3]['Thickness'],\
+	md.results['TransientSolution'][3]['IceVolume'],\
+	]
Index: /issm/trunk-jpl/test/Par/SquareShelf.py
===================================================================
--- /issm/trunk-jpl/test/Par/SquareShelf.py	(revision 13455)
+++ /issm/trunk-jpl/test/Par/SquareShelf.py	(revision 13455)
@@ -0,0 +1,89 @@
+import os.path
+import inspect
+import netCDF4
+from numpy import *
+from verbose import *
+from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
+from paterson import *
+from SetIceShelfBC import *
+
+#Start defining model parameters here
+#Geometry
+hmin=300.
+hmax=1000.
+ymin=min(md.mesh.y)
+ymax=max(md.mesh.y)
+
+md.geometry.thickness=hmax+(hmin-hmax)*(md.mesh.y-ymin)/(ymax-ymin)
+md.geometry.bed=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness
+md.geometry.surface=md.geometry.bed+md.geometry.thickness
+
+#Initial velocity and pressure
+iVelF = netCDF4.Dataset('../Data/SquareShelf.nc','r')
+
+x=reshape(iVelF.variables['x'][:],(-1))
+y=reshape(iVelF.variables['y'][:],(-1))
+vx=iVelF.variables['vx'][:]
+vy=iVelF.variables['vy'][:]
+index=iVelF.variables['index'][:].astype(float)
+index=reshape(index.T,(len(index),3),order='F')
+
+#dbg - begin
+# #print 'vars in SquareShelf.nc:'
+# #for v in iVelF.variables:
+# #	print v
+#dbg - end 
+
+iVelF.close()
+
+[md.initialization.vx]=InterpFromMeshToMesh2d(index,x,y,vx,md.mesh.x,md.mesh.y)
+[md.initialization.vy]=InterpFromMeshToMesh2d(index,x,y,vy,md.mesh.x,md.mesh.y)
+md.initialization.vz=zeros(md.mesh.numberofvertices)
+md.initialization.pressure=zeros(md.mesh.numberofvertices)
+
+#dbg - begin
+#print '...vx:'
+#print md.initialization.vx
+#print '...vy:'
+#print md.initialization.vy
+##print '...vz:'
+##print md.initialization.vz
+##print '...pressure:'
+##print md.initialization.pressure
+#dbg - end 
+
+
+#Materials
+md.initialization.temperature = (273.-20.)*ones(md.mesh.numberofvertices)
+md.materials.rheology_B = paterson(md.initialization.temperature)
+md.materials.rheology_n = 3.*ones(md.mesh.numberofelements)
+
+#Friction
+pos=nonzero(md.mask.elementonfloatingice)
+md.friction.coefficient = 20.*ones(md.mesh.numberofvertices)
+md.friction.coefficient[md.mesh.elements[pos,:].astype(int)-1] = 0.
+md.friction.p = ones(md.mesh.numberofelements)
+md.friction.q = ones(md.mesh.numberofelements)
+
+#Numerical parameters
+md.diagnostic.viscosity_overshoot = 0.3
+md.prognostic.stabilization = 1.
+md.thermal.stabilization = 1.
+md.settings.waitonlock = 30.
+md.verbose=verbose()
+md.diagnostic.restol = 0.10
+md.steadystate.reltol = 0.02
+md.diagnostic.reltol = 0.02
+md.diagnostic.abstol = nan
+md.timestepping.time_step = 1.
+md.timestepping.final_time = 3.
+
+#Boundary conditions:
+# #md=SetIceShelfBC(md)
+print '...calling seticeshelfbc:'
+md=SetIceShelfBC(md,'../Exp/SquareFront.exp')
+print '...called seticeshelfbc:'
+
+#Change name so that no test have the same name
+if len(inspect.stack()) > 2:
+	md.miscellaneous.name=os.path.basename(inspect.stack()[2][1]).split('.')[0]
