Index: /issm/trunk/cron/configs/linux64_seroussi_ucitrunk
===================================================================
--- /issm/trunk/cron/configs/linux64_seroussi_ucitrunk	(revision 11027)
+++ /issm/trunk/cron/configs/linux64_seroussi_ucitrunk	(revision 11027)
@@ -0,0 +1,93 @@
+#
+########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full path)
+ISSM_DIR="/u/astrid-r1b/seroussi/issm"
+ISSM_TIER="/u/astrid-r1b/seroussi/issm/trunk-jpl/cron/trunk"
+#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
+
+#ISSM Architecture
+ISSM_ARCH="linux-gnu-amd64"
+
+#Machine configuration
+MACHINE="astrid"
+
+#MATLAB path
+MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="checkout"
+
+#SVN repository
+REPOSITORY="https://issm.ess.uci.edu:80/svn/issm/issm/trunk"
+#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/u/astrid-r1b/seroussi/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="install"
+EXTERNALPACKAGESDIR="/u/astrid-r1b/seroussi/issm/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="yes"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=1
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=7
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS=""
Index: /issm/trunk/cron/cronfiles/linux_cronfile
===================================================================
--- /issm/trunk/cron/cronfiles/linux_cronfile	(revision 11026)
+++ /issm/trunk/cron/cronfiles/linux_cronfile	(revision 11027)
@@ -12,2 +12,3 @@
 00 23 * * 1-5 cd /u/astrid-r1b/seroussi/issm/trunk-jpl/cron/ && ./nightlyrun.sh configs/linux64_seroussi_nightly
 00 23 * * 6   cd /u/astrid-r1b/seroussi/issm/trunk-jpl/cron/ && ./nightlyrun.sh configs/linux64_seroussi_validation
+00 23 * * 7   cd /u/astrid-r1b/seroussi/issm/trunk-jpl/cron/ && ./nightlyrun.sh configs/linux64_seroussi_ucitrunk
Index: /issm/trunk/examples/SquareIceShelf/runme.m
===================================================================
--- /issm/trunk/examples/SquareIceShelf/runme.m	(revision 11026)
+++ /issm/trunk/examples/SquareIceShelf/runme.m	(revision 11027)
@@ -1,4 +1,4 @@
 md=model;
-md=setmesh(md,'DomainOutline.exp',100000);
+md=triangle(md,'DomainOutline.exp',100000);
 md=setmask(md,'all','');
 md=parameterize(md,'Square.par');
Index: /issm/trunk/externalpackages/vim/addons/vimrc
===================================================================
--- /issm/trunk/externalpackages/vim/addons/vimrc	(revision 11026)
+++ /issm/trunk/externalpackages/vim/addons/vimrc	(revision 11027)
@@ -211,4 +211,12 @@
 			\\begin{equation}
 			\<CR>\end{equation}<up><C-R>=Eatchar('\s')<CR>
+au BufRead,BufNewFile *.tex iab IT 
+			\\begin{itemize}
+			\<CR>\item 
+			\<CR>\end{itemize}<up><C-R>=Eatchar('\s')<CR>
+au BufRead,BufNewFile *.tex iab EN 
+			\\begin{enumerate}
+			\<CR>\item 
+			\<CR>\end{enumerate}<up><C-R>=Eatchar('\s')<CR>
 au BufRead,BufNewFile *.tex ab (()) \left( \right)
 "}}}
Index: /issm/trunk/src/c/Container/Elements.cpp
===================================================================
--- /issm/trunk/src/c/Container/Elements.cpp	(revision 11026)
+++ /issm/trunk/src/c/Container/Elements.cpp	(revision 11027)
@@ -164,5 +164,5 @@
 /*}}}*/
 /*FUNCTION Elements::ToResults{{{1*/
-void Elements::ToResults(Results* results,Parameters* parameters,int step, double time){
+void Elements::ToResults(Results* results,Parameters* parameters){
 
 	extern int my_rank;
@@ -170,10 +170,13 @@
 	Patch  *patch        = NULL;
 	int    *resultsenums = NULL;
+	int    *resultssizes  = NULL;
+	int    *resultssteps  = NULL;
+	double *resultstimes = NULL;
 	double *vector_serial= NULL;
 	Vec     vector       = NULL;
 	bool   io_gather;
 	bool   results_as_patches;
-	int    numberofvertices;
-	int    numberofresults;
+	int    numberofvertices,numberofelements;
+	int    numberofresults,vectorsize;
 
 	/*Recover parameters: */
@@ -181,11 +184,29 @@
 	parameters->FindParam(&results_as_patches,SettingsResultsAsPatchesEnum);
 	parameters->FindParam(&numberofvertices,MeshNumberofverticesEnum);
+	parameters->FindParam(&numberofelements,MeshNumberofelementsEnum);
 
 	if(!results_as_patches){
 		/*No patch here, we prepare vectors*/
 
-		/*OK, see what the first element of this partition has in stock (this is common to all partitions)*/
-		Element* element=(Element*)this->GetObjectByOffset(0);
-		element->ListResultsEnums(&resultsenums,&numberofresults);
+		/*see what the first element of this partition has in stock (this is common to all partitions)*/
+		if(my_rank==0){
+			if(this->Size()==0) _error_("Cannot write results because first partition has no element. Maybe too many cpus were requested");
+			Element* element=(Element*)this->GetObjectByOffset(0);
+			element->ListResultsInfo(&resultsenums,&resultssizes,&resultstimes,&resultssteps,&numberofresults);
+		}
+		MPI_Bcast(&numberofresults,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
+
+		/*Get out if there is no results. Otherwise broadcast info*/
+		if(!numberofresults) return;
+		if(my_rank!=0){
+			resultsenums=(int*)xmalloc(numberofresults*sizeof(int));
+			resultssizes=(int*)xmalloc(numberofresults*sizeof(int));
+			resultstimes=(double*)xmalloc(numberofresults*sizeof(double));
+			resultssteps=(int*)xmalloc(numberofresults*sizeof(int));
+		}
+		MPI_Bcast(resultsenums,numberofresults,MPI_INT,0,MPI_COMM_WORLD);
+		MPI_Bcast(resultssizes,numberofresults,MPI_INT,0,MPI_COMM_WORLD);
+		MPI_Bcast(resultstimes,numberofresults,MPI_DOUBLE,0,MPI_COMM_WORLD);
+		MPI_Bcast(resultssteps,numberofresults,MPI_INT,0,MPI_COMM_WORLD);
 
 		/*Loop over all results and get nodal vector*/
@@ -193,8 +214,12 @@
 
 			/*Get vector for result number i*/
-			vector=NewVec(numberofvertices);
+			if(resultssizes[i]==P1Enum)      vectorsize=numberofvertices;
+			else if(resultssizes[i]==P0Enum) vectorsize=numberofelements;
+			else _error_("Unkown result size: %s",EnumToStringx(resultssizes[i]));
+			vector=NewVec(vectorsize);
+
 			for(int j=0;j<this->Size();j++){
 				Element* element=(Element*)this->GetObjectByOffset(j);
-				element->GetVectorFromResults(vector,resultsenums[i]);
+				element->GetVectorFromResults(vector,i,resultssizes[i]);
 			}
 			VecAssemblyBegin(vector);
@@ -205,5 +230,5 @@
 			if(my_rank==0){
 				/*No need to add this vector for all cpus*/
-				results->AddObject(new DoubleVecExternalResult(results->Size()+1,resultsenums[i],vector_serial,numberofvertices,step,time));
+				results->AddObject(new DoubleVecExternalResult(results->Size()+1,resultsenums[i],vector_serial,vectorsize,resultssteps[i],resultstimes[i]));
 			}
 
@@ -224,7 +249,7 @@
 		/*create result object and add to results dataset:*/
 		if (patch->maxvertices && patch->maxnodes){
-			results->AddObject(new IntExternalResult(results->Size()+1,PatchVerticesEnum,patch->maxvertices,step,time));
-			results->AddObject(new IntExternalResult(results->Size()+1,PatchNodesEnum,   patch->maxnodes,step,time));
-			results->AddObject(new DoubleMatExternalResult(results->Size()+1,PatchEnum,patch->values,patch->numrows,patch->numcols,step,time));
+			results->AddObject(new IntExternalResult(results->Size()+1,PatchVerticesEnum,patch->maxvertices,1,0));
+			results->AddObject(new IntExternalResult(results->Size()+1,PatchNodesEnum,   patch->maxnodes,1,0));
+			results->AddObject(new DoubleMatExternalResult(results->Size()+1,PatchEnum,  patch->values,patch->numrows,patch->numcols,1,0));
 		}
 	}
@@ -232,4 +257,7 @@
 	/*Free ressources:*/
 	xfree((void**)&resultsenums);
+	xfree((void**)&resultssizes);
+	xfree((void**)&resultstimes);
+	xfree((void**)&resultssteps);
 	delete patch;
 }
Index: /issm/trunk/src/c/Container/Elements.h
===================================================================
--- /issm/trunk/src/c/Container/Elements.h	(revision 11026)
+++ /issm/trunk/src/c/Container/Elements.h	(revision 11027)
@@ -30,5 +30,5 @@
 		void ProcessResultsUnits(void);
 		void SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
-		void ToResults(Results* results,Parameters* parameters,int step, double time);
+		void ToResults(Results* results,Parameters* parameters);
 		Patch* ResultsToPatch(void);
 		int   NumberOfElements(void);
Index: /issm/trunk/src/c/Container/Results.cpp
===================================================================
--- /issm/trunk/src/c/Container/Results.cpp	(revision 11026)
+++ /issm/trunk/src/c/Container/Results.cpp	(revision 11027)
@@ -136,5 +136,5 @@
 
 	/*Fill each field: */
-	for(i=0;i<nfields-2;i++){ //do not include the last one used for time
+	for(i=0;i<this->Size();i++){ //do not include the last one used for time
 		ExternalResult* result=(ExternalResult*)this->GetObjectByOffset(i);
 		result->SetMatlabField(dataref);
Index: /issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 11027)
@@ -47,5 +47,5 @@
 	iomodel->FetchData(4,MeshElementsEnum,MeshElementconnectivityEnum,MaterialsRheologyBEnum,MaterialsRheologyNEnum);
 	#ifdef _HAVE_THREED_
-	if(dim==3)          iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
+	if(dim==3)iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
 	#endif
 	if(control_analysis)iomodel->FetchData(3,InversionControlParametersEnum,InversionMinParametersEnum,InversionMaxParametersEnum);
@@ -76,5 +76,6 @@
 
 	/*Fetch data:*/
-	iomodel->FetchData(5,MeshXEnum,MeshYEnum,MeshZEnum,BedEnum,ThicknessEnum);
+	iomodel->FetchData(6,MeshElementsEnum,MeshXEnum,MeshYEnum,MeshZEnum,BedEnum,ThicknessEnum);
+	CreateNumberNodeToElementConnectivity(iomodel);
 	
 	for (i=0;i<numberofvertices;i++){
@@ -89,5 +90,5 @@
 
 	/*Free data: */
-	iomodel->DeleteData(5,MeshXEnum,MeshYEnum,MeshZEnum,BedEnum,ThicknessEnum);
+	iomodel->DeleteData(6,MeshElementsEnum,MeshXEnum,MeshYEnum,MeshZEnum,BedEnum,ThicknessEnum);
 
 	/*Assign output pointer: */
Index: /issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp	(revision 11027)
@@ -27,4 +27,7 @@
 	/*output*/
 	int* connectivity=NULL;
+
+	/*Check that this has not been done yet*/
+	if(iomodel->numbernodetoelementconnectivity) return;
 
 	/*Fetch parameters: */
Index: /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp	(revision 11027)
@@ -59,7 +59,6 @@
 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
-	iomodel->FetchDataToInput(elements,VxEnum,InversionVxObsEnum,0);
-	iomodel->FetchDataToInput(elements,VyEnum,InversionVyObsEnum,0);
-	iomodel->FetchDataToInput(elements,BathymetryEnum);
+	iomodel->FetchDataToInput(elements,VxEnum);
+	iomodel->FetchDataToInput(elements,VyEnum);
 
 	if (dim==3){
Index: /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHutter/CreateNodesDiagnosticHutter.cpp	(revision 11027)
@@ -45,5 +45,4 @@
 	/*First fetch data: */
 	iomodel->FetchData(7,MeshVertexonbedEnum,MeshVertexonsurfaceEnum,MaskVertexongroundediceEnum,MaskVertexonfloatingiceEnum,MeshElementsEnum,FlowequationVertexEquationEnum,MaskVertexonwaterEnum);
-	CreateNumberNodeToElementConnectivity(iomodel);
 
 	for (i=0;i<numberofvertices;i++){
Index: /issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/ModelProcessorx/ModelProcessorx.cpp	(revision 11027)
@@ -19,8 +19,6 @@
 void ModelProcessorx(Elements** pelements, Nodes** pnodes, Vertices** pvertices, Materials** pmaterials, Constraints** pconstraints, Loads** ploads, Parameters** pparameters, FILE* IOMODEL,const int solution_type,const int nummodels,const int* analysis_type_list){
 
-	int i;
-	int analysis_type;
-	int dim;
-	int verbose;
+	int   i,analysis_type,dim,verbose;
+	bool  isthermal,isprognostic,isdiagnostic,isgroundingline;
 	
 	/*output: */
@@ -40,4 +38,8 @@
 	iomodel->Constant(&dim,MeshDimensionEnum);
 	iomodel->Constant(&verbose,VerboseEnum);
+	iomodel->Constant(&isthermal,TransientIsthermalEnum);
+	iomodel->Constant(&isprognostic,TransientIsprognosticEnum);
+	iomodel->Constant(&isdiagnostic,TransientIsdiagnosticEnum);
+	iomodel->Constant(&isgroundingline,TransientIsgroundinglineEnum);
 	
 	SetVerbosityLevel(verbose);
@@ -50,4 +52,10 @@
 		if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && dim==2) continue;
 		if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && dim==2) continue;
+		if(solution_type==TransientSolutionEnum && analysis_type==ThermalAnalysisEnum && isthermal==false) continue;
+		if(solution_type==TransientSolutionEnum && analysis_type==MeltingAnalysisEnum && isthermal==false) continue;
+		if(solution_type==TransientSolutionEnum && analysis_type==PrognosticAnalysisEnum && isprognostic==false && isgroundingline==false) continue;
+		if(solution_type==TransientSolutionEnum && analysis_type==DiagnosticHorizAnalysisEnum && isdiagnostic==false) continue;
+		if(solution_type==TransientSolutionEnum && analysis_type==DiagnosticVertAnalysisEnum && isdiagnostic==false) continue;
+		if(solution_type==TransientSolutionEnum && analysis_type==DiagnosticHutterAnalysisEnum && isdiagnostic==false) continue;
 	
 		_printf_(VerboseMProcessor(),"   create datasets for analysis %s\n",EnumToStringx(analysis_type));
Index: /issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
===================================================================
--- /issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp	(revision 11027)
@@ -41,4 +41,5 @@
 	iomodel->FetchDataToInput(elements,SurfaceEnum);
 	iomodel->FetchDataToInput(elements,BedEnum);
+	iomodel->FetchDataToInput(elements,BathymetryEnum);
 	iomodel->FetchDataToInput(elements,MaskElementonfloatingiceEnum);
 	iomodel->FetchDataToInput(elements,MaskElementonwaterEnum);
Index: /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 11026)
+++ /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 11027)
@@ -17,7 +17,7 @@
 		
 #ifdef _SERIAL_
-void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results** presults, int step, double time){
+void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results** presults){
 #else 
-void OutputResultsx(                    Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results** presults, int step, double time){
+void OutputResultsx(                    Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results** presults){
 #endif
 
@@ -54,5 +54,5 @@
 	/*We have results inside our elements, loads, etc ... Get them out of there, into the results dataset: */
 	elements->ProcessResultsUnits();
-	elements->ToResults(results,parameters,step,time);
+	elements->ToResults(results,parameters);
 	elements->DeleteResults();
 
Index: /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h
===================================================================
--- /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 11026)
+++ /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 11027)
@@ -16,7 +16,7 @@
 #ifdef _SERIAL_
 #include <mex.h>
-void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results** presults,int step=1,double time=0);
+void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results** presults);
 #else
-void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results** presults,int step=1,double time=0);
+void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results** presults);
 #endif
 
Index: /issm/trunk/src/c/objects/ElementResults/BoolElementResult.cpp
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/BoolElementResult.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/BoolElementResult.cpp	(revision 11027)
@@ -185,15 +185,11 @@
 /*}}}*/
 /*FUNCTION BoolElementResult::GetVectorFromResults{{{1*/
-void BoolElementResult::GetVectorFromResults(Vec vector,int* doflist,int numdofs){
+void BoolElementResult::GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs){
 
-	double *doublevalues=NULL;
+	_error_("cannot return vector on vertices");
+} /*}}}*/
+/*FUNCTION BoolElementResult::GetElementVectorFromResults{{{1*/
+void BoolElementResult::GetElementVectorFromResults(Vec vector,int dof){
 
-	/*Cast value to double vector*/
-	doublevalues=(double*)xmalloc(numdofs*sizeof(double));
-	for(int i=0;i<numdofs;i++) doublevalues[i]=double(this->value);
-
-	VecSetValues(vector,numdofs,doflist,(const double*)doublevalues,INSERT_VALUES);
-
-	/*cleanup*/
-	xfree((void**)&doublevalues);
+	VecSetValue(vector,dof,(double)value,INSERT_VALUES);
 } /*}}}*/
Index: /issm/trunk/src/c/objects/ElementResults/BoolElementResult.h
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/BoolElementResult.h	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/BoolElementResult.h	(revision 11027)
@@ -45,4 +45,6 @@
 		/*ElementResult virtual functions definitions: {{{1*/
 		ElementResult* SpawnTriaElementResult(int* indices);
+		double  GetTime(void){return time;};
+		int     GetStep(void){return step;};
 		void    ProcessUnits(Parameters* parameters);
 		int     NumberOfNodalValues(void);
@@ -51,5 +53,6 @@
 		/*BoolElementResult management: {{{1*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vec vector,int* doflist,int numdofs);
+		void GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vec vector,int dof);
 		/*}}}*/
 };
Index: /issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/DoubleElementResult.h	(revision 11027)
@@ -45,4 +45,6 @@
 		/*ElementResult virtual functions definitions: {{{1*/
 		ElementResult* SpawnTriaElementResult(int* indices);
+		double  GetTime(void){return time;};
+		int     GetStep(void){return step;};
 		void    ProcessUnits(Parameters* parameters);
 		int     NumberOfNodalValues(void);
@@ -51,5 +53,6 @@
 		/*DoubleElementResult management: {{{1*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vec vector,int* doflist,int numdofs){_error_("not implemented");};
+		void GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs){_error_("not implemented");};
+		void GetElementVectorFromResults(Vec vector,int dof){_error_("not implemented");};
 		/*}}}*/
 };
Index: /issm/trunk/src/c/objects/ElementResults/ElementResult.h
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/ElementResult.h	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/ElementResult.h	(revision 11027)
@@ -19,9 +19,12 @@
 		
 		virtual         ElementResult* SpawnTriaElementResult(int* indices)=0;
+		virtual double  GetTime(void)=0;
+		virtual int     GetStep(void)=0;
 		virtual void    ProcessUnits(Parameters* parameters)=0;
 		virtual int     NumberOfNodalValues(void)=0;
 		virtual void    PatchFill(int row, Patch* patch)=0;
 		virtual int     InstanceEnum()=0;
-		virtual void    GetVectorFromResults(Vec vector,int* doflist,int numdof)=0;
+		virtual void    GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdof)=0;
+		virtual void    GetElementVectorFromResults(Vec vector,int dof)=0;
 
 };
Index: /issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.cpp
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.cpp	(revision 11027)
@@ -195,8 +195,16 @@
 /*}}}*/
 /*FUNCTION PentaVertexElementResult::GetVectorFromResults{{{1*/
-void PentaVertexElementResult::GetVectorFromResults(Vec vector,int* doflist,int numdofs){
+void PentaVertexElementResult::GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs){
+
+	double data[6];
 
 	if(numdofs!=6)_error_("Result %s is a PentaVertexElementResult and cannot write vector of %i dofs",numdofs);
-	VecSetValues(vector,numdofs,doflist,(const double*)this->values,INSERT_VALUES);
+	for(int i=0;i<6;i++) data[i]=this->values[i]/(double)connectivitylist[i];
+	VecSetValues(vector,numdofs,doflist,(const double*)&data,ADD_VALUES);
 
 } /*}}}*/
+/*FUNCTION PentaVertexElementResult::GetElementVectorFromResults{{{1*/
+void PentaVertexElementResult::GetElementVectorFromResults(Vec vector,int dof){
+
+	_error_("Result %s is a PentaVertexElementResult and should not write vector of size numberofelemenrs",EnumToStringx(enum_type));
+} /*}}}*/
Index: /issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.h
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.h	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/PentaVertexElementResult.h	(revision 11027)
@@ -44,4 +44,6 @@
 		/*ElementResult virtual functions definitions: {{{1*/
 		ElementResult* SpawnTriaElementResult(int* indices);
+		double  GetTime(void){return time;};
+		int     GetStep(void){return step;};
 		void    ProcessUnits(Parameters* parameters);
 		int     NumberOfNodalValues(void);
@@ -50,5 +52,6 @@
 		/*PentaVertexElementResult management: {{{1*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vec vector,int* doflist,int numdofs);
+		void GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vec vector,int dof);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.cpp
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.cpp	(revision 11027)
@@ -184,8 +184,16 @@
 /*}}}*/
 /*FUNCTION TriaVertexElementResult::GetVectorFromResults{{{1*/
-void TriaVertexElementResult::GetVectorFromResults(Vec vector,int* doflist,int numdofs){
+void TriaVertexElementResult::GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs){
+
+	double data[3];
 
 	if(numdofs!=3)_error_("Result %s is a TriaVertexElementResult and cannot write vector of %i dofs",numdofs);
-	VecSetValues(vector,numdofs,doflist,(const double*)this->values,INSERT_VALUES);
+	for(int i=0;i<3;i++) data[i]=this->values[i]/(double)connectivitylist[i];
+	VecSetValues(vector,numdofs,doflist,(const double*)&data,ADD_VALUES);
 
 } /*}}}*/
+/*FUNCTION TriaVertexElementResult::GetElementVectorFromResults{{{1*/
+void TriaVertexElementResult::GetElementVectorFromResults(Vec vector,int dof){
+
+	_error_("Result %s is a TriaVertexElementResult and should not write vector of size numberofelemenrs",EnumToStringx(enum_type));
+} /*}}}*/
Index: /issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.h
===================================================================
--- /issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.h	(revision 11026)
+++ /issm/trunk/src/c/objects/ElementResults/TriaVertexElementResult.h	(revision 11027)
@@ -43,4 +43,6 @@
 		/*ElementResult virtual functions definitions: {{{1*/
 		ElementResult* SpawnTriaElementResult(int* indices);
+		double  GetTime(void){return time;};
+		int     GetStep(void){return step;};
 		void    ProcessUnits(Parameters* parameters);
 		int     NumberOfNodalValues(void);
@@ -49,5 +51,6 @@
 		/*TriaVertexElementResult management: {{{1*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vec vector,int* doflist,int numdofs);
+		void GetVectorFromResults(Vec vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vec vector,int dof);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Elements/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Element.h	(revision 11026)
+++ /issm/trunk/src/c/objects/Elements/Element.h	(revision 11027)
@@ -47,5 +47,5 @@
 		virtual void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes)=0;
 		virtual void   PatchFill(int* pcount, Patch* patch)=0;
-		virtual void   ListResultsEnums(int** results_enums,int* num_results)=0;
+		virtual void   ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results)=0;
 		virtual void   DeleteResults(void)=0;
 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type)=0;
@@ -59,5 +59,5 @@
 		virtual void   InputScale(int enum_type,double scale_factor)=0;
 		virtual void   GetVectorFromInputs(Vec vector, int name_enum)=0;
-		virtual void   GetVectorFromResults(Vec vector,int name_enum)=0;
+		virtual void   GetVectorFromResults(Vec vector,int id,int interp)=0;
 		virtual void   InputArtificialNoise(int enum_type,double min,double max)=0;
 		virtual bool   InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums)=0;
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 11027)
@@ -817,4 +817,9 @@
 }
 /*}}}*/
+/*FUNCTION Penta::GetConnectivityList {{{1*/
+void  Penta::GetConnectivityList(int* connectivity){
+	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=nodes[i]->GetConnectivity();
+}
+/*}}}*/
 /*FUNCTION Penta::GetElementType {{{1*/
 int Penta::GetElementType(){
@@ -1139,20 +1144,21 @@
 /*}}}*/
 /*FUNCTION Penta::GetVectorFromResults{{{1*/
-void  Penta::GetVectorFromResults(Vec vector,int result_enum){
-
-	int doflist1[NUMVERTICES];
-
-	/*Prepare index list*/
-	this->GetSidList(&doflist1[0]);
-
-	/*Get result)*/
-	for(int i=0;i<this->results->Size();i++){
-		ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);
-		if(elementresult->InstanceEnum()!=result_enum) continue;
-		elementresult->GetVectorFromResults(vector,&doflist1[0],NUMVERTICES);
-		return;
-	}
-
-	_error_("Result %s not found in element",EnumToStringx(result_enum));
+void  Penta::GetVectorFromResults(Vec vector,int offset,int interp){
+
+	/*Get result*/
+	ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(offset);
+	if(interp==P1Enum){
+		int doflist1[NUMVERTICES];
+		int connectivity[NUMVERTICES];
+		this->GetSidList(&doflist1[0]);
+		this->GetConnectivityList(&connectivity[0]);
+		elementresult->GetVectorFromResults(vector,&doflist1[0],&connectivity[0],NUMVERTICES);
+	}
+	else if(interp==P0Enum){
+		elementresult->GetElementVectorFromResults(vector,sid);
+	}
+	else{
+		printf("Interpolation %s not supported\n",EnumToStringx(interp));
+	}
 }
 /*}}}*/
@@ -2057,6 +2063,6 @@
 }
 /*}}}*/
-/*FUNCTION Penta::ListResultsEnums{{{*/
-void Penta::ListResultsEnums(int** in_results_enums,int* in_num_results){
+/*FUNCTION Penta::ListResultsInfo{{{*/
+void Penta::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,double** in_resultstimes,int** in_resultssteps,int* in_num_results){
 
 	/*Intermediaries*/
@@ -2064,4 +2070,7 @@
 	int     numberofresults = 0;
 	int     *resultsenums   = NULL;
+	int     *resultssizes   = NULL;
+	double  *resultstimes   = NULL;
+	int     *resultssteps   = NULL;
 
 	/*Checks*/
@@ -2078,4 +2087,7 @@
 		/*Allocate output*/
 		resultsenums=(int*)xmalloc(numberofresults*sizeof(int));
+		resultssizes=(int*)xmalloc(numberofresults*sizeof(int));
+		resultstimes=(double*)xmalloc(numberofresults*sizeof(double));
+		resultssteps=(int*)xmalloc(numberofresults*sizeof(int));
 
 		/*populate enums*/
@@ -2083,4 +2095,12 @@
 			ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);
 			resultsenums[i]=elementresult->InstanceEnum();
+			resultstimes[i]=elementresult->GetTime();
+			resultssteps[i]=elementresult->GetStep();
+			if(elementresult->ObjectEnum()==PentaVertexElementResultEnum){
+				resultssizes[i]=P1Enum;
+			}
+			else{
+				resultssizes[i]=P0Enum;
+			}
 		}
 	}
@@ -2088,5 +2108,8 @@
 	/*Assign output pointers:*/
 	*in_num_results=numberofresults;
-	*in_results_enums=resultsenums;
+	*in_resultsenums=resultsenums;
+	*in_resultssizes=resultssizes;
+	*in_resultstimes=resultstimes;
+	*in_resultssteps=resultssteps;
 
 }/*}}}*/
@@ -2674,22 +2697,16 @@
 			/*default vx,vy and vz: either observation or 0 */
 			if(!iomodel->Data(VxEnum)){
-				if (iomodel->Data(InversionVxObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->Data(InversionVxObsEnum)[penta_vertex_ids[i]-1]/yts;
-				else                 for(i=0;i<6;i++)nodeinputs[i]=0;
+				for(i=0;i<6;i++)nodeinputs[i]=0;
 				this->inputs->AddInput(new PentaVertexInput(VxEnum,nodeinputs));
-				this->inputs->AddInput(new PentaVertexInput(VxPicardEnum,nodeinputs));
 				if(dakota_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVxEnum,nodeinputs));
 			}
 			if(!iomodel->Data(VyEnum)){
-				if (iomodel->Data(InversionVyObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->Data(InversionVyObsEnum)[penta_vertex_ids[i]-1]/yts;
-				else                 for(i=0;i<6;i++)nodeinputs[i]=0;
+				for(i=0;i<6;i++)nodeinputs[i]=0;
 				this->inputs->AddInput(new PentaVertexInput(VyEnum,nodeinputs));
-				this->inputs->AddInput(new PentaVertexInput(VyPicardEnum,nodeinputs));
 				if(dakota_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVyEnum,nodeinputs));
 			}
 			if(!iomodel->Data(VzEnum)){
-				if (iomodel->Data(InversionVzObsEnum)) for(i=0;i<6;i++)nodeinputs[i]=iomodel->Data(InversionVzObsEnum)[penta_vertex_ids[i]-1]/yts;
-				else                 for(i=0;i<6;i++)nodeinputs[i]=0;
+				for(i=0;i<6;i++)nodeinputs[i]=0;
 				this->inputs->AddInput(new PentaVertexInput(VzEnum,nodeinputs));
-				this->inputs->AddInput(new PentaVertexInput(VzPicardEnum,nodeinputs));
 				if(dakota_analysis) this->inputs->AddInput(new PentaVertexInput(QmuVzEnum,nodeinputs));
 			}
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 11026)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 11027)
@@ -92,5 +92,5 @@
 		double GetZcoord(GaussPenta* gauss);
 		void   GetVectorFromInputs(Vec vector,int name_enum);
-		void   GetVectorFromResults(Vec vector,int name_enum);
+		void   GetVectorFromResults(Vec vector,int offset,int interp);
 		
 		int    Sid();
@@ -107,5 +107,5 @@
 		void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
 		void   RequestedOutput(int output_enum,int step,double time);
-		void   ListResultsEnums(int** results_enums,int* num_results);
+		void   ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results);
 		void   PatchFill(int* pcount, Patch* patch);
 		void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
@@ -169,4 +169,5 @@
 		void	  GetDofList1(int* doflist);
 		void    GetSidList(int* sidlist);
+		void    GetConnectivityList(int* connectivity);
 		int     GetElementType(void);
 		void    GetElementSizes(double* hx,double* hy,double* hz);
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 11027)
@@ -1178,8 +1178,10 @@
 /*FUNCTION Tria::GetSidList {{{1*/
 void  Tria::GetSidList(int* sidlist){
-
-	int i;
-	for(i=0;i<NUMVERTICES;i++) sidlist[i]=nodes[i]->GetSidList();
-
+	for(int i=0;i<NUMVERTICES;i++) sidlist[i]=nodes[i]->GetSidList();
+}
+/*}}}*/
+/*FUNCTION Tria::GetConnectivityList {{{1*/
+void  Tria::GetConnectivityList(int* connectivity){
+	for(int i=0;i<NUMVERTICES;i++) connectivity[i]=nodes[i]->GetConnectivity();
 }
 /*}}}*/
@@ -1240,5 +1242,5 @@
 
 	/*Get out if this is not an element input*/
-	if (!IsInput(input_enum)) return;
+	if(!IsInput(input_enum)) return;
 
 	/*Prepare index list*/
@@ -1254,21 +1256,21 @@
 /*}}}*/
 /*FUNCTION Tria::GetVectorFromResults{{{1*/
-void  Tria::GetVectorFromResults(Vec vector,int result_enum){
-
-	bool found=false;
-	int doflist1[NUMVERTICES];
-
-	/*Prepare index list*/
-	this->GetSidList(&doflist1[0]);
-
-	/*Get result)*/
-	for(int i=0;i<this->results->Size();i++){
-		ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);
-		if(elementresult->InstanceEnum()!=result_enum) continue;
-		elementresult->GetVectorFromResults(vector,&doflist1[0],NUMVERTICES);
-		return;
-	}
-
-	_error_("Result %s not found in element",EnumToStringx(result_enum));
+void  Tria::GetVectorFromResults(Vec vector,int offset,int interp){
+
+	/*Get result*/
+	ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(offset);
+	if(interp==P1Enum){
+		int doflist1[NUMVERTICES];
+		int connectivity[NUMVERTICES];
+		this->GetSidList(&doflist1[0]);
+		this->GetConnectivityList(&connectivity[0]);
+		elementresult->GetVectorFromResults(vector,&doflist1[0],&connectivity[0],NUMVERTICES);
+	}
+	else if(interp==P0Enum){
+		elementresult->GetElementVectorFromResults(vector,sid);
+	}
+	else{
+		printf("Interpolation %s not supported\n",EnumToStringx(interp));
+	}
 }
 /*}}}*/
@@ -1897,6 +1899,6 @@
 }
 /*}}}*/
-/*FUNCTION Tria::ListResultsEnums{{{*/
-void Tria::ListResultsEnums(int** in_results_enums,int* in_num_results){
+/*FUNCTION Tria::ListResultsInfo{{{*/
+void Tria::ListResultsInfo(int** in_resultsenums,int** in_resultssizes,double** in_resultstimes,int** in_resultssteps,int* in_num_results){
 
 	/*Intermediaries*/
@@ -1904,4 +1906,7 @@
 	int     numberofresults = 0;
 	int     *resultsenums   = NULL;
+	int     *resultssizes   = NULL;
+	double  *resultstimes   = NULL;
+	int     *resultssteps   = NULL;
 
 	/*Checks*/
@@ -1918,4 +1923,7 @@
 		/*Allocate output*/
 		resultsenums=(int*)xmalloc(numberofresults*sizeof(int));
+		resultssizes=(int*)xmalloc(numberofresults*sizeof(int));
+		resultstimes=(double*)xmalloc(numberofresults*sizeof(double));
+		resultssteps=(int*)xmalloc(numberofresults*sizeof(int));
 
 		/*populate enums*/
@@ -1923,4 +1931,12 @@
 			ElementResult* elementresult=(ElementResult*)this->results->GetObjectByOffset(i);
 			resultsenums[i]=elementresult->InstanceEnum();
+			resultstimes[i]=elementresult->GetTime();
+			resultssteps[i]=elementresult->GetStep();
+			if(elementresult->ObjectEnum()==TriaVertexElementResultEnum){
+				resultssizes[i]=P1Enum;
+			}
+			else{
+				resultssizes[i]=P0Enum;
+			}
 		}
 	}
@@ -1928,5 +1944,8 @@
 	/*Assign output pointers:*/
 	*in_num_results=numberofresults;
-	*in_results_enums=resultsenums;
+	*in_resultsenums=resultsenums;
+	*in_resultssizes=resultssizes;
+	*in_resultstimes=resultstimes;
+	*in_resultssteps=resultssteps;
 
 }/*}}}*/
@@ -2310,22 +2329,16 @@
 			/*default vx,vy and vz: either observation or 0 */
 			if(!iomodel->Data(VxEnum)){
-				if (iomodel->Data(InversionVxObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->Data(InversionVxObsEnum)[tria_vertex_ids[i]-1]/yts;
-				else                 for(i=0;i<3;i++)nodeinputs[i]=0;
+				for(i=0;i<3;i++)nodeinputs[i]=0;
 				this->inputs->AddInput(new TriaVertexInput(VxEnum,nodeinputs));
-				this->inputs->AddInput(new TriaVertexInput(VxPicardEnum,nodeinputs));
 				if(dakota_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVxEnum,nodeinputs));
 			}
 			if(!iomodel->Data(VyEnum)){
-				if (iomodel->Data(InversionVyObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->Data(InversionVyObsEnum)[tria_vertex_ids[i]-1]/yts;
-				else                 for(i=0;i<3;i++)nodeinputs[i]=0;
+				for(i=0;i<3;i++)nodeinputs[i]=0;
 				this->inputs->AddInput(new TriaVertexInput(VyEnum,nodeinputs));
-				this->inputs->AddInput(new TriaVertexInput(VyPicardEnum,nodeinputs));
 				if(dakota_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVyEnum,nodeinputs));
 			}
 			if(!iomodel->Data(VzEnum)){
-				if (iomodel->Data(InversionVzObsEnum)) for(i=0;i<3;i++)nodeinputs[i]=iomodel->Data(InversionVzObsEnum)[tria_vertex_ids[i]-1]/yts;
-				else                 for(i=0;i<3;i++)nodeinputs[i]=0;
+				for(i=0;i<3;i++)nodeinputs[i]=0;
 				this->inputs->AddInput(new TriaVertexInput(VzEnum,nodeinputs));
-				this->inputs->AddInput(new TriaVertexInput(VzPicardEnum,nodeinputs));
 				if(dakota_analysis) this->inputs->AddInput(new TriaVertexInput(QmuVzEnum,nodeinputs));
 			}
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 11026)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 11027)
@@ -92,5 +92,5 @@
 		void   GetSolutionFromInputs(Vec solution);
 		void   GetVectorFromInputs(Vec vector, int name_enum);
-		void   GetVectorFromResults(Vec vector,int name_enum);
+		void   GetVectorFromResults(Vec vector,int offset,int interp);
 		void   InputArtificialNoise(int enum_type,double min, double max);
 		bool   InputConvergence(double* eps, int* enums,int num_enums,int* criterionenums,double* criterionvalues,int num_criterionenums);
@@ -106,5 +106,5 @@
 		void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
 		void   RequestedOutput(int output_enum,int step,double time);
-		void   ListResultsEnums(int** results_enums,int* num_results);
+		void   ListResultsInfo(int** results_enums,int** results_size,double** results_times,int** results_steps,int* num_results);
 		void   PatchFill(int* pcount, Patch* patch);
 		void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes);
@@ -183,4 +183,5 @@
 		void	         GetDofList1(int* doflist);
 		void           GetSidList(int* sidlist);
+		void           GetConnectivityList(int* connectivity);
 		void           GetInputListOnVertices(double* pvalue,int enumtype);
 		void           GetInputListOnVertices(double* pvalue,int enumtype,double defaultvalue);
Index: /issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp
===================================================================
--- /issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp	(revision 11027)
@@ -209,8 +209,8 @@
 void DoubleVecExternalResult::SetMatlabField(mxArray* dataref){
 
-	mxArray* pfield=NULL;
-	double* doublemat=NULL;
-	char* name=NULL;
-	double* doublevec=NULL;
+	mxArray *pfield    = NULL;
+	double  *doublemat = NULL;
+	char    *name      = NULL;
+	double  *doublevec = NULL;
 
 	/*Make a copy of the value, to be used by matlab: */
@@ -230,5 +230,4 @@
 	mxSetField( dataref, this->step-1, "time",mxCreateDoubleScalar((double)this->time)); 
 	mxSetField( dataref, this->step-1, "step",mxCreateDoubleScalar((double)this->step)); 
-
 }
 #endif
Index: /issm/trunk/src/c/objects/Node.cpp
===================================================================
--- /issm/trunk/src/c/objects/Node.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/Node.cpp	(revision 11027)
@@ -65,6 +65,4 @@
 	if (iomodel->Data(MaskVertexongroundediceEnum))
 	 this->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,(IssmBool)iomodel->Data(MaskVertexongroundediceEnum)[io_index]));
-	if (iomodel->numbernodetoelementconnectivity)
-	 this->inputs->AddInput(new IntInput(NumberNodeToElementConnectivityEnum,(IssmInt)iomodel->numbernodetoelementconnectivity[io_index]));
 	if (analysis_type==DiagnosticHorizAnalysisEnum)
 	 this->inputs->AddInput(new IntInput(ApproximationEnum,(IssmInt)iomodel->Data(FlowequationVertexEquationEnum)[io_index]));
@@ -664,10 +662,8 @@
 /*FUNCTION Node::GetConnectivity {{{1*/
 int Node::GetConnectivity(){
-	int connectivity;
-
-	/*recover parameters: */
-	inputs->GetInputValue(&connectivity,NumberNodeToElementConnectivityEnum);
-
-	return connectivity;
+
+	Vertex*  vertex=NULL;
+	vertex=(Vertex*)hvertex->delivers();
+	return vertex->connectivity;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Vertex.cpp
===================================================================
--- /issm/trunk/src/c/objects/Vertex.cpp	(revision 11026)
+++ /issm/trunk/src/c/objects/Vertex.cpp	(revision 11027)
@@ -24,6 +24,6 @@
 /*}}}*/
 /*FUNCTION Vertex::Vertex(int vertex_id, double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){{{1*/
-Vertex::Vertex(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){
-	this->Init(vertex_id, vertex_sid,vertex_x, vertex_y, vertex_z, vertex_sigma);
+Vertex::Vertex(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma,int vertex_connectivity){
+	this->Init(vertex_id, vertex_sid,vertex_x, vertex_y, vertex_z, vertex_sigma,vertex_connectivity);
 }
 /*}}}*/
@@ -31,5 +31,8 @@
 Vertex::Vertex(int vertex_id, int vertex_sid,int i, IoModel* iomodel){
 
-	this->Init(vertex_id, vertex_sid, iomodel->Data(MeshXEnum)[i],iomodel->Data(MeshYEnum)[i],iomodel->Data(MeshZEnum)[i],(iomodel->Data(MeshZEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]));
+	_assert_(iomodel->Data(MeshXEnum) && iomodel->Data(MeshYEnum) && iomodel->Data(MeshZEnum));
+	_assert_(iomodel->Data(BedEnum) && iomodel->Data(ThicknessEnum) && iomodel->numbernodetoelementconnectivity);
+
+	this->Init(vertex_id, vertex_sid, iomodel->Data(MeshXEnum)[i],iomodel->Data(MeshYEnum)[i],iomodel->Data(MeshZEnum)[i],(iomodel->Data(MeshZEnum)[i]-iomodel->Data(BedEnum)[i])/(iomodel->Data(ThicknessEnum)[i]),iomodel->numbernodetoelementconnectivity[i]);
 
 }
@@ -41,5 +44,5 @@
 /*}}}*/
 /*FUNCTION Vertex::Init{{{1*/
-void Vertex::Init(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma){
+void Vertex::Init(int vertex_id, int vertex_sid,double vertex_x, double vertex_y, double vertex_z, double vertex_sigma,int vertex_connectivity){
 
 	/*all the initialization has been done by the initializer, just fill in the id: */
@@ -50,4 +53,5 @@
 	this->z=vertex_z;
 	this->sigma=vertex_sigma;
+	this->connectivity=vertex_connectivity;
 	this->dof=UNDEF;
 
@@ -67,4 +71,5 @@
 	printf("   z: %g\n",z);
 	printf("   sigma: %g\n",sigma);
+	printf("   connectivity: %g\n",connectivity);
 	printf("   dof: %i\n",dof);
 	printf("   clone: %i\n",clone);
@@ -74,5 +79,4 @@
 /*}}}*/
 /*FUNCTION Vertex::DeepEcho{{{1*/
-
 void Vertex::DeepEcho(void){
 	this->Echo();
@@ -111,4 +115,5 @@
 	memcpy(marshalled_dataset,&z,sizeof(z));marshalled_dataset+=sizeof(z);
 	memcpy(marshalled_dataset,&sigma,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
+	memcpy(marshalled_dataset,&connectivity,sizeof(connectivity));marshalled_dataset+=sizeof(connectivity);
 	memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
 	memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
@@ -127,4 +132,5 @@
 		sizeof(z)+
 		sizeof(sigma)+
+		sizeof(connectivity)+
 		sizeof(dof)+
 		sizeof(clone)+
@@ -150,4 +156,5 @@
 	memcpy(&z,marshalled_dataset,sizeof(z));marshalled_dataset+=sizeof(z);
 	memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
+	memcpy(&connectivity,marshalled_dataset,sizeof(connectivity));marshalled_dataset+=sizeof(connectivity);
 	memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
 	memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
@@ -259,4 +266,7 @@
 
 /*Vertex management: */
+/*FUNCTION Vertex::Connectivity{{{1*/
+int    Vertex::Connectivity(void){return connectivity;}
+/*}}}*/
 /*FUNCTION Vertex::Sid{{{1*/
 int    Vertex::Sid(void){ return sid; }
Index: /issm/trunk/src/c/objects/Vertex.h
===================================================================
--- /issm/trunk/src/c/objects/Vertex.h	(revision 11026)
+++ /issm/trunk/src/c/objects/Vertex.h	(revision 11027)
@@ -21,10 +21,11 @@
 	public: 
 
-		int  id;
-		int  sid; //sid for "serial" id, ie the rank of this vertex in the vertices dataset, if the dataset was serial on 1 cpu.
+		int    id;
+		int    sid;            //sid for "serial" id, ie the rank of this vertex in the vertices dataset, if the dataset was serial on 1 cpu.
 		double x;
 		double y;
 		double z;
-		double sigma; //sigma coordinate: (z-bed)/thickness
+		double sigma;          //sigma coordinate: (z-bed)/thickness
+		int    connectivity;   //number of vertices connected to this vertex
 
 		/*dof management: */
@@ -34,6 +35,6 @@
 		/*Vertex constructors, destructors {{{1*/
 		Vertex();
-		Vertex(int id, int sid,double x, double y, double z, double sigma); 
-		void Init(int id, int sid, double x, double y, double z, double sigma);
+		Vertex(int id, int sid,double x, double y, double z, double sigma, int connectivity); 
+		void Init(int id, int sid, double x, double y, double z, double sigma,int connectivity);
 		Vertex(int id, int sid, int i, IoModel* iomodel);
 		~Vertex();
@@ -61,4 +62,5 @@
 		/*Vertex management: {{{1*/
 		int   Sid(void); 
+		int   Connectivity(void); 
 		void  UpdatePosition(double* thickness,double* bed);
 		/*}}}*/
Index: /issm/trunk/src/c/solutions/hydrology_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/hydrology_core.cpp	(revision 11026)
+++ /issm/trunk/src/c/solutions/hydrology_core.cpp	(revision 11027)
@@ -61,5 +61,5 @@
 			/*unload results*/
 			_printf_(VerboseSolution(),"   saving temporary results\n");
-			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results,i+1,time);
+			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
 
 		}
Index: /issm/trunk/src/c/solutions/transient_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/transient_core.cpp	(revision 11026)
+++ /issm/trunk/src/c/solutions/transient_core.cpp	(revision 11027)
@@ -133,5 +133,5 @@
 			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum,step,time);
 			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum,step,time);
-			if(dim==3) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,step,time);
+			if(dim==3 && isthermal) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,step,time);
 			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BasalforcingsMeltingRateEnum,step,time);
 			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceforcingsMassBalanceEnum,step,time);
@@ -141,5 +141,5 @@
 			/*unload results*/
 			_printf_(VerboseSolution(),"   saving temporary results\n");
-			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results,step,time);
+			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
 		}
 	}
Index: /issm/trunk/src/c/solvers/solver_stokescoupling_nonlinear.cpp
===================================================================
--- /issm/trunk/src/c/solvers/solver_stokescoupling_nonlinear.cpp	(revision 11026)
+++ /issm/trunk/src/c/solvers/solver_stokescoupling_nonlinear.cpp	(revision 11027)
@@ -54,4 +54,5 @@
 		//Update once again the solution to make sure that vx and vxold are similar (for next step in transient or steadystate)
 		InputUpdateFromSolutionx(femmodel->elements,femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,ug_horiz);
+		VecFree(&ug_horiz);
 
 		//save pointer to old velocity
Index: /issm/trunk/src/m/classes/basalforcings.m
===================================================================
--- /issm/trunk/src/m/classes/basalforcings.m	(revision 11026)
+++ /issm/trunk/src/m/classes/basalforcings.m	(revision 11027)
@@ -31,5 +31,5 @@
 		function checkconsistency(obj,md,solution,analyses) % {{{
 
-			if ismember(PrognosticAnalysisEnum,analyses),
+			if ismember(PrognosticAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isprognostic==0),
 				checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
 			end
@@ -37,5 +37,5 @@
 				checkfield(md,'basalforcings.melting_rate','NaN',1,'size',[md.mesh.numberofvertices 1]);
 			end
-			if ismember(ThermalAnalysisEnum,analyses),
+			if ismember(ThermalAnalysisEnum,analyses) & ~(solution==TransientSolutionEnum & md.transient.isthermal==0),
 				checkfield(md,'basalforcings.melting_rate','NaN',1,'forcing',1);
 				checkfield(md,'basalforcings.geothermalflux','NaN',1,'forcing',1,'>=',0);
Index: /issm/trunk/src/m/classes/diagnostic.m
===================================================================
--- /issm/trunk/src/m/classes/diagnostic.m	(revision 11026)
+++ /issm/trunk/src/m/classes/diagnostic.m	(revision 11027)
@@ -74,4 +74,5 @@
 			%Early return
 			if ~ismember(DiagnosticHorizAnalysisEnum,analyses), return; end
+			%if ~ismember(DiagnosticHorizAnalysisEnum,analyses) |  (solution==TransientSolutionEnum & md.transient.isdiagnostic==0), return; end
 
 			checkfield(md,'diagnostic.spcvx','forcing',1);
Index: /issm/trunk/src/m/classes/inversion.m
===================================================================
--- /issm/trunk/src/m/classes/inversion.m	(revision 11026)
+++ /issm/trunk/src/m/classes/inversion.m	(revision 11027)
@@ -113,10 +113,10 @@
 		function disp(obj) % {{{
 			fielddisplay(obj,'iscontrol','is inversion activated?');
-			fielddisplay(obj,'control_parameters','parameter where inverse control is carried out; ex: {''FrictionCoefficient''}, or {''RheologyBbar''}');
+			fielddisplay(obj,'control_parameters','parameter where inverse control is carried out; ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}');
+			fielddisplay(obj,'nsteps','number of optimization searches');
+			fielddisplay(obj,'cost_functions','indicate the type of response for each optimization steps');
 			fielddisplay(obj,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter');
-			fielddisplay(obj,'nsteps','number of optimization searches');
+			fielddisplay(obj,'cost_function_threshold','misfit convergence criterion. Default is 1%, NaN if not applied');
 			fielddisplay(obj,'maxiter_per_step','maximum iterations during each optimization step');
-			fielddisplay(obj,'cost_functions','indicate the type of response for each optimization steps');
-			fielddisplay(obj,'cost_function_threshold','misfit convergence criterion. Default is 1%, NaN if not applied');
 			fielddisplay(obj,'gradient_scaling','scaling factor on gradient direction during optimization, for each optimization step');
 			fielddisplay(obj,'step_threshold','decrease threshold for misfit, default is 30%');
Index: /issm/trunk/src/m/classes/prognostic.m
===================================================================
--- /issm/trunk/src/m/classes/prognostic.m	(revision 11026)
+++ /issm/trunk/src/m/classes/prognostic.m	(revision 11027)
@@ -42,5 +42,5 @@
 
 			%Early return,
-			if ~ismember(PrognosticAnalysisEnum,analyses), return; end
+			if ~ismember(PrognosticAnalysisEnum,analyses) |  (solution==TransientSolutionEnum & md.transient.isprognostic==0), return; end
 
 			checkfield(md,'prognostic.spcthickness','forcing',1);
Index: /issm/trunk/src/m/classes/rifts.m
===================================================================
--- /issm/trunk/src/m/classes/rifts.m	(revision 11026)
+++ /issm/trunk/src/m/classes/rifts.m	(revision 11027)
@@ -55,5 +55,4 @@
 			disp(sprintf('   rifts parameters:'));
 
-			fielddisplay(obj,'numrifts','number of of rifts');
 			fielddisplay(obj,'riftstruct','structure containing all rift information (vertices coordinates, segments, type of melange, ...)');
 			fielddisplay(obj,'riftproperties','');
Index: /issm/trunk/src/m/classes/thermal.m
===================================================================
--- /issm/trunk/src/m/classes/thermal.m	(revision 11026)
+++ /issm/trunk/src/m/classes/thermal.m	(revision 11027)
@@ -46,5 +46,5 @@
 
 			%Early return
-			if ~ismember(ThermalAnalysisEnum,analyses), return; end
+			if ~ismember(ThermalAnalysisEnum,analyses) | (solution==TransientSolutionEnum & md.transient.isthermal==0), return; end
 
 			checkfield(md,'thermal.stabilization','numel',1,'values',[0 1 2]);
Index: sm/trunk/src/m/model/bamg.m
===================================================================
--- /issm/trunk/src/m/model/bamg.m	(revision 11026)
+++ 	(revision )
@@ -1,344 +1,0 @@
-function md=bamg(md,varargin)
-%BAMG - mesh generation
-%
-%   Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
-%
-%   - domain: followed by an ARGUS file that prescribes the domain outline
-%   - hmin  : minimum edge length (default is 10^-100)
-%   - hmax  : maximum esge length (default is 10^100)
-%   - hVertices   : imposed edge length for each vertex (geometry or mesh)
-%   - hminVertices: minimum edge length for each vertex (mesh)
-%   - hmaxVertices: maximum edge length for each vertex (mesh)
-%
-%   - anisomax    : maximum ration between the smallest and largest edges (default is 10^30)
-%   - coeff       : coefficient applied to the metric (2-> twice as many elements, default is 1)
-%   - cutoff      : scalar used to compute the metric when metric type 2 or 3 are applied
-%   - err         : error used to generate the metric from a field
-%   - errg        : geometrical error (default is 0.1)
-%   - field       : field of the model that will be used to compute the metric
-%                   to apply several fields, use one column per field
-%   - gradation   : maximum ration between two adjacent edges
-%   - Hessiantype : 0 -> use double P2 projection (default)
-%                   1 -> use Green formula
-%   - KeepVertices: try to keep initial vertices when adaptation is done on an existing mesh (default 1)
-%   - MaxCornerAngle: maximal angle of corners in degree (default is 10)
-%   - maxnbv      : maximum number of vertices used to allocate memory (default is 10^6)
-%   - maxsubdiv   : maximum subdivision of exisiting elements (default is 10)
-%   - metric      : matrix (numberofnodes x 3) used as a metric
-%   - Metrictype  : 1 -> absolute error          c/(err coeff^2) * Abs(H)        (default)
-%                   2 -> relative error          c/(err coeff^2) * Abs(H)/max(s,cutoff*max(s))
-%                   3 -> rescaled absolute error c/(err coeff^2) * Abs(H)/(smax-smin)
-%   - nbjacoby    : correction used by Hessiantype=1 (default is 1)
-%   - nbsmooth    : number of metric smoothing procedure (default is 3)
-%   - omega       : relaxation parameter of the smoothing procedure (default is 1.8)
-%   - power       : power applied to the metric (default is 1)
-%   - splitcorners : split triangles whuch have 3 vertices on the outline (default is 1)
-%   - geometricalmetric : Take the geometry into account to generate the metric (default is 0)
-%   - verbose     : level of verbosity (default is 1)
-%
-%   - rifts : followed by an ARGUS file that prescribes the rifts
-%   - toltip: tolerance to move tip on an existing point of the domain outline
-%   - tracks: followed by an ARGUS file that prescribes the tracks that the mesh will stick to
-%   - RequiredVertices: mesh vertices that are required. [x,y,ref]; ref is optional
-%   - tol:    if the distance between 2 points of the domain outline is less than tol, they
-%             will be merged
-%
-%   Examples:
-%      md=bamg(md,'domain','DomainOutline.exp','hmax',3000);
-%      md=bamg(md,'field',[md.inversion.vel_obs md.geometry.thickness],'hmax',20000,'hmin',1000);
-%      md=bamg(md,'metric',A,'hmin',1000,'hmax',20000,'gradation',3,'anisomax',1);
-
-%process options
-options=pairoptions(varargin{:});
-options=deleteduplicates(options,1);
-
-%initialize the structures required as input of Bamg
-bamg_options=struct();
-bamg_geometry=bamggeom;
-bamg_mesh=bamgmesh;
-
-% Bamg Geometry parameters {{{1
-if exist(options,'domain'),
-
-	%Check that file exists
-	domainfile=getfieldvalue(options,'domain');
-	if ~exist(domainfile,'file') error(['bamg error message: file ' domainfile ' not found ']); end
-
-	%Build geometry 
-	domain=expread(domainfile);
-	count=0;
-	for i=1:length(domain),
-
-		%Check that the domain is closed
-		if (domain(i).x(1)~=domain(i).x(end) | domain(i).y(1)~=domain(i).y(end)),
-			error('bamg error message: all contours provided in ''domain'' should be closed');
-		end
-
-		%Checks that all holes are INSIDE the principle domain outline
-		if i>1,
-			flags=ContourToNodes(domain(i).x,domain(i).y,domain(1),0);
-			if any(~flags),
-				error('bamg error message: All holes should be stricly inside the principal domain');
-			end
-		end
-
-		%Add all points to bamg_geometry
-		nods=domain(i).nods-1; %the domain are closed 1=end;
-		bamg_geometry.Vertices=[bamg_geometry.Vertices; [domain(i).x(1:nods) domain(i).y(1:nods) ones(nods,1)]];
-		bamg_geometry.Edges   =[bamg_geometry.Edges;    [transpose(count+1:count+nods) transpose([count+2:count+nods count+1])  1*ones(nods,1)]];
-		if i>1, bamg_geometry.SubDomains=[bamg_geometry.SubDomains; 2 count+1 1 1]; end
-
-		%update counter
-		count=count+nods;
-	end
-
-	%take care of rifts
-	if exist(options,'rifts'),
-
-		%Check that file exists
-		riftfile=getfieldvalue(options,'rifts');
-		if ~exist(riftfile,'file')
-			error(['bamg error message: file ' riftfile ' not found ']);
-		end
-		rift=expread(riftfile);
-
-		for i=1:length(rift),
-
-			%detect wether all points of the rift are inside the domain
-			flags=ContourToNodes(rift(i).x,rift(i).y,domain(1),0);
-			if ~flags,
-				error('one Rift has all his points outside of the domain outline'),
-
-			elseif any(~flags),
-				%We LOTS of work to do
-				disp('Rift tip outside of or on the domain has been detected and is being processed...');
-
-				%check that only one point is outsie (for now)
-				if sum(~flags)~=1,
-					error('bamg error message: only one point outside of the domain is supported yet');
-				end
-
-				%Move tip outside to the first position
-				if flags(1)==0,
-					%OK, first point is outside (do nothing),
-				elseif (flags(end)==0),
-					rift(i).x=flipud(rift(i).x);
-					rift(i).y=flipud(rift(i).y);
-				else
-					error('bamg error message: only a rift tip can be outside of the domain');
-				end
-
-				%Get cordinate of intersection point
-				x1=rift(i).x(1); y1=rift(i).y(1);
-				x2=rift(i).x(2); y2=rift(i).y(2);
-				for j=1:length(domain(1).x)-1;
-					if SegIntersect([x1 y1; x2 y2],[domain(1).x(j) domain(1).y(j); domain(1).x(j+1) domain(1).y(j+1)]),
-
-						%Get position of the two nodes of the edge in domain
-						i1=j;
-						i2=mod(j+1,domain(1).nods);
-
-						%rift is crossing edge [i1 i2] of the domain
-						%Get coordinate of intersection point (http://mathworld.wolfram.com/Line-LineIntersection.html)
-						x3=domain(1).x(i1); y3=domain(1).y(i1);
-						x4=domain(1).x(i2); y4=domain(1).y(i2);
-						x=det([det([x1 y1; x2 y2])  x1-x2;det([x3 y3; x4 y4])  x3-x4])/det([x1-x2 y1-y2;x3-x4 y3-y4]);
-						y=det([det([x1 y1; x2 y2])  y1-y2;det([x3 y3; x4 y4])  y3-y4])/det([x1-x2 y1-y2;x3-x4 y3-y4]);
-
-						segdis= sqrt((x4-x3)^2+(y4-y3)^2);
-						tipdis=[sqrt((x-x3)^2+(y-y3)^2)  sqrt((x-x4)^2+(y-y4)^2)];
-
-						if (min(tipdis)/segdis) < getfieldvalue(options,'toltip',0),
-							disp('moving tip-domain intersection point');
-
-							%Get position of the closest point
-							if tipdis(1)>tipdis(2),
-								pos=i2;
-							else
-								pos=i1;
-							end
-
-							%This point is only in Vertices (number pos).
-							%OK, no we can add our own rift
-							nods=rift(i).nods-1;
-							bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(2:end) rift(i).y(2:end) ones(nods,1)]];
-							bamg_geometry.Edges=[bamg_geometry.Edges;...
-								pos count+1  (1+i);...
-								[transpose(count+1:count+nods-1) transpose([count+2:count+nods])  (1+i)*ones(nods-1,1)]];
-							count=count+nods;
-
-							break;
-
-						else
-							%Add intersection point to Vertices
-							bamg_geometry.Vertices=[bamg_geometry.Vertices; x y 1];
-							count=count+1;
-
-							%Decompose the crossing edge in 2 subedges
-							pos=find(bamg_geometry.Edges(:,1)==i1 & bamg_geometry.Edges(:,2)==i2);
-							if isempty(pos) error('bamg error message: a problem occured...'); end
-							bamg_geometry.Edges=[bamg_geometry.Edges(1:pos-1,:);...
-								bamg_geometry.Edges(pos,1) count                           bamg_geometry.Edges(pos,3);...
-								count                      bamg_geometry.Edges(pos,2)   bamg_geometry.Edges(pos,3);...
-								bamg_geometry.Edges(pos+1:end,:)];
-
-							%OK, no we can add our own rift
-							nods=rift(i).nods-1;
-							bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(2:end) rift(i).y(2:end) ones(nods,1)]];
-							bamg_geometry.Edges=[bamg_geometry.Edges;...
-								count  count+1  2 ;...
-								[transpose(count+1:count+nods-1) transpose([count+2:count+nods])  (1+i)*ones(nods-1,1)]];
-							count=count+nods;
-
-							break;
-						end
-					end
-				end
-			else
-				nods=rift(i).nods-1;
-				bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(:) rift(i).y(:) ones(nods+1,1)]];
-				bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods) transpose([count+2:count+nods+1])  (1+i)*ones(nods,1)]];
-				count=count+nods+1;
-			end
-		end
-	end
-
-	%Deal with tracks
-	if exist(options,'tracks'),
-
-		%read tracks
-		track=getfieldvalue(options,'tracks');
-		if all(ischar(track)),
-			A=expread(track); 
-			track=[A.x A.y];
-		else
-			track=double(track); %for some reason, it is of class "single"
-		end
-		if(size(track,2)==2), track=[track 3*ones(size(track,1),1)]; end
-
-		%only keep those inside
-		flags=ContourToNodes(track(:,1),track(:,2),domainfile,0);
-		track=track(find(flags),:);
-
-		%Add all points to bamg_geometry
-		nods=size(track,1);
-		bamg_geometry.Vertices=[bamg_geometry.Vertices; track];
-		bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods-1) transpose([count+2:count+nods])  3*ones(nods-1,1)]];
-
-		%update counter
-		count=count+nods;
-	end
-
-	%Deal with vertices that need to be kept by mesher
-	if exist(options,'RequiredVertices'),
-
-		%recover RequiredVertices
-		requiredvertices=double(getfieldvalue(options,'RequiredVertices')); %for some reason, it is of class "single"
-		if(size(requiredvertices,2)==2), requiredvertices=[requiredvertices 4*ones(size(requiredvertices,1),1)]; end
-	
-		%only keep those inside
-		flags=ContourToNodes(requiredvertices(:,1),requiredvertices(:,2),domain(1),0);
-		requiredvertices=requiredvertices(find(flags),:);
-
-		%Add all points to bamg_geometry
-		nods=size(requiredvertices,1);
-		bamg_geometry.Vertices=[bamg_geometry.Vertices; requiredvertices];
-
-		%update counter
-		count=count+nods;
-
-	end
-
-	%process geom
-	%bamg_geometry=processgeometry(bamg_geometry,getfieldvalue(options,'tol',NaN),domain(1));
-
-elseif isstruct(md.private.bamg),
-
-	bamg_geometry=bamggeom(md.private.bamg.geometry); %TEST
-
-else
-
-	%do nothing...
-
-end
-%}}}
-
-% Bamg Mesh parameters {{{1
-if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & md.mesh.dimension==2),
-
-	if isstruct(md.private.bamg),
-		bamg_mesh=bamgmesh(md.private.bamg.mesh);
-	else
-		bamg_mesh.Vertices=[md.mesh.x md.mesh.y ones(md.mesh.numberofvertices,1)];
-		bamg_mesh.Triangles=[md.mesh.elements ones(md.mesh.numberofelements,1)];
-	end
-
-	if isstruct(md.rifts.riftstruct)
-		error('bamg error message: rifts not supported yet. Do meshprocessrift AFTER bamg');
-	end
-end
-%}}}
-
-% Bamg Options {{{1
-bamg_options.Crack=getfieldvalue(options,'Crack',0);
-bamg_options.anisomax=getfieldvalue(options,'anisomax',10^30);
-bamg_options.coeff=getfieldvalue(options,'coeff',1);
-bamg_options.cutoff=getfieldvalue(options,'cutoff',10^-5);
-bamg_options.err=getfieldvalue(options,'err',0.01);
-bamg_options.errg=getfieldvalue(options,'errg',0.1);
-bamg_options.field=getfieldvalue(options,'field',[]);
-bamg_options.gradation=getfieldvalue(options,'gradation',1.5);
-bamg_options.Hessiantype=getfieldvalue(options,'Hessiantype',0);
-bamg_options.hmin=getfieldvalue(options,'hmin',10^-100);
-bamg_options.hmax=getfieldvalue(options,'hmax',10^100);
-bamg_options.hminVertices=getfieldvalue(options,'hminVertices',[]);
-bamg_options.hmaxVertices=getfieldvalue(options,'hmaxVertices',[]);
-bamg_options.hVertices=getfieldvalue(options,'hVertices',[]);
-bamg_options.KeepVertices=getfieldvalue(options,'KeepVertices',1);
-bamg_options.MaxCornerAngle=getfieldvalue(options,'MaxCornerAngle',10);
-bamg_options.maxnbv=getfieldvalue(options,'maxnbv',10^6);
-bamg_options.maxsubdiv=getfieldvalue(options,'maxsubdiv',10);
-bamg_options.metric=getfieldvalue(options,'metric',[]);
-bamg_options.Metrictype=getfieldvalue(options,'Metrictype',0);
-bamg_options.nbjacobi=getfieldvalue(options,'nbjacobi',1);
-bamg_options.nbsmooth=getfieldvalue(options,'nbsmooth',3);
-bamg_options.omega=getfieldvalue(options,'omega',1.8);
-bamg_options.power=getfieldvalue(options,'power',1);
-bamg_options.splitcorners=getfieldvalue(options,'splitcorners',1);
-bamg_options.geometricalmetric=getfieldvalue(options,'geometricalmetric',0);
-bamg_options.verbose=getfieldvalue(options,'verbose',1);
-%}}}
-
-%call Bamg
-[bamgmesh_out bamggeom_out]=BamgMesher(bamg_mesh,bamg_geometry,bamg_options);
-
-% plug results onto model
-md.private.bamg=struct();
-md.private.bamg.mesh=bamgmesh(bamgmesh_out);
-md.private.bamg.geometry=bamggeom(bamggeom_out);
-md.mesh.x=bamgmesh_out.Vertices(:,1);
-md.mesh.y=bamgmesh_out.Vertices(:,2);
-md.mesh.elements=bamgmesh_out.Triangles(:,1:3);
-md.mesh.edges=bamgmesh_out.IssmEdges;
-md.mesh.segments=bamgmesh_out.IssmSegments(:,1:3);
-md.mesh.segmentmarkers=bamgmesh_out.IssmSegments(:,4);
-
-%Fill in rest of fields:
-md.mesh.dimension=2;
-md.mesh.numberofelements=size(md.mesh.elements,1);
-md.mesh.numberofvertices=length(md.mesh.x);
-md.mesh.numberofedges=size(md.mesh.edges,1);
-md.mesh.z=zeros(md.mesh.numberofvertices,1);
-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
-md.mask.vertexonwater=zeros(md.mesh.numberofvertices,1);
-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
-md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
-md.mesh.elementconnectivity=md.private.bamg.mesh.ElementConnectivity;
-md.mesh.elementconnectivity(find(isnan(md.mesh.elementconnectivity)))=0;
-
-%Check for orphan
-if any(~ismember(1:md.mesh.numberofvertices,sort(unique(md.mesh.elements(:)))))
-	error('Output mesh has orphans. Decrease MaxCornerAngle to prevent outside points (ex: 0.01)');
-end
Index: /issm/trunk/src/m/model/mesh/bamg.m
===================================================================
--- /issm/trunk/src/m/model/mesh/bamg.m	(revision 11027)
+++ /issm/trunk/src/m/model/mesh/bamg.m	(revision 11027)
@@ -0,0 +1,340 @@
+function md=bamg(md,varargin)
+%BAMG - mesh generation
+%
+%   Available options (for more details see ISSM website http://issm.jpl.nasa.gov/):
+%
+%   - domain: followed by an ARGUS file that prescribes the domain outline
+%   - hmin  : minimum edge length (default is 10^-100)
+%   - hmax  : maximum esge length (default is 10^100)
+%   - hVertices   : imposed edge length for each vertex (geometry or mesh)
+%   - hminVertices: minimum edge length for each vertex (mesh)
+%   - hmaxVertices: maximum edge length for each vertex (mesh)
+%
+%   - anisomax    : maximum ration between the smallest and largest edges (default is 10^30)
+%   - coeff       : coefficient applied to the metric (2-> twice as many elements, default is 1)
+%   - cutoff      : scalar used to compute the metric when metric type 2 or 3 are applied
+%   - err         : error used to generate the metric from a field
+%   - errg        : geometrical error (default is 0.1)
+%   - field       : field of the model that will be used to compute the metric
+%                   to apply several fields, use one column per field
+%   - gradation   : maximum ration between two adjacent edges
+%   - Hessiantype : 0 -> use double P2 projection (default)
+%                   1 -> use Green formula
+%   - KeepVertices: try to keep initial vertices when adaptation is done on an existing mesh (default 1)
+%   - MaxCornerAngle: maximal angle of corners in degree (default is 10)
+%   - maxnbv      : maximum number of vertices used to allocate memory (default is 10^6)
+%   - maxsubdiv   : maximum subdivision of exisiting elements (default is 10)
+%   - metric      : matrix (numberofnodes x 3) used as a metric
+%   - Metrictype  : 1 -> absolute error          c/(err coeff^2) * Abs(H)        (default)
+%                   2 -> relative error          c/(err coeff^2) * Abs(H)/max(s,cutoff*max(s))
+%                   3 -> rescaled absolute error c/(err coeff^2) * Abs(H)/(smax-smin)
+%   - nbjacoby    : correction used by Hessiantype=1 (default is 1)
+%   - nbsmooth    : number of metric smoothing procedure (default is 3)
+%   - omega       : relaxation parameter of the smoothing procedure (default is 1.8)
+%   - power       : power applied to the metric (default is 1)
+%   - splitcorners : split triangles whuch have 3 vertices on the outline (default is 1)
+%   - geometricalmetric : Take the geometry into account to generate the metric (default is 0)
+%   - verbose     : level of verbosity (default is 1)
+%
+%   - rifts : followed by an ARGUS file that prescribes the rifts
+%   - toltip: tolerance to move tip on an existing point of the domain outline
+%   - tracks: followed by an ARGUS file that prescribes the tracks that the mesh will stick to
+%   - RequiredVertices: mesh vertices that are required. [x,y,ref]; ref is optional
+%   - tol:    if the distance between 2 points of the domain outline is less than tol, they
+%             will be merged
+%
+%   Examples:
+%      md=bamg(md,'domain','DomainOutline.exp','hmax',3000);
+%      md=bamg(md,'field',[md.inversion.vel_obs md.geometry.thickness],'hmax',20000,'hmin',1000);
+%      md=bamg(md,'metric',A,'hmin',1000,'hmax',20000,'gradation',3,'anisomax',1);
+
+%process options
+options=pairoptions(varargin{:});
+options=deleteduplicates(options,1);
+
+%initialize the structures required as input of Bamg
+bamg_options=struct();
+bamg_geometry=bamggeom;
+bamg_mesh=bamgmesh;
+
+% Bamg Geometry parameters {{{1
+if exist(options,'domain'),
+
+	%Check that file exists
+	domainfile=getfieldvalue(options,'domain');
+	if ~exist(domainfile,'file') error(['bamg error message: file ' domainfile ' not found ']); end
+
+	%Build geometry 
+	domain=expread(domainfile);
+	count=0;
+	for i=1:length(domain),
+
+		%Check that the domain is closed
+		if (domain(i).x(1)~=domain(i).x(end) | domain(i).y(1)~=domain(i).y(end)),
+			error('bamg error message: all contours provided in ''domain'' should be closed');
+		end
+
+		%Checks that all holes are INSIDE the principle domain outline
+		if i>1,
+			flags=ContourToNodes(domain(i).x,domain(i).y,domain(1),0);
+			if any(~flags),
+				error('bamg error message: All holes should be stricly inside the principal domain');
+			end
+		end
+
+		%Add all points to bamg_geometry
+		nods=domain(i).nods-1; %the domain are closed 1=end;
+		bamg_geometry.Vertices=[bamg_geometry.Vertices; [domain(i).x(1:nods) domain(i).y(1:nods) ones(nods,1)]];
+		bamg_geometry.Edges   =[bamg_geometry.Edges;    [transpose(count+1:count+nods) transpose([count+2:count+nods count+1])  1*ones(nods,1)]];
+		if i>1, bamg_geometry.SubDomains=[bamg_geometry.SubDomains; 2 count+1 1 1]; end
+
+		%update counter
+		count=count+nods;
+	end
+
+	%take care of rifts
+	if exist(options,'rifts'),
+
+		%Check that file exists
+		riftfile=getfieldvalue(options,'rifts');
+		if ~exist(riftfile,'file')
+			error(['bamg error message: file ' riftfile ' not found ']);
+		end
+		rift=expread(riftfile);
+
+		for i=1:length(rift),
+
+			%detect wether all points of the rift are inside the domain
+			flags=ContourToNodes(rift(i).x,rift(i).y,domain(1),0);
+			if ~flags,
+				error('one Rift has all his points outside of the domain outline'),
+
+			elseif any(~flags),
+				%We LOTS of work to do
+				disp('Rift tip outside of or on the domain has been detected and is being processed...');
+
+				%check that only one point is outsie (for now)
+				if sum(~flags)~=1,
+					error('bamg error message: only one point outside of the domain is supported yet');
+				end
+
+				%Move tip outside to the first position
+				if flags(1)==0,
+					%OK, first point is outside (do nothing),
+				elseif (flags(end)==0),
+					rift(i).x=flipud(rift(i).x);
+					rift(i).y=flipud(rift(i).y);
+				else
+					error('bamg error message: only a rift tip can be outside of the domain');
+				end
+
+				%Get cordinate of intersection point
+				x1=rift(i).x(1); y1=rift(i).y(1);
+				x2=rift(i).x(2); y2=rift(i).y(2);
+				for j=1:length(domain(1).x)-1;
+					if SegIntersect([x1 y1; x2 y2],[domain(1).x(j) domain(1).y(j); domain(1).x(j+1) domain(1).y(j+1)]),
+
+						%Get position of the two nodes of the edge in domain
+						i1=j;
+						i2=mod(j+1,domain(1).nods);
+
+						%rift is crossing edge [i1 i2] of the domain
+						%Get coordinate of intersection point (http://mathworld.wolfram.com/Line-LineIntersection.html)
+						x3=domain(1).x(i1); y3=domain(1).y(i1);
+						x4=domain(1).x(i2); y4=domain(1).y(i2);
+						x=det([det([x1 y1; x2 y2])  x1-x2;det([x3 y3; x4 y4])  x3-x4])/det([x1-x2 y1-y2;x3-x4 y3-y4]);
+						y=det([det([x1 y1; x2 y2])  y1-y2;det([x3 y3; x4 y4])  y3-y4])/det([x1-x2 y1-y2;x3-x4 y3-y4]);
+
+						segdis= sqrt((x4-x3)^2+(y4-y3)^2);
+						tipdis=[sqrt((x-x3)^2+(y-y3)^2)  sqrt((x-x4)^2+(y-y4)^2)];
+
+						if (min(tipdis)/segdis) < getfieldvalue(options,'toltip',0),
+							disp('moving tip-domain intersection point');
+
+							%Get position of the closest point
+							if tipdis(1)>tipdis(2),
+								pos=i2;
+							else
+								pos=i1;
+							end
+
+							%This point is only in Vertices (number pos).
+							%OK, no we can add our own rift
+							nods=rift(i).nods-1;
+							bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(2:end) rift(i).y(2:end) ones(nods,1)]];
+							bamg_geometry.Edges=[bamg_geometry.Edges;...
+								pos count+1  (1+i);...
+								[transpose(count+1:count+nods-1) transpose([count+2:count+nods])  (1+i)*ones(nods-1,1)]];
+							count=count+nods;
+
+							break;
+
+						else
+							%Add intersection point to Vertices
+							bamg_geometry.Vertices=[bamg_geometry.Vertices; x y 1];
+							count=count+1;
+
+							%Decompose the crossing edge in 2 subedges
+							pos=find(bamg_geometry.Edges(:,1)==i1 & bamg_geometry.Edges(:,2)==i2);
+							if isempty(pos) error('bamg error message: a problem occured...'); end
+							bamg_geometry.Edges=[bamg_geometry.Edges(1:pos-1,:);...
+								bamg_geometry.Edges(pos,1) count                           bamg_geometry.Edges(pos,3);...
+								count                      bamg_geometry.Edges(pos,2)   bamg_geometry.Edges(pos,3);...
+								bamg_geometry.Edges(pos+1:end,:)];
+
+							%OK, no we can add our own rift
+							nods=rift(i).nods-1;
+							bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(2:end) rift(i).y(2:end) ones(nods,1)]];
+							bamg_geometry.Edges=[bamg_geometry.Edges;...
+								count  count+1  2 ;...
+								[transpose(count+1:count+nods-1) transpose([count+2:count+nods])  (1+i)*ones(nods-1,1)]];
+							count=count+nods;
+
+							break;
+						end
+					end
+				end
+			else
+				nods=rift(i).nods-1;
+				bamg_geometry.Vertices=[bamg_geometry.Vertices; [rift(i).x(:) rift(i).y(:) ones(nods+1,1)]];
+				bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods) transpose([count+2:count+nods+1])  (1+i)*ones(nods,1)]];
+				count=count+nods+1;
+			end
+		end
+	end
+
+	%Deal with tracks
+	if exist(options,'tracks'),
+
+		%read tracks
+		track=getfieldvalue(options,'tracks');
+		if all(ischar(track)),
+			A=expread(track); 
+			track=[A.x A.y];
+		else
+			track=double(track); %for some reason, it is of class "single"
+		end
+		if(size(track,2)==2), track=[track 3*ones(size(track,1),1)]; end
+
+		%only keep those inside
+		flags=ContourToNodes(track(:,1),track(:,2),domainfile,0);
+		track=track(find(flags),:);
+
+		%Add all points to bamg_geometry
+		nods=size(track,1);
+		bamg_geometry.Vertices=[bamg_geometry.Vertices; track];
+		bamg_geometry.Edges=[bamg_geometry.Edges; [transpose(count+1:count+nods-1) transpose([count+2:count+nods])  3*ones(nods-1,1)]];
+
+		%update counter
+		count=count+nods;
+	end
+
+	%Deal with vertices that need to be kept by mesher
+	if exist(options,'RequiredVertices'),
+
+		%recover RequiredVertices
+		requiredvertices=double(getfieldvalue(options,'RequiredVertices')); %for some reason, it is of class "single"
+		if(size(requiredvertices,2)==2), requiredvertices=[requiredvertices 4*ones(size(requiredvertices,1),1)]; end
+	
+		%only keep those inside
+		flags=ContourToNodes(requiredvertices(:,1),requiredvertices(:,2),domain(1),0);
+		requiredvertices=requiredvertices(find(flags),:);
+
+		%Add all points to bamg_geometry
+		nods=size(requiredvertices,1);
+		bamg_geometry.Vertices=[bamg_geometry.Vertices; requiredvertices];
+
+		%update counter
+		count=count+nods;
+
+	end
+
+	%process geom
+	%bamg_geometry=processgeometry(bamg_geometry,getfieldvalue(options,'tol',NaN),domain(1));
+
+elseif isstruct(md.private.bamg) & isfield(md.private.bamg,'geometry'),
+	bamg_geometry=bamggeom(md.private.bamg.geometry); 
+else
+	%do nothing...
+end
+%}}}
+% Bamg Mesh parameters {{{1
+if (~exist(options,'domain') & md.mesh.numberofvertices~=0 & md.mesh.dimension==2),
+
+	if isstruct(md.private.bamg) & isfield(md.private.bamg,'mesh'),
+		bamg_mesh=bamgmesh(md.private.bamg.mesh);
+	else
+		bamg_mesh.Vertices=[md.mesh.x md.mesh.y ones(md.mesh.numberofvertices,1)];
+		bamg_mesh.Triangles=[md.mesh.elements ones(md.mesh.numberofelements,1)];
+	end
+
+	if isstruct(md.rifts.riftstruct)
+		error('bamg error message: rifts not supported yet. Do meshprocessrift AFTER bamg');
+	end
+end
+%}}}
+% Bamg Options {{{1
+bamg_options.Crack=getfieldvalue(options,'Crack',0);
+bamg_options.anisomax=getfieldvalue(options,'anisomax',10^30);
+bamg_options.coeff=getfieldvalue(options,'coeff',1);
+bamg_options.cutoff=getfieldvalue(options,'cutoff',10^-5);
+bamg_options.err=getfieldvalue(options,'err',0.01);
+bamg_options.errg=getfieldvalue(options,'errg',0.1);
+bamg_options.field=getfieldvalue(options,'field',[]);
+bamg_options.gradation=getfieldvalue(options,'gradation',1.5);
+bamg_options.Hessiantype=getfieldvalue(options,'Hessiantype',0);
+bamg_options.hmin=getfieldvalue(options,'hmin',10^-100);
+bamg_options.hmax=getfieldvalue(options,'hmax',10^100);
+bamg_options.hminVertices=getfieldvalue(options,'hminVertices',[]);
+bamg_options.hmaxVertices=getfieldvalue(options,'hmaxVertices',[]);
+bamg_options.hVertices=getfieldvalue(options,'hVertices',[]);
+bamg_options.KeepVertices=getfieldvalue(options,'KeepVertices',1);
+bamg_options.MaxCornerAngle=getfieldvalue(options,'MaxCornerAngle',10);
+bamg_options.maxnbv=getfieldvalue(options,'maxnbv',10^6);
+bamg_options.maxsubdiv=getfieldvalue(options,'maxsubdiv',10);
+bamg_options.metric=getfieldvalue(options,'metric',[]);
+bamg_options.Metrictype=getfieldvalue(options,'Metrictype',0);
+bamg_options.nbjacobi=getfieldvalue(options,'nbjacobi',1);
+bamg_options.nbsmooth=getfieldvalue(options,'nbsmooth',3);
+bamg_options.omega=getfieldvalue(options,'omega',1.8);
+bamg_options.power=getfieldvalue(options,'power',1);
+bamg_options.splitcorners=getfieldvalue(options,'splitcorners',1);
+bamg_options.geometricalmetric=getfieldvalue(options,'geometricalmetric',0);
+bamg_options.verbose=getfieldvalue(options,'verbose',1);
+%}}}
+
+%call Bamg
+[bamgmesh_out bamggeom_out]=BamgMesher(bamg_mesh,bamg_geometry,bamg_options);
+
+% plug results onto model
+md.private.bamg=struct();
+md.private.bamg.mesh=bamgmesh(bamgmesh_out);
+md.private.bamg.geometry=bamggeom(bamggeom_out);
+md.mesh.x=bamgmesh_out.Vertices(:,1);
+md.mesh.y=bamgmesh_out.Vertices(:,2);
+md.mesh.elements=bamgmesh_out.Triangles(:,1:3);
+md.mesh.edges=bamgmesh_out.IssmEdges;
+md.mesh.segments=bamgmesh_out.IssmSegments(:,1:3);
+md.mesh.segmentmarkers=bamgmesh_out.IssmSegments(:,4);
+
+%Fill in rest of fields:
+md.mesh.dimension=2;
+md.mesh.numberofelements=size(md.mesh.elements,1);
+md.mesh.numberofvertices=length(md.mesh.x);
+md.mesh.numberofedges=size(md.mesh.edges,1);
+md.mesh.z=zeros(md.mesh.numberofvertices,1);
+md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+md.mask.vertexonwater=zeros(md.mesh.numberofvertices,1);
+md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+md.mesh.elementconnectivity=md.private.bamg.mesh.ElementConnectivity;
+md.mesh.elementconnectivity(find(isnan(md.mesh.elementconnectivity)))=0;
+
+%Check for orphan
+reshape(md.mesh.elements,3*md.mesh.numberofelements,1);
+(~ismember(1:md.mesh.numberofvertices,sort(unique(reshape(md.mesh.elements,3*md.mesh.numberofelements,1)))));
+if any(~ismember(1:md.mesh.numberofvertices,sort(unique(reshape(md.mesh.elements,3*md.mesh.numberofelements,1)))))
+	error('Output mesh has orphans. Decrease MaxCornerAngle to prevent outside points (ex: 0.01)');
+end
Index: sm/trunk/src/m/model/mesh/meshadaptation.m
===================================================================
--- /issm/trunk/src/m/model/mesh/meshadaptation.m	(revision 11026)
+++ 	(revision )
@@ -1,94 +1,0 @@
-function md2=meshadaptation(md,field,scale,epsilon,threshold)
-%MESHADAPTATION - remesh a model for a given field
-%
-%   remesh a model for a given field, use the hessian computation to spread the error on the element
-%   scale: 1.2 large scale leads to higher refining.
-%   epsilon: .5  large epsilon will refine fewer elements
-%   threshold: value under which no refinement is done.
-%
-%   Usage:
-%      md2=meshadaptation(md,field,scale,epsilon,threshold)
-%
-%   Example:
-%      md2=meshadaptation(md,md.initialization.vel,1.2,0.5,1);
-
-%some checks
-if ~(md.mesh.dimension==2)
-	error('meshadaptation error message: adaptation for 3d meshes not implemented yet')
-end
-if length(field)~=md.mesh.numberofvertices
-	error('meshadaptation error message: input field length shoud be numberofnodes')
-end
-
-disp(sprintf('      metric computation') )
-
-%initialization
-index=md.mesh.elements;
-numberofnodes=md.mesh.numberofvertices;
-numberofelements=md.mesh.numberofelements;
-gradx=zeros(numberofnodes,1);
-grady=zeros(numberofnodes,1);
-metric=zeros(numberofelements,1);
-
-%take the threshold, a characteristic length, and get the area equivalent threshold:
-threshold=threshold^2/2;
-
-%build some usefull variables
-field=field(:);
-line=index(:);
-summation=1/3*ones(3,1);
-linesize=3*numberofelements;
-
-%get areas and  nodal functions coefficients N(x,y)=alpha x + beta y + gamma 
-[alpha beta]=GetNodalFunctionsCoeff(index,md.mesh.x,md.mesh.y);
-areas=GetAreas(index,md.mesh.x,md.mesh.y);
-
-%Compute gradient for each element
-grad_elx=sum(field(index).*alpha,2); 
-grad_ely=sum(field(index).*beta,2);
-
-%update weights that holds the volume of all the element holding the node i
-weights=sparse(line,ones(linesize,1),repmat(areas,3,1),numberofnodes,1);
-
-%Compute gradient for each node (average of the elements around)
-gradx=sparse(line,ones(linesize,1),repmat(areas.*grad_elx,3,1),numberofnodes,1);
-grady=sparse(line,ones(linesize,1),repmat(areas.*grad_ely,3,1),numberofnodes,1);
-gradx=gradx./weights;
-grady=grady./weights;
-
-%Compute hessian for each element
-hessian=[sum(gradx(index).*alpha,2) sum(grady(index).*beta,2) sum(grady(index).*alpha,2)];
-
-%Compute the new metric
-hmin=min(sqrt(areas))/scale;
-hmax=max(sqrt(areas));
-
-%first, find the eigen values of eah line of H=[hessian(i,1) hessian(i,3); hessian(i,3)  hessian(i,2)]
-a=hessian(:,1); b=hessian(:,3); d=hessian(:,2);
-lambda1=0.5*((a+d)+sqrt(4*b.^2+(a-d).^2));
-lambda2=0.5*((a+d)-sqrt(4*b.^2+(a-d).^2));
-
-%Modify the eigen values to control the shape of the elements
-lambda1=min(max(abs(lambda1)/epsilon,1/hmax^2),1/hmin^2);
-lambda2=min(max(abs(lambda2)/epsilon,1/hmax^2),1/hmin^2);
-
-%find the corresponding eigen vectors of the initial eigen values
-%NOT USED FOR NOW
-%div1=sqrt(1+(b./(lambda1-d)).^2);
-%div2=sqrt(1+(b./(lambda2-d)).^2);
-%vector1=[1./div1 (b./(lambda1-d))./div1];
-%vector2=[1./div2 (b./(lambda2-d))./div2];
-
-%compute the metric
-%R=[vector1(:,1) vector2(:,1) vector1(:,2) vector2(:,2)];
-%det=vector1(:,1).*vector2(:,2)-vector1(:,2).*vector1(:,2);
-%Rinv=[vector2(:,2)./det   -vector2(:,1)./det   -vector1(:,2)./det   vector1(:,1)./det];
-metric=20*1./sqrt(lambda1.^2+lambda2.^2);
-
-%ok, metric can't go under 1km resolution.
-metric(find(metric<threshold))=threshold;
-
-%Remesh with this new metric
-disp(sprintf('      initial number of element: %i', md.mesh.numberofelements))
-md2=meshrefine(md,full(metric));
-disp(sprintf('      new number of elements:    %i', md2.mesh.numberofelements))
Index: sm/trunk/src/m/model/mesh/meshbamg.m
===================================================================
--- /issm/trunk/src/m/model/mesh/meshbamg.m	(revision 11026)
+++ 	(revision )
@@ -1,112 +1,0 @@
-function md=meshbamg(md,varargin);
-%MESHYAMS - Build model of Antarctica by refining according to observed velocity error estimator
-%
-%   Usage:
-%      md=meshyams(md,varargin);
-%      where varargin is a lit of paired arguments. 
-%      arguments can be: 'domainoutline': Argus file containing the outline of the domain to be meshed
-%      arguments can be: 'domainoutline': Argus file containing the outline of the domain to be meshed
-%      arguments can be: 'thickness': matlab file containing the thickness [m]
-%      optional arguments: 'groundeddomain': Argus file containing the outline of the grounded ice
-%                          this option is used to minimize the metric on water (no refinement)
-%      optional arguments: 'resolution': initial mesh resolution [m]
-%      optional arguments: 'nsteps': number of steps of mesh adaptation
-%      optional arguments: 'epsilon': average interpolation error wished [m/yr [m]]
-%      optional arguments: 'hmin': minimum edge length
-%      optional arguments: 'hmanx': maximum edge
-%      
-%
-%   Examples:
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat');
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp');
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp','nsteps',6,'epsilon',2,'hmin',500,'hmax',30000);
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','thickness','groundeddomain','ground.exp','nsteps',6,'epsilon',2,'hmin',500,'hmax',30000);
-
-%recover options
-options=pairoptions(varargin{:});
-options=deleteduplicates(options,1);
-
-%recover some fields
-disp('MeshBamg Options:')
-domainoutline=getfieldvalue(options,'domainoutline');
-disp(sprintf('   %-15s: ''%s''','DomainOutline',domainoutline));
-groundeddomain=getfieldvalue(options,'groundeddomain','N/A');
-disp(sprintf('   %-15s: ''%s''','GroundedDomain',groundeddomain));
-velocities=getfieldvalue(options,'velocities');
-disp(sprintf('   %-15s: ''%s''','Velocities',velocities));
-thickness=getfieldvalue(options,'thickness','none');
-disp(sprintf('   %-15s: ''%s''','Thickness',thickness));
-resolution=getfieldvalue(options,'resolution',5000);
-disp(sprintf('   %-15s: %f','Resolution',resolution));
-nsteps=getfieldvalue(options,'nsteps',6);
-disp(sprintf('   %-15s: %i','nsteps',nsteps));
-gradation=getfieldvalue(options,'gradation',2*ones(nsteps,1));
-disp(sprintf('   %-15s: %g','gradation',gradation(1)));
-epsilon=getfieldvalue(options,'epsilon',3);
-disp(sprintf('   %-15s: %f','epsilon',epsilon));
-hmin=getfieldvalue(options,'hmin',500);
-disp(sprintf('   %-15s: %f','hmin',hmin));
-hmax=getfieldvalue(options,'hmax',150*10^3);
-disp(sprintf('   %-15s: %f\n','hmax',hmax));
-
-%mesh with initial resolution
-disp('Initial mesh generation...');
-md=setmesh(md,domainoutline,resolution);
-disp(['Initial mesh, number of elements: ' num2str(md.mesh.numberofelements)]);
-
-%load velocities 
-disp('loading velocities...');
-NamesV=VelFindVarNames(velocities);
-Vel=load(velocities);
-
-%compute thickness?
-if ~strcmpi(thickness,'none'),
-	disp('loading thickness...');
-	NamesH=FieldFindVarNames(thickness);
-	Thi=load(thickness);
-	thicknesspresent=1;
-else
-	thicknesspresent=0;
-end
-
-%start mesh adaptation
-for i=1:nsteps,
-	disp(['Iteration #' num2str(i) '/' num2str(nsteps)]);
-
-	%interpolate velocities onto mesh
-	disp('   interpolating velocities...');
-	if strcmpi(NamesV.interp,'node'),
-		vx_obs=InterpFromGridToMesh(Vel.(NamesV.xname),Vel.(NamesV.yname),Vel.(NamesV.vxname),md.mesh.x,md.mesh.y,0);
-		vy_obs=InterpFromGridToMesh(Vel.(NamesV.xname),Vel.(NamesV.yname),Vel.(NamesV.vyname),md.mesh.x,md.mesh.y,0);
-	else
-		vx_obs=InterpFromMeshToMesh2d(Vel.(NamesV.indexname),Vel.(NamesV.xname),Vel.(NamesV.yname),Vel.(NamesV.vxname),md.mesh.x,md.mesh.y,0);
-		vy_obs=InterpFromMeshToMesh2d(Vel.(NamesV.indexname),Vel.(NamesV.xname),Vel.(NamesV.yname),Vel.(NamesV.vyname),md.mesh.x,md.mesh.y,0);
-	end
-	field=sqrt(vx_obs.^2+vy_obs.^2);
-	
-	if thicknesspresent,
-		disp('   interpolating thickness...');
-		if strcmpi(NamesH.interp,'node'),
-			h=InterpFromGridToMesh(Thi.(NamesH.xname),Thi.(NamesH.yname),Thi.(NamesH.dataname),md.mesh.x,md.mesh.y,0);
-		else
-			h=InterpFromMeshToMesh2d(Thi.(NamesH.indexname),Thi.(NamesH.xname),Thi.(NamesH.yname),Thi.(NamesH.dataname),md.mesh.x,md.mesh.y,0);
-		end
-		field=[field h];
-	end
-	
-	%set nodeonwater field
-	if ~strcmp(groundeddomain,'N/A'),
-		nodeground=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,groundeddomain,'node',2);
-		md.nodeonwater=ones(md.mesh.numberofvertices,1);
-		md.nodeonwater(find(nodeground))=0;
-	else
-		md.nodeonwater=zeros(md.mesh.numberofvertices,1);
-	end
-
-	%adapt according to velocities
-	disp('   adapting...');
-	md=bamg(md,'field',field,'hmin',hmin,'hmax',hmax,'gradation',gradation(i),'err',epsilon);
-
-end
-	
-disp(['Final mesh, number of elements: ' num2str(md.mesh.numberofelements)]);
Index: sm/trunk/src/m/model/mesh/meshexprefine.m
===================================================================
--- /issm/trunk/src/m/model/mesh/meshexprefine.m	(revision 11026)
+++ 	(revision )
@@ -1,55 +1,0 @@
-function md=meshexprefine(md,domainname,newresolution)
-%MESHEXPREFINE - refine mesh from a model
-%
-%   This routine refines a mesh for a given area using an Argus domain outline 
-%   and a new resolution for this domain.
-%   Appending ~ at the beginning of domainname will make this routine refine
-%   the elements which are not in the domain outline. 
-%   newresolution is the resolution to which the flagged elements must be refined.
-%
-%   Usage:
-%      md=meshexprefine(md,domainname,newresolution)
-%
-%   Example:
-%      md=meshexprefine(md,'RefineAreas.exp',1000)
-
-%some checks on list of arguments
-if ((nargin~=3) | (nargout~=1)),
-	meshexprefineusage();
-	error('meshexprefine error message');
-end
-
-if ~ischar(domainname) 
-	meshexprefineusage();
-	error('meshexprefine error message');
-end
-
-%Check the first letter of domainname, if it is ~, then we need to strip it away from 
-%domainname. The subsequent refinement will be done on the mask of the domain outline.
-if strcmpi(domainname(1),'~'),
-	mask=1;
-	domainname=domainname(2:length(domainname));
-else
-	mask=0;
-end
-
-%Read domainame file into a matlab array (x,y):
-refinearea=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,domainname,'element',1);
-aires=GetAreas(md.mesh.elements,md.mesh.x,md.mesh.y);
-
-%flags areas within the domain
-if mask==1,
-	pos=find(~refinearea);
-else
-	pos=find(refinearea);
-end
-aires(pos)=newresolution*newresolution/2; %triangle area
-
-pos=find(refinearea);
-aires(pos)=2*aires(pos); %be sure this does not get refined.
-
-%refine using the new area vector
-md=meshrefine(md,aires);
-
-%return model
-end
Index: /issm/trunk/src/m/model/mesh/meshnodensity.m
===================================================================
--- /issm/trunk/src/m/model/mesh/meshnodensity.m	(revision 11026)
+++ /issm/trunk/src/m/model/mesh/meshnodensity.m	(revision 11027)
@@ -9,10 +9,10 @@
 %
 %   Usage:
-%      md=setmesh(md,domainname)
-%   or md=setmesh(md,domainname,riftname);
+%      md=meshnodensity(md,domainname)
+%   or md=meshnodensity(md,domainname,riftname);
 %
 %   Examples:
-%      md=setmesh(md,'DomainOutline.exp');
-%      md=setmesh(md,'DomainOutline.exp','Rifts.exp');
+%      md=meshnodensity(md,'DomainOutline.exp');
+%      md=meshnodensity(md,'DomainOutline.exp','Rifts.exp');
 
 if (nargin==2),
Index: sm/trunk/src/m/model/mesh/meshyams.m
===================================================================
--- /issm/trunk/src/m/model/mesh/meshyams.m	(revision 11026)
+++ 	(revision )
@@ -1,172 +1,0 @@
-function md=meshyams(md,varargin);
-%MESHYAMS - Build model of Antarctica by refining according to observed velocity error estimator
-%
-%   Usage:
-%      md=meshyams(md,varargin);
-%      where varargin is a lit of paired arguments. 
-%      arguments can be: 'domainoutline': Argus file containing the outline of the domain to be meshed
-%      arguments can be: 'velocities': matlab file containing the velocities [m/yr]
-%      optional arguments: 'groundeddomain': Argus file containing the outline of the grounded ice
-%                          this option is used to minimize the metric on water (no refinement)
-%      optional arguments: 'resolution': initial mesh resolution [m]
-%      optional arguments: 'nsteps': number of steps of mesh adaptation
-%      optional arguments: 'epsilon': average interpolation error wished [m/yr]
-%      optional arguments: 'hmin': minimum edge length
-%      optional arguments: 'hmanx': maximum edge
-%      optional arguments: 'riftoutline': if rifts are present, specifies rift outline file.
-%      
-%
-%   Examples:
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat');
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp');
-%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp','nsteps',6,'epsilon',2,'hmin',500,'hmax',30000);
-
-%recover options
-options=pairoptions(varargin{:});
-options=deleteduplicates(options,1);
-
-%recover some fields
-disp('MeshYams Options:')
-domainoutline=getfieldvalue(options,'domainoutline');
-disp(sprintf('   %-15s: ''%s''','DomainOutline',domainoutline));
-riftoutline=getfieldvalue(options,'riftoutline','N/A');
-disp(sprintf('   %-15s: ''%s''','riftoutline',riftoutline));
-groundeddomain=getfieldvalue(options,'groundeddomain','N/A');
-disp(sprintf('   %-15s: ''%s''','GroundedDomain',groundeddomain));
-velocities=getfieldvalue(options,'velocities');
-disp(sprintf('   %-15s: ''%s''','Velocities',velocities));
-resolution=getfieldvalue(options,'resolution',5000);
-disp(sprintf('   %-15s: %f','Resolution',resolution));
-nsteps=getfieldvalue(options,'nsteps',6);
-disp(sprintf('   %-15s: %i','nsteps',nsteps));
-gradation=getfieldvalue(options,'gradation',2*ones(nsteps,1));
-disp(sprintf('   %-15s: %g','gradation',gradation(1)));
-epsilon=getfieldvalue(options,'epsilon',3);
-disp(sprintf('   %-15s: %f','epsilon',epsilon));
-hmin=getfieldvalue(options,'hmin',500);
-disp(sprintf('   %-15s: %f','hmin',hmin));
-hmax=getfieldvalue(options,'hmax',150*10^3);
-disp(sprintf('   %-15s: %f\n','hmax',hmax));
-
-%mesh with initial resolution
-disp('Initial mesh generation...');
-if strcmpi(riftoutline,'N/A');
-	md=setmesh(md,domainoutline,resolution);
-else
-	md=setmesh(md,domainoutline,riftoutline,resolution);
-	md=meshprocessrifts(md,domainoutline);
-end
-disp(['Initial mesh, number of elements: ' num2str(md.mesh.numberofelements)]);
-
-%load velocities 
-disp('loading velocities...');
-Names=VelFindVarNames(velocities);
-Vel=load(velocities);
-
-%start mesh adaptation
-for i=1:nsteps,
-	disp(['Iteration #' num2str(i) '/' num2str(nsteps)]);
-
-	%interpolate velocities onto mesh
-	disp('   interpolating velocities...');
-	if strcmpi(Names.interp,'node'),
-		vx_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
-		vy_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
-	else
-		vx_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
-		vy_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
-	end
-	field=sqrt(vx_obs.^2+vy_obs.^2);
-
-	%set mask.vertexonwater  field
-	if ~strcmp(groundeddomain,'N/A'),
-		nodeground=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,groundeddomain,'node',2);
-		md.mask.vertexonwater=ones(md.mesh.numberofvertices,1);
-		md.mask.vertexonwater(find(nodeground))=0;
-	else
-		md.mask.vertexonwater=zeros(md.mesh.numberofvertices,1);
-	end
-
-	%adapt according to velocities
-	disp('   adapting...');
-	md=YamsCall(md,field,hmin,hmax,gradation(i),epsilon);
-
-	%if we have rifts, we just messed them up, we need to recreate the segments that constitute those 
-	%rifts, because the segments are used in YamsCall to freeze the rifts elements during refinement.
-	if md.rifts.numrifts, 
-		md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
-		md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
-		md.mesh.segments=findsegments(md);
-		md=meshyamsrecreateriftsegments(md);
-	end
-
-end
-	
-disp(['Final mesh, number of elements: ' num2str(md.mesh.numberofelements)]);
-
-%Now, build the connectivity tables for this mesh.
-md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
-md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
-
-%recreate segments
-md.mesh.segments=findsegments(md);
-md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
-
-%Fill in rest of fields:
-md.mesh.z=zeros(md.mesh.numberofvertices,1);
-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
-if ~strcmp(groundeddomain,'N/A'),
-	nodeground=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,groundeddomain,'node',2);
-	md.mask.vertexonwater=ones(md.mesh.numberofvertices,1);
-	md.mask.vertexonwater(find(nodeground))=0;
-else
-	md.mask.vertexonwater=zeros(md.mesh.numberofvertices,1);
-end
-if strcmpi(Names.interp,'node'),
-	md.inversion.vx_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
-	md.inversion.vy_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
-else
-	md.inversion.vx_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
-	md.inversion.vy_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
-end
-md.inversion.vel_obs=sqrt(md.inversion.vx_obs.^2+md.inversion.vy_obs.^2);
-
-%deal with rifts 
-if md.rifts.numrifts,
-	%first, recreate rift segments
-	md=meshyamsrecreateriftsegments(md);
-
-	%using the segments, recreate the penaltypairs
-	for j=1:md.rifts.numrifts,
-		rift=md.rifts.riftstruct(j);
-
-		%build normals and lengths of segments:
-		lengths=sqrt((md.mesh.x(rift.segments(:,1))-md.mesh.x(rift.segments(:,2))).^2 + (md.mesh.y(rift.segments(:,1))-md.mesh.y(rift.segments(:,2))).^2 );
-		normalsx=cos(atan2((md.mesh.x(rift.segments(:,1))-md.mesh.x(rift.segments(:,2))) , (md.mesh.y(rift.segments(:,2))-md.mesh.y(rift.segments(:,1)))));
-		normalsy=sin(atan2((md.mesh.x(rift.segments(:,1))-md.mesh.x(rift.segments(:,2))) , (md.mesh.y(rift.segments(:,2))-md.mesh.y(rift.segments(:,1)))));
-
-		%ok, build penaltypairs: 
-		numpenaltypairs=length(rift.segments)/2-1;
-		rift.penaltypairs=zeros(numpenaltypairs,7);
-
-		for i=1:numpenaltypairs,
-			rift.penaltypairs(i,1)=rift.segments(i,2);
-			rift.penaltypairs(i,2)=rift.segments(end-i,2);
-			rift.penaltypairs(i,3)=rift.segments(i,3);
-			rift.penaltypairs(i,4)=rift.segments(end-i,3);
-			rift.penaltypairs(i,5)=normalsx(i)+normalsx(i+1);
-			rift.penaltypairs(i,6)=normalsy(i)+normalsy(i+1);
-			rift.penaltypairs(i,7)=(lengths(i)+lengths(i+1))/2;
-		end
-		%renormalize norms: 
-		norms=sqrt(rift.penaltypairs(:,5).^2+rift.penaltypairs(:,6).^2);
-		rift.penaltypairs(:,5)=rift.penaltypairs(:,5)./norms;
-		rift.penaltypairs(:,6)=rift.penaltypairs(:,6)./norms;
-
-		md.rifts.riftstruct(j)=rift;
-	end
-
-end
Index: sm/trunk/src/m/model/mesh/reorder.m
===================================================================
--- /issm/trunk/src/m/model/mesh/reorder.m	(revision 11026)
+++ 	(revision )
@@ -1,27 +1,0 @@
-function md=reorder(md)
-%REORDER - reorder nodes and elements of a model
-%
-%   Usage: 
-%      md=reorder(md)
-
-%some checks
-if md.mesh.dimension==3,
-	error('reorder error message: 3d models not supported yet, exiting...')
-end
-disp('reorder warning: only the mesh fields are reorder. The model needs to be reparameterized');
-
-%reorder elements
-newelements=randperm(md.mesh.numberofelements)';
-tnewelements=zeros(md.mesh.numberofelements,1);tnewelements(newelements)=[1:md.mesh.numberofelements]';
-
-%reorder nodes
-newnodes=randperm(md.mesh.numberofvertices)';
-tnewnodes=zeros(md.mesh.numberofvertices,1);tnewnodes(newnodes)=[1:md.mesh.numberofvertices]';
-
-%update all fields
-md.mesh.elements=tnewnodes(md.mesh.elements(newelements,:));
-md.mesh.segments=[tnewnodes(md.mesh.segments(:,1)) tnewnodes(md.mesh.segments(:,2)) tnewelements(md.mesh.segments(:,3))];
-md.mesh.x=md.mesh.x(newnodes);
-md.mesh.y=md.mesh.y(newnodes);
-md.mesh.z=md.mesh.z(newnodes);
-md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
Index: /issm/trunk/src/m/model/mesh/rifts/meshprocessrifts.m
===================================================================
--- /issm/trunk/src/m/model/mesh/rifts/meshprocessrifts.m	(revision 11026)
+++ /issm/trunk/src/m/model/mesh/rifts/meshprocessrifts.m	(revision 11027)
@@ -26,6 +26,4 @@
 %Call MEX file
 [md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers,md.rifts.riftstruct]=TriMeshProcessRifts(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers);
-md.rifts
-md.rifts.riftstruct
 if ~isstruct(md.rifts.riftstruct),
 	error('TriMeshProcessRifts did not find any rift');
@@ -33,10 +31,9 @@
 
 %Fill in rest of fields:
+numrifts=length(md.rifts.riftstruct);
 md.mesh.numberofelements=length(md.mesh.elements);
 md.mesh.numberofvertices=length(md.mesh.x);
 md.mesh.z=zeros(md.mesh.numberofvertices,1);
 md.mesh.vertexonboundary=zeros(length(md.mesh.x),1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
-md.rifts.numrifts=length(md.rifts.riftstruct);
-md.flowequation.element_equation=3*ones(md.mesh.numberofelements,1);
 md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
 md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
@@ -45,5 +42,5 @@
 
 %get coordinates of rift tips
-for i=1:md.rifts.numrifts,
+for i=1:numrifts,
 	md.rifts.riftstruct(i).tip1coordinates=[md.mesh.x(md.rifts.riftstruct(i).tips(1)) md.mesh.y(md.rifts.riftstruct(i).tips(1))];
 	md.rifts.riftstruct(i).tip2coordinates=[md.mesh.x(md.rifts.riftstruct(i).tips(2)) md.mesh.y(md.rifts.riftstruct(i).tips(2))];
@@ -53,5 +50,5 @@
 flags=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,domainoutline,'node',0);
 found=0;
-for i=1:md.rifts.numrifts,
+for i=1:numrifts,
 	if flags(md.rifts.riftstruct(i).tips(1))==0,
 		found=1;
Index: sm/trunk/src/m/model/mesh/setmesh.m
===================================================================
--- /issm/trunk/src/m/model/mesh/setmesh.m	(revision 11026)
+++ 	(revision )
@@ -1,85 +1,0 @@
-function md=setmesh(md,domainname,varargin)
-%MESH - create model mesh
-%
-%   This routine creates a model mesh using TriMesh and a domain outline, to within a certain resolution
-%   where md is a @model object, domainname is the name of an Argus domain outline file, 
-%   and resolution is a characteristic length for the mesh (same unit as the domain outline
-%   unit). Riftname is an optional argument (Argus domain outline) describing rifts.
-%
-%   Usage:
-%      md=setmesh(md,domainname,resolution)
-%   or md=setmesh(md,domainname,riftname, resolution)
-%
-%   Examples:
-%      md=setmesh(md,'DomainOutline.exp',1000);
-%      md=setmesh(md,'DomainOutline.exp','Rifts.exp',1500);
-
-%Figure out a characteristic area. Resolution is a node oriented concept (ex a 1000m  resolution node would 
-%be made of 1000*1000 area squares). 
-if (nargin==3),
-	resolution=varargin{1};
-	riftname='';
-end
-if (nargin==4),
-	riftname=varargin{1};
-	resolution=varargin{2};
-end
-
-%Check that mesh was not already run, and warn user: 
-if md.mesh.numberofelements~=0,
-	choice=input('This model already has a mesh. Are you sure you want to go ahead? (y/n)','s');
-	if ~strcmp(choice,'y')
-		disp('no meshing done ... exiting');
-		return
-	end
-end
-
-area=resolution^2;
-
-%Mesh using TriMesh
-if strcmp(riftname,''),
-	[md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]=TriMesh(domainname,area,'yes');
-else
-	[elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area,'yes');
-
-	%check that all the created nodes belong to at least one element
-	orphan=find(~ismember([1:length(x)],sort(unique(elements(:)))));
-	for i=1:length(orphan),
-		%get rid of the orphan node i
-		%update x and y
-		x=[x(1:orphan(i)-(i-1)-1); x(orphan(i)-(i-1)+1:end)];
-		y=[y(1:orphan(i)-(i-1)-1); y(orphan(i)-(i-1)+1:end)];
-		%update elements
-		pos=find(elements>orphan(i)-(i-1));
-		elements(pos)=elements(pos)-1;
-		%update segments
-		pos1=find(segments(:,1)>orphan(i)-(i-1));
-		pos2=find(segments(:,2)>orphan(i)-(i-1));
-		segments(pos1,1)=segments(pos1,1)-1;
-		segments(pos2,2)=segments(pos2,2)-1;
-	end
-
-	%plug into md
-	md.mesh.x=x;
-	md.mesh.y=y;
-	md.mesh.elements=elements;
-	md.mesh.segments=segments;
-	md.mesh.segmentmarkers=segmentmarkers;
-end
-
-%Fill in rest of fields:
-md.mesh.numberofelements=length(md.mesh.elements);
-md.mesh.numberofvertices=length(md.mesh.x);
-md.mesh.z=zeros(md.mesh.numberofvertices,1);
-md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
-md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
-md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
-md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
-md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
-
-%Now, build the connectivity tables for this mesh.
-md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
-md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
-
-%type of model
-md.mesh.dimension=2;
Index: /issm/trunk/src/m/model/mesh/triangle.m
===================================================================
--- /issm/trunk/src/m/model/mesh/triangle.m	(revision 11027)
+++ /issm/trunk/src/m/model/mesh/triangle.m	(revision 11027)
@@ -0,0 +1,85 @@
+function md=triangle(md,domainname,varargin)
+%TRIANGLE - create model mesh using the triangle package
+%
+%   This routine creates a model mesh using TriMesh and a domain outline, to within a certain resolution
+%   where md is a @model object, domainname is the name of an Argus domain outline file, 
+%   and resolution is a characteristic length for the mesh (same unit as the domain outline
+%   unit). Riftname is an optional argument (Argus domain outline) describing rifts.
+%
+%   Usage:
+%      md=triangle(md,domainname,resolution)
+%   or md=triangle(md,domainname,riftname, resolution)
+%
+%   Examples:
+%      md=triangle(md,'DomainOutline.exp',1000);
+%      md=triangle(md,'DomainOutline.exp','Rifts.exp',1500);
+
+%Figure out a characteristic area. Resolution is a node oriented concept (ex a 1000m  resolution node would 
+%be made of 1000*1000 area squares). 
+if (nargin==3),
+	resolution=varargin{1};
+	riftname='';
+end
+if (nargin==4),
+	riftname=varargin{1};
+	resolution=varargin{2};
+end
+
+%Check that mesh was not already run, and warn user: 
+if md.mesh.numberofelements~=0,
+	choice=input('This model already has a mesh. Are you sure you want to go ahead? (y/n)','s');
+	if ~strcmp(choice,'y')
+		disp('no meshing done ... exiting');
+		return
+	end
+end
+
+area=resolution^2;
+
+%Mesh using TriMesh
+if strcmp(riftname,''),
+	[md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]=TriMesh(domainname,area,'yes');
+else
+	[elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area,'yes');
+
+	%check that all the created nodes belong to at least one element
+	orphan=find(~ismember([1:length(x)],sort(unique(elements(:)))));
+	for i=1:length(orphan),
+		%get rid of the orphan node i
+		%update x and y
+		x=[x(1:orphan(i)-(i-1)-1); x(orphan(i)-(i-1)+1:end)];
+		y=[y(1:orphan(i)-(i-1)-1); y(orphan(i)-(i-1)+1:end)];
+		%update elements
+		pos=find(elements>orphan(i)-(i-1));
+		elements(pos)=elements(pos)-1;
+		%update segments
+		pos1=find(segments(:,1)>orphan(i)-(i-1));
+		pos2=find(segments(:,2)>orphan(i)-(i-1));
+		segments(pos1,1)=segments(pos1,1)-1;
+		segments(pos2,2)=segments(pos2,2)-1;
+	end
+
+	%plug into md
+	md.mesh.x=x;
+	md.mesh.y=y;
+	md.mesh.elements=elements;
+	md.mesh.segments=segments;
+	md.mesh.segmentmarkers=segmentmarkers;
+end
+
+%Fill in rest of fields:
+md.mesh.numberofelements=length(md.mesh.elements);
+md.mesh.numberofvertices=length(md.mesh.x);
+md.mesh.z=zeros(md.mesh.numberofvertices,1);
+md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+
+%Now, build the connectivity tables for this mesh.
+md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+
+%type of model
+md.mesh.dimension=2;
Index: /issm/trunk/src/m/model/mesh/yams.m
===================================================================
--- /issm/trunk/src/m/model/mesh/yams.m	(revision 11027)
+++ /issm/trunk/src/m/model/mesh/yams.m	(revision 11027)
@@ -0,0 +1,171 @@
+function md=yams(md,varargin);
+%MESHYAMS - Build model of Antarctica by refining according to observed velocity error estimator
+%
+%   Usage:
+%      md=yams(md,varargin);
+%      where varargin is a lit of paired arguments. 
+%      arguments can be: 'domainoutline': Argus file containing the outline of the domain to be meshed
+%      arguments can be: 'velocities': matlab file containing the velocities [m/yr]
+%      optional arguments: 'groundeddomain': Argus file containing the outline of the grounded ice
+%                          this option is used to minimize the metric on water (no refinement)
+%      optional arguments: 'resolution': initial mesh resolution [m]
+%      optional arguments: 'nsteps': number of steps of mesh adaptation
+%      optional arguments: 'epsilon': average interpolation error wished [m/yr]
+%      optional arguments: 'hmin': minimum edge length
+%      optional arguments: 'hmanx': maximum edge
+%      optional arguments: 'riftoutline': if rifts are present, specifies rift outline file.
+%      
+%
+%   Examples:
+%      md=yams(md,'domainoutline','Domain.exp','velocities','vel.mat');
+%      md=yams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp');
+%      md=yams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp','nsteps',6,'epsilon',2,'hmin',500,'hmax',30000);
+
+%recover options
+options=pairoptions(varargin{:});
+options=deleteduplicates(options,1);
+
+%recover some fields
+disp('MeshYams Options:')
+domainoutline=getfieldvalue(options,'domainoutline');
+disp(sprintf('   %-15s: ''%s''','DomainOutline',domainoutline));
+riftoutline=getfieldvalue(options,'riftoutline','N/A');
+disp(sprintf('   %-15s: ''%s''','riftoutline',riftoutline));
+groundeddomain=getfieldvalue(options,'groundeddomain','N/A');
+disp(sprintf('   %-15s: ''%s''','GroundedDomain',groundeddomain));
+velocities=getfieldvalue(options,'velocities');
+disp(sprintf('   %-15s: ''%s''','Velocities',velocities));
+resolution=getfieldvalue(options,'resolution',5000);
+disp(sprintf('   %-15s: %f','Resolution',resolution));
+nsteps=getfieldvalue(options,'nsteps',6);
+disp(sprintf('   %-15s: %i','nsteps',nsteps));
+gradation=getfieldvalue(options,'gradation',2*ones(nsteps,1));
+disp(sprintf('   %-15s: %g','gradation',gradation(1)));
+epsilon=getfieldvalue(options,'epsilon',3);
+disp(sprintf('   %-15s: %f','epsilon',epsilon));
+hmin=getfieldvalue(options,'hmin',500);
+disp(sprintf('   %-15s: %f','hmin',hmin));
+hmax=getfieldvalue(options,'hmax',150*10^3);
+disp(sprintf('   %-15s: %f\n','hmax',hmax));
+
+%mesh with initial resolution
+disp('Initial mesh generation...');
+if strcmpi(riftoutline,'N/A');
+	md=setmesh(md,domainoutline,resolution);
+else
+	md=setmesh(md,domainoutline,riftoutline,resolution);
+	md=meshprocessrifts(md,domainoutline);
+end
+disp(['Initial mesh, number of elements: ' num2str(md.mesh.numberofelements)]);
+
+%load velocities 
+disp('loading velocities...');
+Names=VelFindVarNames(velocities);
+Vel=load(velocities);
+
+%start mesh adaptation
+for i=1:nsteps,
+	disp(['Iteration #' num2str(i) '/' num2str(nsteps)]);
+
+	%interpolate velocities onto mesh
+	disp('   interpolating velocities...');
+	if strcmpi(Names.interp,'node'),
+		vx_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
+		vy_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
+	else
+		vx_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
+		vy_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
+	end
+	field=sqrt(vx_obs.^2+vy_obs.^2);
+
+	%set mask.vertexonwater  field
+	if ~strcmp(groundeddomain,'N/A'),
+		nodeground=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,groundeddomain,'node',2);
+		md.mask.vertexonwater=ones(md.mesh.numberofvertices,1);
+		md.mask.vertexonwater(find(nodeground))=0;
+	else
+		md.mask.vertexonwater=zeros(md.mesh.numberofvertices,1);
+	end
+
+	%adapt according to velocities
+	disp('   adapting...');
+	md=YamsCall(md,field,hmin,hmax,gradation(i),epsilon);
+
+	%if we have rifts, we just messed them up, we need to recreate the segments that constitute those 
+	%rifts, because the segments are used in YamsCall to freeze the rifts elements during refinement.
+	if md.rifts.numrifts, 
+		md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+		md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+		md.mesh.segments=findsegments(md);
+		md=yamsrecreateriftsegments(md);
+	end
+
+end
+	
+disp(['Final mesh, number of elements: ' num2str(md.mesh.numberofelements)]);
+
+%Now, build the connectivity tables for this mesh.
+md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
+md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
+
+%recreate segments
+md.mesh.segments=findsegments(md);
+md.mesh.vertexonboundary=zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2))=1;
+
+%Fill in rest of fields:
+md.mesh.z=zeros(md.mesh.numberofvertices,1);
+md.mesh.vertexonbed=ones(md.mesh.numberofvertices,1);
+md.mesh.vertexonsurface=ones(md.mesh.numberofvertices,1);
+md.mesh.elementonbed=ones(md.mesh.numberofelements,1);
+md.mesh.elementonsurface=ones(md.mesh.numberofelements,1);
+if ~strcmp(groundeddomain,'N/A'),
+	nodeground=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,groundeddomain,'node',2);
+	md.mask.vertexonwater=ones(md.mesh.numberofvertices,1);
+	md.mask.vertexonwater(find(nodeground))=0;
+else
+	md.mask.vertexonwater=zeros(md.mesh.numberofvertices,1);
+end
+if strcmpi(Names.interp,'node'),
+	md.inversion.vx_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
+	md.inversion.vy_obs=InterpFromGridToMesh(Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
+else
+	md.inversion.vx_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vxname),md.mesh.x,md.mesh.y,0);
+	md.inversion.vy_obs=InterpFromMeshToMesh2d(Vel.(Names.indexname),Vel.(Names.xname),Vel.(Names.yname),Vel.(Names.vyname),md.mesh.x,md.mesh.y,0);
+end
+md.inversion.vel_obs=sqrt(md.inversion.vx_obs.^2+md.inversion.vy_obs.^2);
+
+%deal with rifts 
+if md.rifts.numrifts,
+	%first, recreate rift segments
+	md=meshyamsrecreateriftsegments(md);
+
+	%using the segments, recreate the penaltypairs
+	for j=1:md.rifts.numrifts,
+		rift=md.rifts.riftstruct(j);
+
+		%build normals and lengths of segments:
+		lengths=sqrt((md.mesh.x(rift.segments(:,1))-md.mesh.x(rift.segments(:,2))).^2 + (md.mesh.y(rift.segments(:,1))-md.mesh.y(rift.segments(:,2))).^2 );
+		normalsx=cos(atan2((md.mesh.x(rift.segments(:,1))-md.mesh.x(rift.segments(:,2))) , (md.mesh.y(rift.segments(:,2))-md.mesh.y(rift.segments(:,1)))));
+		normalsy=sin(atan2((md.mesh.x(rift.segments(:,1))-md.mesh.x(rift.segments(:,2))) , (md.mesh.y(rift.segments(:,2))-md.mesh.y(rift.segments(:,1)))));
+
+		%ok, build penaltypairs: 
+		numpenaltypairs=length(rift.segments)/2-1;
+		rift.penaltypairs=zeros(numpenaltypairs,7);
+
+		for i=1:numpenaltypairs,
+			rift.penaltypairs(i,1)=rift.segments(i,2);
+			rift.penaltypairs(i,2)=rift.segments(end-i,2);
+			rift.penaltypairs(i,3)=rift.segments(i,3);
+			rift.penaltypairs(i,4)=rift.segments(end-i,3);
+			rift.penaltypairs(i,5)=normalsx(i)+normalsx(i+1);
+			rift.penaltypairs(i,6)=normalsy(i)+normalsy(i+1);
+			rift.penaltypairs(i,7)=(lengths(i)+lengths(i+1))/2;
+		end
+		%renormalize norms: 
+		norms=sqrt(rift.penaltypairs(:,5).^2+rift.penaltypairs(:,6).^2);
+		rift.penaltypairs(:,5)=rift.penaltypairs(:,5)./norms;
+		rift.penaltypairs(:,6)=rift.penaltypairs(:,6)./norms;
+
+		md.rifts.riftstruct(j)=rift;
+	end
+end
Index: /issm/trunk/src/m/model/petscversion.m
===================================================================
--- /issm/trunk/src/m/model/petscversion.m	(revision 11026)
+++ /issm/trunk/src/m/model/petscversion.m	(revision 11027)
@@ -13,5 +13,7 @@
 %go through the file, and recover the line we want
 fid=fopen(configfile,'r');
-while(1),
+if(fid==-1), error(['could not open file: ' configfile]); end
+
+while(true),
 	tline=fgets(fid);
 	if ~ischar(tline), break, end
Index: /issm/trunk/src/m/model/plot/plot_gridded.m
===================================================================
--- /issm/trunk/src/m/model/plot/plot_gridded.m	(revision 11026)
+++ /issm/trunk/src/m/model/plot/plot_gridded.m	(revision 11027)
@@ -66,5 +66,5 @@
 if exist(options,'edgecolor'),
 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
-	patch('Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',getfieldvalue(options,'edgecolor'));
+	patch('Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',data_grid(1)*ones(size(x)),'FaceColor','none','EdgeColor',getfieldvalue(options,'edgecolor'));
 end
 
Index: /issm/trunk/src/m/model/plot/plot_section.m
===================================================================
--- /issm/trunk/src/m/model/plot/plot_section.m	(revision 11026)
+++ /issm/trunk/src/m/model/plot/plot_section.m	(revision 11027)
@@ -25,5 +25,5 @@
 %Get number of curves and generate random colors
 numcurves=size(data,2);
-colorm=getfieldvalue(options,'colormap','line');
+colorm=getfieldvalue(options,'colormap','lines');
 color=eval([ colorm '(numcurves);']);
 options=removefield(options,'colormap',0); %back to default colormap
@@ -68,14 +68,16 @@
 		end
 
-		%plot section value
-		hold on;
-		subplot(nlines,ncols,index1)
-		%subplot(1,3,[2 3])
-		plot(s,data_s,'color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1))
-		%3D
-	else
-		%plot section value
-		%if user requested view2: 2d plot with curvilinear coordinate
-		if (getfieldvalue(options,'view',3)==2 )
+		%2D
+		if is2d,
+%		%plot section value
+%		hold on;
+%		subplot(nlines,ncols,index1)
+%		%subplot(1,3,[2 3])
+%		plot(s,data_s,'color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1))
+%		%3D
+%	else
+%		%plot section value
+%		%if user requested view2: 2d plot with curvilinear coordinate
+%		if (getfieldvalue(options,'view',3)==2 )
 
 			%Show Section if requested by user
Index: /issm/trunk/src/m/model/setflowequation.m
===================================================================
--- /issm/trunk/src/m/model/setflowequation.m	(revision 11026)
+++ /issm/trunk/src/m/model/setflowequation.m	(revision 11027)
@@ -67,37 +67,21 @@
 end
 
-%add in model who is who
-md.flowequation.element_equation=zeros(md.mesh.numberofelements,1);
-
-%1: Hutter elements
+%Initialize node fields
 nodeonhutter=zeros(md.mesh.numberofvertices,1);
 nodeonhutter(md.mesh.elements(find(hutterflag),:))=1;
-md.flowequation.element_equation(find(hutterflag))=1;
-
-%2: MacAyeal elements
 nodeonmacayeal=zeros(md.mesh.numberofvertices,1);
 nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
-md.flowequation.bordermacayeal=nodeonmacayeal;
-md.flowequation.element_equation(find(macayealflag))=2;
-
-%3: Pattyn elements
 nodeonpattyn=zeros(md.mesh.numberofvertices,1);
 nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1;
-md.flowequation.borderpattyn=nodeonpattyn;
-md.flowequation.element_equation(find(pattynflag))=3;
-
-%4: Stokes elements
+nodeonstokes=zeros(md.mesh.numberofvertices,1);
+noneflag=zeros(md.mesh.numberofelements,1);
+
 %First modify stokesflag to get rid of elements contrained everywhere (spc + border with pattyn or macayeal)
 if any(stokesflag),
-	nodeonstokes=zeros(md.mesh.numberofvertices,1);
-	nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
 	fullspcnodes=double((~isnan(md.diagnostic.spcvx)+~isnan(md.diagnostic.spcvy)+~isnan(md.diagnostic.spcvz))==3 | (nodeonpattyn & nodeonstokes));         %find all the nodes on the boundary of the domain without icefront
 	fullspcelems=double(sum(fullspcnodes(md.mesh.elements),2)==6);         %find all the nodes on the boundary of the domain without icefront
 	stokesflag(find(fullspcelems))=0;
-end
-nodeonstokes=zeros(md.mesh.numberofvertices,1);
-nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
-md.flowequation.borderstokes=nodeonstokes;
-md.flowequation.element_equation(find(stokesflag))=4;
+	nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
+end
 
 %Then complete with NoneApproximation or the other model used if there is no stokes
@@ -106,14 +90,9 @@
 		pattynflag(~stokesflag)=1;
 		nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1;
-		md.flowequation.borderpattyn=nodeonpattyn;
-		md.flowequation.element_equation(find(~stokesflag))=3;
 	elseif any(macayealflag), %fill with macayeal
 		macayealflag(~stokesflag)=1;
 		nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
-		md.flowequation.bordermacayeal=nodeonmacayeal;
-		md.flowequation.element_equation(find(~stokesflag))=2;
 	else %fill with none 
-	%5: None elements (non Stokes)
-		md.flowequation.element_equation(find(~stokesflag))=0;
+		noneflag(find(~stokesflag))=1;
 	end
 end
@@ -124,4 +103,7 @@
 nodeonpattynstokes=zeros(md.mesh.numberofvertices,1);
 nodeonmacayealstokes=zeros(md.mesh.numberofvertices,1);
+macayealpattynflag=zeros(md.mesh.numberofelements,1);
+macayealstokesflag=zeros(md.mesh.numberofelements,1);
+pattynstokesflag=zeros(md.mesh.numberofelements,1);
 if strcmpi(coupling_method,'penalties'),
 	%Create the border nodes between Pattyn and MacAyeal and extrude them
@@ -147,15 +129,28 @@
 		commonelements(find(pattynflag))=0; %only one layer: the elements previously in macayeal
 		macayealflag(find(commonelements))=0; %these elements are now macayealpattynelements
-		macayealpattynflag=zeros(md.mesh.numberofelements,1);
 		macayealpattynflag(find(commonelements))=1;
-		nodeonmacayeal=zeros(md.mesh.numberofvertices,1);
-		nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
-		md.flowequation.bordermacayeal=nodeonmacayeal;
-
-		%Create MacaAyealPattynApproximation where needed
-		md.flowequation.element_equation(find(macayealpattynflag))=5;
-
-		%Now recreate nodeonmacayeal and nodeonmacayealpattyn
+		nodeonmacayeal(:)=0;
+		nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
+
+		%rule out elements that don't touch the 2 boundaries
+		pos=find(macayealpattynflag);
+		list=zeros(length(pos),1);
+		list = list + any(sum(nodeonmacayeal(md.mesh.elements(pos,:)),2),2);
+		list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:))  ,2),2);
+		pos1=find(list==1);
+		macayealflag(pos(pos1))=1;
+		macayealpattynflag(pos(pos1))=0;
+		pos2=find(list==-1);
+		pattynflag(pos(pos2))=1;
+		macayealpattynflag(pos(pos2))=0;
+
+		%Recompute nodes associated to these elements
+		nodeonmacayeal(:)=0;
+		nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
+		nodeonpattyn(:)=0;
+		nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1;
+		nodeonmacayealpattyn(:)=0;
 		nodeonmacayealpattyn(md.mesh.elements(find(macayealpattynflag),:))=1;
+
 	elseif any(pattynflag) & any(stokesflag), %coupling pattyn stokes
 		%Find node at the border
@@ -166,16 +161,28 @@
 		commonelements(find(pattynflag))=0; %only one layer: the elements previously in macayeal
 		stokesflag(find(commonelements))=0; %these elements are now macayealpattynelements
-		pattynstokesflag=zeros(md.mesh.numberofelements,1);
 		pattynstokesflag(find(commonelements))=1;
 		nodeonstokes=zeros(md.mesh.numberofvertices,1);
 		nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
-		md.flowequation.borderstokes=nodeonstokes;
-
-		%Create MacaAyealPattynApproximation where needed
-		md.flowequation.element_equation(find(pattynstokesflag))=7;
-
-		%Now recreate nodeonpattynstokes
-		nodeonpattynstokes=zeros(md.mesh.numberofvertices,1);
+
+		%rule out elements that don't touch the 2 boundaries
+		pos=find(pattynstokesflag);
+		list=zeros(length(pos),1);
+		list = list + any(sum(nodeonstokes(md.mesh.elements(pos,:)),2),2);
+		list = list - any(sum(nodeonpattyn(md.mesh.elements(pos,:)),2),2);
+		pos1=find(list==1);
+		stokesflag(pos(pos1))=1;
+		pattynstokesflag(pos(pos1))=0;
+		pos2=find(list==-1);
+		pattynflag(pos(pos2))=1;
+		pattynstokesflag(pos(pos2))=0;
+
+		%Recompute nodes associated to these elements
+		nodeonstokes(:)=0;
+		nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
+		nodeonpattyn(:)=0;
+		nodeonpattyn(md.mesh.elements(find(pattynflag),:))=1;
+		nodeonpattynstokes(:)=0;
 		nodeonpattynstokes(md.mesh.elements(find(pattynstokesflag),:))=1;
+
 	elseif any(stokesflag) & any(macayealflag),
 		%Find node at the border
@@ -186,20 +193,48 @@
 		commonelements(find(macayealflag))=0; %only one layer: the elements previously in macayeal
 		stokesflag(find(commonelements))=0; %these elements are now macayealmacayealelements
-		macayealstokesflag=zeros(md.mesh.numberofelements,1);
 		macayealstokesflag(find(commonelements))=1;
 		nodeonstokes=zeros(md.mesh.numberofvertices,1);
 		nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
-		md.flowequation.borderstokes=nodeonstokes;
-
-		%Create MacaAyeal Approximation where needed
-		md.flowequation.element_equation(find(macayealstokesflag))=6;
-
-		%Now recreate nodeonmacayealstokes
-		nodeonmacayealstokes=zeros(md.mesh.numberofvertices,1);
+
+		%rule out elements that don't touch the 2 boundaries
+		pos=find(macayealstokesflag);
+		list=zeros(length(pos),1);
+		list = list + any(sum(nodeonmacayeal(md.mesh.elements(pos,:)),2),2);
+		list = list - any(sum(nodeonstokes(md.mesh.elements(pos,:))  ,2),2);
+		pos1=find(list==1);
+		macayealflag(pos(pos1))=1;
+		macayealstokesflag(pos(pos1))=0;
+		pos2=find(list==-1);
+		stokesflag(pos(pos2))=1;
+		macayealstokesflag(pos(pos2))=0;
+
+		%Recompute nodes associated to these elements
+		nodeonmacayeal(:)=0;
+		nodeonmacayeal(md.mesh.elements(find(macayealflag),:))=1;
+		nodeonstokes(:)=0;
+		nodeonstokes(md.mesh.elements(find(stokesflag),:))=1;
+		nodeonmacayealstokes(:)=0;
 		nodeonmacayealstokes(md.mesh.elements(find(macayealstokesflag),:))=1;
+
 	elseif any(stokesflag) & any(hutterflag),
 		error('type of coupling not supported yet');
 	end
 end
+
+%Create MacaAyealPattynApproximation where needed
+md.flowequation.element_equation=zeros(md.mesh.numberofelements,1);
+md.flowequation.element_equation(find(noneflag))=0;
+md.flowequation.element_equation(find(hutterflag))=1;
+md.flowequation.element_equation(find(macayealflag))=2;
+md.flowequation.element_equation(find(pattynflag))=3;
+md.flowequation.element_equation(find(stokesflag))=4;
+md.flowequation.element_equation(find(macayealpattynflag))=5;
+md.flowequation.element_equation(find(macayealstokesflag))=6;
+md.flowequation.element_equation(find(pattynstokesflag))=7;
+
+%border
+md.flowequation.borderpattyn=nodeonpattyn;
+md.flowequation.bordermacayeal=nodeonmacayeal;
+md.flowequation.borderstokes=nodeonstokes;
 
 %Create vertices_type
@@ -213,6 +248,4 @@
 pos=find(nodeonhutter);
 md.flowequation.vertex_equation(pos)=1;
-pos=find(nodeonpattyn & nodeonmacayeal);
-md.flowequation.vertex_equation(pos)=3;
 pos=find(nodeonmacayealpattyn);
 md.flowequation.vertex_equation(pos)=5;
@@ -235,3 +268,14 @@
 md.flowequation.isstokes=double(any(md.flowequation.element_equation==4));
 
-end
+return
+
+%Check that tiling can work:
+if any(md.flowequation.bordermacayeal) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.bordermacayeal ~=1),
+	error('error coupling domain too irregular');
+end
+if any(md.flowequation.bordermacayeal) & any(md.flowequation.borderstokes) & any(md.flowequation.borderstokes + md.flowequation.bordermacayeal ~=1),
+	error('error coupling domain too irregular');
+end
+if any(md.flowequation.borderstokes) & any(md.flowequation.borderpattyn) & any(md.flowequation.borderpattyn + md.flowequation.borderstokes~=1),
+	error('error coupling domain too irregular');
+end
Index: /issm/trunk/src/m/solutions/transient_core.m
===================================================================
--- /issm/trunk/src/m/solutions/transient_core.m	(revision 11026)
+++ /issm/trunk/src/m/solutions/transient_core.m	(revision 11027)
@@ -89,5 +89,5 @@
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,SurfaceEnum,step,time);
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BedEnum,step,time);
-			if (dim==3), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum,step,time);end
+			if (dim==3 & isthermal), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum,step,time);end
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BasalforcingsMeltingRateEnum,step,time);
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,SurfaceforcingsMassBalanceEnum,step,time);
Index: /issm/trunk/src/m/utils/Mesh/roundmesh.m
===================================================================
--- /issm/trunk/src/m/utils/Mesh/roundmesh.m	(revision 11026)
+++ /issm/trunk/src/m/utils/Mesh/roundmesh.m	(revision 11027)
@@ -23,5 +23,5 @@
 
 %Call Bamg
-md=setmesh(md,'RoundDomainOutline.exp',resolution);
+md=triangle(md,'RoundDomainOutline.exp',resolution);
 %md=bamg(md,'domain','RoundDomainOutline.exp','hmin',resolution);
 
Index: /issm/trunk/test/NightlyRun/IdToName.m
===================================================================
--- /issm/trunk/test/NightlyRun/IdToName.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/IdToName.m	(revision 11027)
@@ -110,4 +110,6 @@
 	case 265, name='SquareShelfTranP3dForcTempSerial';
 	case 266, name='SquareShelfTranP3dForcTempParallel';
+	case 267, name='SquareShelfTranForceNeg2dDakotaSamp';
+   case 268, name='SquareShelfTranForceNeg2dDakotaLocal';
 	case 301, name='SquareSheetConstrainedDiagM2dSerial';
 	case 302, name='SquareSheetConstrainedDiagM2dParallel';
Index: /issm/trunk/test/NightlyRun/dak.m
===================================================================
--- /issm/trunk/test/NightlyRun/dak.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/dak.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/runme.m
===================================================================
--- /issm/trunk/test/NightlyRun/runme.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/runme.m	(revision 11027)
@@ -151,5 +151,5 @@
 					%compare to archive
 					eval(['archive=' archive_name '_field' num2str(k) ';']);
-					error_diff=full(max(abs(archive-field))/(max(abs(archive))+eps));
+					error_diff=full(max(abs(archive(:)-field(:)))/(max(abs(archive))+eps));
 
 					%disp test result
Index: /issm/trunk/test/NightlyRun/test101.m
===================================================================
--- /issm/trunk/test/NightlyRun/test101.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test101.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test102.m
===================================================================
--- /issm/trunk/test/NightlyRun/test102.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test102.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test103.m
===================================================================
--- /issm/trunk/test/NightlyRun/test103.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test103.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test104.m
===================================================================
--- /issm/trunk/test/NightlyRun/test104.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test104.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test105.m
===================================================================
--- /issm/trunk/test/NightlyRun/test105.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test105.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test106.m
===================================================================
--- /issm/trunk/test/NightlyRun/test106.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test106.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test107.m
===================================================================
--- /issm/trunk/test/NightlyRun/test107.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test107.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test108.m
===================================================================
--- /issm/trunk/test/NightlyRun/test108.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test108.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test109.m
===================================================================
--- /issm/trunk/test/NightlyRun/test109.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test109.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test110.m
===================================================================
--- /issm/trunk/test/NightlyRun/test110.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test110.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test111.m
===================================================================
--- /issm/trunk/test/NightlyRun/test111.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test111.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=meshconvert(md);
 md=setmask(md,'all','');
Index: /issm/trunk/test/NightlyRun/test1110.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1110.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1110.m	(revision 11027)
@@ -9,5 +9,5 @@
 	md=model;
 	md=squaremesh(md,L,L,nx,ny);
-	%md=setmesh(md,'../Exp/SquareISMIP.exp',5500);
+	%md=triangle(md,'../Exp/SquareISMIP.exp',5500);
 	md=setmask(md,'',''); %ice sheet test
 	md=parameterize(md,'../Par/ISMIPF.par');
Index: /issm/trunk/test/NightlyRun/test112.m
===================================================================
--- /issm/trunk/test/NightlyRun/test112.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test112.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=meshconvert(md);
 md=setmask(md,'all','');
Index: /issm/trunk/test/NightlyRun/test113.m
===================================================================
--- /issm/trunk/test/NightlyRun/test113.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test113.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test114.m
===================================================================
--- /issm/trunk/test/NightlyRun/test114.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test114.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test115.m
===================================================================
--- /issm/trunk/test/NightlyRun/test115.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test115.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test116.m
===================================================================
--- /issm/trunk/test/NightlyRun/test116.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test116.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test117.m
===================================================================
--- /issm/trunk/test/NightlyRun/test117.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test117.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test118.m
===================================================================
--- /issm/trunk/test/NightlyRun/test118.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test118.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test119.m
===================================================================
--- /issm/trunk/test/NightlyRun/test119.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test119.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test120.m
===================================================================
--- /issm/trunk/test/NightlyRun/test120.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test120.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test1202.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1202.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1202.m	(revision 11027)
@@ -4,5 +4,5 @@
 %tests 3 and 4: using Glen's flow law
 md=model;
-md=setmesh(md,'../Exp/SquareEISMINT.exp',3550);
+md=triangle(md,'../Exp/SquareEISMINT.exp',3550);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareEISMINT.par');
Index: /issm/trunk/test/NightlyRun/test1203.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1203.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1203.m	(revision 11027)
@@ -4,5 +4,5 @@
 %test 5 and 6 : 
 md=model;
-md=setmesh(md,'../Exp/SquareEISMINT.exp',5100); %test3
+md=triangle(md,'../Exp/SquareEISMINT.exp',5100); %test3
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareEISMINT.par');
Index: /issm/trunk/test/NightlyRun/test1204.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1204.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1204.m	(revision 11027)
@@ -4,5 +4,5 @@
 %tests 3 and 4: using Glen's flow law
 md=model;
-md=setmesh(md,'../Exp/SquareEISMINT.exp',3550);
+md=triangle(md,'../Exp/SquareEISMINT.exp',3550);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareEISMINT.par');
Index: /issm/trunk/test/NightlyRun/test1208.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1208.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1208.m	(revision 11027)
@@ -4,5 +4,5 @@
 
 %To begin with the numerical model
-md=setmesh(model,'../Exp/SquareEISMINT750000.exp',resolution);
+md=triangle(model,'../Exp/SquareEISMINT750000.exp',resolution);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/RoundSheetEISMINT.par');
Index: /issm/trunk/test/NightlyRun/test121.m
===================================================================
--- /issm/trunk/test/NightlyRun/test121.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test121.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test122.m
===================================================================
--- /issm/trunk/test/NightlyRun/test122.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test122.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test123.m
===================================================================
--- /issm/trunk/test/NightlyRun/test123.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test123.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test124.m
===================================================================
--- /issm/trunk/test/NightlyRun/test124.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test124.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test125.m
===================================================================
--- /issm/trunk/test/NightlyRun/test125.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test125.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test126.m
===================================================================
--- /issm/trunk/test/NightlyRun/test126.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test126.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test127.m
===================================================================
--- /issm/trunk/test/NightlyRun/test127.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test127.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test128.m
===================================================================
--- /issm/trunk/test/NightlyRun/test128.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test128.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test129.m
===================================================================
--- /issm/trunk/test/NightlyRun/test129.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test129.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test130.m
===================================================================
--- /issm/trunk/test/NightlyRun/test130.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test130.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test1301.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1301.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1301.m	(revision 11027)
@@ -6,5 +6,5 @@
 
 md=model;
-md=setmesh(md,'../Exp/Square.exp',100000);
+md=triangle(md,'../Exp/Square.exp',100000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareThermal.par');
@@ -29,6 +29,5 @@
 
 %plot results
-comp_melting=zeros(md.mesh.numberofvertices,1);
-comp_melting(md.results.ThermalSolution.BasalforcingsMeltingRate.index)=md.results.ThermalSolution.BasalforcingsMeltingRate.value;
+comp_melting=md.results.ThermalSolution.BasalforcingsMeltingRate;
 relative=abs((comp_melting-melting)./melting)*100;
 relative(find(comp_melting==melting))=0;
Index: /issm/trunk/test/NightlyRun/test1302.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1302.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1302.m	(revision 11027)
@@ -5,5 +5,5 @@
 
 md=model;
-md=setmesh(md,'../Exp/Square.exp',100000);
+md=triangle(md,'../Exp/Square.exp',100000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareThermal.par');
@@ -30,6 +30,5 @@
 
 %plot results
-comp_temp=zeros(md.mesh.numberofvertices,1);
-comp_temp(md.results.ThermalSolution.Temperature.index)=md.results.ThermalSolution.Temperature.value;
+comp_temp=md.results.ThermalSolution.Temperature;
 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100;
 relative(find(comp_temp==md.initialization.temperature))=0;
Index: /issm/trunk/test/NightlyRun/test1303.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1303.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1303.m	(revision 11027)
@@ -6,5 +6,5 @@
 
 md=model;
-md=setmesh(md,'../Exp/Square.exp',100000);
+md=triangle(md,'../Exp/Square.exp',100000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareThermal.par');
@@ -25,6 +25,5 @@
 
 %plot results
-comp_temp=zeros(md.mesh.numberofvertices,1);
-comp_temp(md.results.ThermalSolution.Temperature.index)=md.results.ThermalSolution.Temperature.value;
+comp_temp=md.results.ThermalSolution.Temperature;
 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100;
 relative(find(comp_temp==md.initialization.temperature))=0;
Index: /issm/trunk/test/NightlyRun/test1304.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1304.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1304.m	(revision 11027)
@@ -6,5 +6,5 @@
 
 md=model;
-md=setmesh(md,'../Exp/Square.exp',100000);
+md=triangle(md,'../Exp/Square.exp',100000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareThermal.par');
@@ -26,6 +26,5 @@
 
 %plot results
-comp_temp=zeros(md.mesh.numberofvertices,1);
-comp_temp(md.results.ThermalSolution.Temperature.index)=md.results.ThermalSolution.Temperature.value;
+comp_temp=md.results.ThermalSolution.Temperature;
 relative=abs((comp_temp-md.initialization.temperature)./md.initialization.temperature)*100;
 relative(find(comp_temp==md.initialization.temperature))=0;
Index: /issm/trunk/test/NightlyRun/test131.m
===================================================================
--- /issm/trunk/test/NightlyRun/test131.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test131.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test132.m
===================================================================
--- /issm/trunk/test/NightlyRun/test132.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test132.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test133.m
===================================================================
--- /issm/trunk/test/NightlyRun/test133.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test133.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test134.m
===================================================================
--- /issm/trunk/test/NightlyRun/test134.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test134.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
Index: /issm/trunk/test/NightlyRun/test135.m
===================================================================
--- /issm/trunk/test/NightlyRun/test135.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test135.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=meshconvert(md);
 md=setmask(md,'all','');
Index: /issm/trunk/test/NightlyRun/test136.m
===================================================================
--- /issm/trunk/test/NightlyRun/test136.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test136.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=meshconvert(md);
 md=setmask(md,'all','');
Index: /issm/trunk/test/NightlyRun/test1501.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1501.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1501.m	(revision 11027)
@@ -1,5 +1,5 @@
 printingflag = false;
 
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test1502.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1502.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1502.m	(revision 11027)
@@ -1,10 +1,10 @@
 printingflag = false;
 
-md=setmesh(model,'../Exp/Square.exp',700000);
+md=triangle(model,'../Exp/Square.exp',700000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
 md=setflowequation(md,'macayeal','all');
 md=extrude(md,3,1);
-md.cluster=generic('name',oshostname(),'np',3);
+md.cluster=generic('name',oshostname(),'np',1);
 md.transient.isthermal=0;
 
Index: /issm/trunk/test/NightlyRun/test1601.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1601.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1601.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
@@ -8,5 +8,4 @@
 md.initialization.vel(:)=0;
 
-md.settings.results_on_vertices=1;
 md.cluster=generic('name',oshostname,'np',2);
 md=solve(md,DiagnosticSolutionEnum);
Index: /issm/trunk/test/NightlyRun/test1602.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1602.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1602.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
@@ -9,5 +9,4 @@
 md.initialization.vel(:)=0;
 
-md.settings.results_on_vertices=1;
 md.cluster=generic('name',oshostname,'np',3);
 md=solve(md,DiagnosticSolutionEnum);
Index: /issm/trunk/test/NightlyRun/test1603.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1603.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test1603.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
@@ -9,5 +9,4 @@
 md.initialization.vel(:)=0;
 
-md.settings.results_on_vertices=1;
 md.cluster=generic('name',oshostname,'np',3);
 md=solve(md,DiagnosticSolutionEnum);
Index: /issm/trunk/test/NightlyRun/test201.m
===================================================================
--- /issm/trunk/test/NightlyRun/test201.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test201.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test202.m
===================================================================
--- /issm/trunk/test/NightlyRun/test202.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test202.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test203.m
===================================================================
--- /issm/trunk/test/NightlyRun/test203.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test203.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test204.m
===================================================================
--- /issm/trunk/test/NightlyRun/test204.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test204.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test205.m
===================================================================
--- /issm/trunk/test/NightlyRun/test205.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test205.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test206.m
===================================================================
--- /issm/trunk/test/NightlyRun/test206.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test206.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test207.m
===================================================================
--- /issm/trunk/test/NightlyRun/test207.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test207.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test208.m
===================================================================
--- /issm/trunk/test/NightlyRun/test208.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test208.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test209.m
===================================================================
--- /issm/trunk/test/NightlyRun/test209.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test209.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test210.m
===================================================================
--- /issm/trunk/test/NightlyRun/test210.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test210.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test211.m
===================================================================
--- /issm/trunk/test/NightlyRun/test211.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test211.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test212.m
===================================================================
--- /issm/trunk/test/NightlyRun/test212.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test212.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test213.m
===================================================================
--- /issm/trunk/test/NightlyRun/test213.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test213.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test214.m
===================================================================
--- /issm/trunk/test/NightlyRun/test214.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test214.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test215.m
===================================================================
--- /issm/trunk/test/NightlyRun/test215.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test215.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test216.m
===================================================================
--- /issm/trunk/test/NightlyRun/test216.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test216.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test217.m
===================================================================
--- /issm/trunk/test/NightlyRun/test217.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test217.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test218.m
===================================================================
--- /issm/trunk/test/NightlyRun/test218.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test218.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test219.m
===================================================================
--- /issm/trunk/test/NightlyRun/test219.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test219.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test220.m
===================================================================
--- /issm/trunk/test/NightlyRun/test220.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test220.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test221.m
===================================================================
--- /issm/trunk/test/NightlyRun/test221.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test221.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test222.m
===================================================================
--- /issm/trunk/test/NightlyRun/test222.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test222.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test223.m
===================================================================
--- /issm/trunk/test/NightlyRun/test223.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test223.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test224.m
===================================================================
--- /issm/trunk/test/NightlyRun/test224.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test224.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test225.m
===================================================================
--- /issm/trunk/test/NightlyRun/test225.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test225.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test226.m
===================================================================
--- /issm/trunk/test/NightlyRun/test226.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test226.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test227.m
===================================================================
--- /issm/trunk/test/NightlyRun/test227.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test227.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test228.m
===================================================================
--- /issm/trunk/test/NightlyRun/test228.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test228.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test229.m
===================================================================
--- /issm/trunk/test/NightlyRun/test229.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test229.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test230.m
===================================================================
--- /issm/trunk/test/NightlyRun/test230.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test230.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test232.m
===================================================================
--- /issm/trunk/test/NightlyRun/test232.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test232.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/SquareHole.exp','../Exp/Rifts.exp',50000);
+md=triangle(model,'../Exp/SquareHole.exp','../Exp/Rifts.exp',50000);
 md=meshprocessrifts(md,'../Exp/Square.exp');
 md=setmask(md,'all','');
Index: /issm/trunk/test/NightlyRun/test233.m
===================================================================
--- /issm/trunk/test/NightlyRun/test233.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test233.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test234.m
===================================================================
--- /issm/trunk/test/NightlyRun/test234.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test234.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test237.m
===================================================================
--- /issm/trunk/test/NightlyRun/test237.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test237.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test238.m
===================================================================
--- /issm/trunk/test/NightlyRun/test238.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test238.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test239.m
===================================================================
--- /issm/trunk/test/NightlyRun/test239.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test239.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',120000);
+md=triangle(model,'../Exp/Square.exp',120000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test240.m
===================================================================
--- /issm/trunk/test/NightlyRun/test240.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test240.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',120000);
+md=triangle(model,'../Exp/Square.exp',120000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test241.m
===================================================================
--- /issm/trunk/test/NightlyRun/test241.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test241.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',120000);
+md=triangle(model,'../Exp/Square.exp',120000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test242.m
===================================================================
--- /issm/trunk/test/NightlyRun/test242.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test242.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',120000);
+md=triangle(model,'../Exp/Square.exp',120000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test243.m
===================================================================
--- /issm/trunk/test/NightlyRun/test243.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test243.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test244.m
===================================================================
--- /issm/trunk/test/NightlyRun/test244.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test244.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test245.m
===================================================================
--- /issm/trunk/test/NightlyRun/test245.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test245.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test246.m
===================================================================
--- /issm/trunk/test/NightlyRun/test246.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test246.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test247.m
===================================================================
--- /issm/trunk/test/NightlyRun/test247.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test247.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test248.m
===================================================================
--- /issm/trunk/test/NightlyRun/test248.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test248.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test249.m
===================================================================
--- /issm/trunk/test/NightlyRun/test249.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test249.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test250.m
===================================================================
--- /issm/trunk/test/NightlyRun/test250.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test250.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test251.m
===================================================================
--- /issm/trunk/test/NightlyRun/test251.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test251.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test252.m
===================================================================
--- /issm/trunk/test/NightlyRun/test252.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test252.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test253.m
===================================================================
--- /issm/trunk/test/NightlyRun/test253.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test253.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test254.m
===================================================================
--- /issm/trunk/test/NightlyRun/test254.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test254.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test255.m
===================================================================
--- /issm/trunk/test/NightlyRun/test255.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test255.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test256.m
===================================================================
--- /issm/trunk/test/NightlyRun/test256.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test256.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test257.m
===================================================================
--- /issm/trunk/test/NightlyRun/test257.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test257.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test258.m
===================================================================
--- /issm/trunk/test/NightlyRun/test258.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test258.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test259.m
===================================================================
--- /issm/trunk/test/NightlyRun/test259.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test259.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test260.m
===================================================================
--- /issm/trunk/test/NightlyRun/test260.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test260.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test261.m
===================================================================
--- /issm/trunk/test/NightlyRun/test261.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test261.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test262.m
===================================================================
--- /issm/trunk/test/NightlyRun/test262.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test262.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test263.m
===================================================================
--- /issm/trunk/test/NightlyRun/test263.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test263.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test264.m
===================================================================
--- /issm/trunk/test/NightlyRun/test264.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test264.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test265.m
===================================================================
--- /issm/trunk/test/NightlyRun/test265.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test265.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test266.m
===================================================================
--- /issm/trunk/test/NightlyRun/test266.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test266.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelf.par');
Index: /issm/trunk/test/NightlyRun/test267.m
===================================================================
--- /issm/trunk/test/NightlyRun/test267.m	(revision 11027)
+++ /issm/trunk/test/NightlyRun/test267.m	(revision 11027)
@@ -0,0 +1,72 @@
+md=triangle(model,'../Exp/Square.exp',180000);
+md=setmask(md,'all','');
+md=parameterize(md,'../Par/SquareShelf.par');
+md=setflowequation(md,'macayeal','all');
+md.cluster=generic('name',oshostname(),'np',3);
+
+md.timestepping.time_step=1;
+md.settings.output_frequency=1;
+md.timestepping.final_time=4;
+
+smb = ones(md.mesh.numberofvertices,1)*3.6;
+smb=[ smb smb*-1 ];
+
+md.surfaceforcings.mass_balance= smb;
+md.surfaceforcings.mass_balance(end+1,:)=[1.5 3];
+md.transient.isthermal=0;
+%Dakota options
+
+%partitioning
+md.qmu.numberofpartitions=20;
+md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');
+md.qmu.partition=md.qmu.partition-1;
+
+%variables
+md.qmu.variables.surface_mass_balance=normal_uncertain('scaled_SurfaceforcingsMassBalance',1,0.1);
+
+%responses
+md.qmu.responses.MaxVel=response_function('MaxVel',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.IceVolume=response_function('IceVolume',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux1=response_function('indexed_MassFlux_1',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux2=response_function('indexed_MassFlux_2',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux3=response_function('indexed_MassFlux_3',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux4=response_function('indexed_MassFlux_4',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux5=response_function('indexed_MassFlux_5',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.massFlux6=response_function('indexed_MassFlux_6',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+
+%mass flux profiles
+md.qmu.mass_flux_profiles={'../Exp/MassFlux1.exp','../Exp/MassFlux2.exp','../Exp/MassFlux3.exp','../Exp/MassFlux4.exp','../Exp/MassFlux5.exp','../Exp/MassFlux6.exp'};
+md.qmu.mass_flux_profile_directory=pwd;
+
+%%  nond_sampling study
+md.qmu.method=dakota_method('nond_samp');
+md.qmu.method(end)=dmeth_params_set(md.qmu.method(end),'seed',1234,'samples',20,'sample_type','lhs');
+
+%parameters
+md.qmu.params.direct=true;
+md.qmu.params.analysis_driver='';
+md.qmu.params.analysis_components='';
+md.qmu.params.evaluation_concurrency=1;
+md.qmu.params.interval_type='forward';
+md.qmu.isdakota=1;
+
+md.diagnostic.reltol=10^-5; %tighten for qmu analyses
+md.transient.requested_outputs=IceVolumeEnum();
+
+%solve
+md=solve(md,TransientSolutionEnum,'overwrite','y');
+md=tres(md,'dakota');
+
+%Fields and tolerances to track changes
+md.results.dakota.importancefactors=[];
+for i=1:8,
+	md.results.dakota.importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).mean];
+end
+for i=1:8,
+	md.results.dakota.importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).stddev];
+end
+field_names     ={'importancefactors'};
+field_tolerances={1e-11};
+field_values={...
+         md.results.dakota.importancefactors,...
+	};
Index: /issm/trunk/test/NightlyRun/test268.m
===================================================================
--- /issm/trunk/test/NightlyRun/test268.m	(revision 11027)
+++ /issm/trunk/test/NightlyRun/test268.m	(revision 11027)
@@ -0,0 +1,72 @@
+md=triangle(model,'../Exp/Square.exp',180000);
+md=setmask(md,'all','');
+md=parameterize(md,'../Par/SquareShelf.par');
+md=setflowequation(md,'macayeal','all');
+md.cluster=generic('name',oshostname(),'np',3);
+
+md.timestepping.time_step=1;
+md.settings.output_frequency=1;
+md.timestepping.final_time=4;
+
+smb = ones(md.mesh.numberofvertices,1)*3.6;
+smb=[ smb smb*-1 ];
+
+md.surfaceforcings.mass_balance= smb;
+md.surfaceforcings.mass_balance(end+1,:)=[1.5 3];
+md.transient.isthermal=0;
+%Dakota options
+
+%partitioning
+md.qmu.numberofpartitions=20;
+md=partitioner(md,'package','chaco','npart',md.qmu.numberofpartitions,'weighting','on');
+md.qmu.partition=md.qmu.partition-1;
+
+%variables
+md.qmu.variables.surface_mass_balance=normal_uncertain('scaled_SurfaceforcingsMassBalance',1,100);
+
+%responses
+md.qmu.responses.MaxVel=response_function('MaxVel',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.IceVolume=response_function('IceVolume',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux1=response_function('indexed_MassFlux_1',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux2=response_function('indexed_MassFlux_2',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux3=response_function('indexed_MassFlux_3',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux4=response_function('indexed_MassFlux_4',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.MassFlux5=response_function('indexed_MassFlux_5',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+md.qmu.responses.massFlux6=response_function('indexed_MassFlux_6',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
+
+%mass flux profiles
+md.qmu.mass_flux_profiles={'../Exp/MassFlux1.exp','../Exp/MassFlux2.exp','../Exp/MassFlux3.exp','../Exp/MassFlux4.exp','../Exp/MassFlux5.exp','../Exp/MassFlux6.exp'};
+md.qmu.mass_flux_profile_directory=pwd;
+
+%method
+md.qmu.method     =dakota_method('nond_l');
+
+%parameters
+md.qmu.params.direct=true;
+md.qmu.params.analysis_driver='';
+md.qmu.params.analysis_components='';
+md.qmu.params.evaluation_concurrency=1;
+md.qmu.params.interval_type='forward';
+md.qmu.params.fd_gradient_step_size='0.1';
+md.qmu.isdakota=1;
+
+md.diagnostic.reltol=10^-5; %tighten for qmu analyses
+md.transient.requested_outputs=IceVolumeEnum();
+
+%solve
+md=solve(md,TransientSolutionEnum,'overwrite','y');
+md=tres(md,'dakota');
+
+%Fields and tolerances to track changes
+md.results.dakota.importancefactors=[];
+for i=1:8,
+	md.results.dakota.importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).mean];
+end
+for i=1:8,
+	md.results.dakota.importancefactors=[md.results.dakota.importancefactors md.results.dakota.dresp_out(i).stddev];
+end
+field_names     ={'importancefactors'};
+field_tolerances={1e-11};
+field_values={...
+         md.results.dakota.importancefactors,...
+	};
Index: /issm/trunk/test/NightlyRun/test301.m
===================================================================
--- /issm/trunk/test/NightlyRun/test301.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test301.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test302.m
===================================================================
--- /issm/trunk/test/NightlyRun/test302.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test302.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test303.m
===================================================================
--- /issm/trunk/test/NightlyRun/test303.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test303.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test304.m
===================================================================
--- /issm/trunk/test/NightlyRun/test304.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test304.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test305.m
===================================================================
--- /issm/trunk/test/NightlyRun/test305.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test305.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test306.m
===================================================================
--- /issm/trunk/test/NightlyRun/test306.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test306.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test307.m
===================================================================
--- /issm/trunk/test/NightlyRun/test307.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test307.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test308.m
===================================================================
--- /issm/trunk/test/NightlyRun/test308.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test308.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test309.m
===================================================================
--- /issm/trunk/test/NightlyRun/test309.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test309.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test310.m
===================================================================
--- /issm/trunk/test/NightlyRun/test310.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test310.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test311.m
===================================================================
--- /issm/trunk/test/NightlyRun/test311.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test311.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test312.m
===================================================================
--- /issm/trunk/test/NightlyRun/test312.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test312.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test313.m
===================================================================
--- /issm/trunk/test/NightlyRun/test313.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test313.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test314.m
===================================================================
--- /issm/trunk/test/NightlyRun/test314.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test314.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test315.m
===================================================================
--- /issm/trunk/test/NightlyRun/test315.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test315.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test316.m
===================================================================
--- /issm/trunk/test/NightlyRun/test316.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test316.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test317.m
===================================================================
--- /issm/trunk/test/NightlyRun/test317.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test317.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test318.m
===================================================================
--- /issm/trunk/test/NightlyRun/test318.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test318.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test319.m
===================================================================
--- /issm/trunk/test/NightlyRun/test319.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test319.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=meshconvert(md);
 md=setmask(md,'','');
Index: /issm/trunk/test/NightlyRun/test320.m
===================================================================
--- /issm/trunk/test/NightlyRun/test320.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test320.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=meshconvert(md);
 md=setmask(md,'','');
Index: /issm/trunk/test/NightlyRun/test321.m
===================================================================
--- /issm/trunk/test/NightlyRun/test321.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test321.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test322.m
===================================================================
--- /issm/trunk/test/NightlyRun/test322.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test322.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test323.m
===================================================================
--- /issm/trunk/test/NightlyRun/test323.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test323.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test324.m
===================================================================
--- /issm/trunk/test/NightlyRun/test324.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test324.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test325.m
===================================================================
--- /issm/trunk/test/NightlyRun/test325.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test325.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test326.m
===================================================================
--- /issm/trunk/test/NightlyRun/test326.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test326.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test327.m
===================================================================
--- /issm/trunk/test/NightlyRun/test327.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test327.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test328.m
===================================================================
--- /issm/trunk/test/NightlyRun/test328.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test328.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test329.m
===================================================================
--- /issm/trunk/test/NightlyRun/test329.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test329.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test330.m
===================================================================
--- /issm/trunk/test/NightlyRun/test330.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test330.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test331.m
===================================================================
--- /issm/trunk/test/NightlyRun/test331.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test331.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test332.m
===================================================================
--- /issm/trunk/test/NightlyRun/test332.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test332.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test333.m
===================================================================
--- /issm/trunk/test/NightlyRun/test333.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test333.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test334.m
===================================================================
--- /issm/trunk/test/NightlyRun/test334.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test334.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test335.m
===================================================================
--- /issm/trunk/test/NightlyRun/test335.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test335.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test336.m
===================================================================
--- /issm/trunk/test/NightlyRun/test336.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test336.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test337.m
===================================================================
--- /issm/trunk/test/NightlyRun/test337.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test337.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test338.m
===================================================================
--- /issm/trunk/test/NightlyRun/test338.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test338.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test339.m
===================================================================
--- /issm/trunk/test/NightlyRun/test339.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test339.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test340.m
===================================================================
--- /issm/trunk/test/NightlyRun/test340.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test340.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test341.m
===================================================================
--- /issm/trunk/test/NightlyRun/test341.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test341.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test342.m
===================================================================
--- /issm/trunk/test/NightlyRun/test342.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test342.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test343.m
===================================================================
--- /issm/trunk/test/NightlyRun/test343.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test343.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test344.m
===================================================================
--- /issm/trunk/test/NightlyRun/test344.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test344.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test345.m
===================================================================
--- /issm/trunk/test/NightlyRun/test345.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test345.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test346.m
===================================================================
--- /issm/trunk/test/NightlyRun/test346.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test346.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test347.m
===================================================================
--- /issm/trunk/test/NightlyRun/test347.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test347.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test348.m
===================================================================
--- /issm/trunk/test/NightlyRun/test348.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test348.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'','');
 md=parameterize(md,'../Par/SquareSheetConstrained.par');
Index: /issm/trunk/test/NightlyRun/test401.m
===================================================================
--- /issm/trunk/test/NightlyRun/test401.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test401.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test402.m
===================================================================
--- /issm/trunk/test/NightlyRun/test402.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test402.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test403.m
===================================================================
--- /issm/trunk/test/NightlyRun/test403.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test403.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test404.m
===================================================================
--- /issm/trunk/test/NightlyRun/test404.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test404.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test405.m
===================================================================
--- /issm/trunk/test/NightlyRun/test405.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test405.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test406.m
===================================================================
--- /issm/trunk/test/NightlyRun/test406.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test406.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test407.m
===================================================================
--- /issm/trunk/test/NightlyRun/test407.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test407.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test408.m
===================================================================
--- /issm/trunk/test/NightlyRun/test408.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test408.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test409.m
===================================================================
--- /issm/trunk/test/NightlyRun/test409.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test409.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test410.m
===================================================================
--- /issm/trunk/test/NightlyRun/test410.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test410.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test411.m
===================================================================
--- /issm/trunk/test/NightlyRun/test411.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test411.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test412.m
===================================================================
--- /issm/trunk/test/NightlyRun/test412.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test412.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test413.m
===================================================================
--- /issm/trunk/test/NightlyRun/test413.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test413.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test414.m
===================================================================
--- /issm/trunk/test/NightlyRun/test414.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test414.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test415.m
===================================================================
--- /issm/trunk/test/NightlyRun/test415.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test415.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test416.m
===================================================================
--- /issm/trunk/test/NightlyRun/test416.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test416.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test417.m
===================================================================
--- /issm/trunk/test/NightlyRun/test417.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test417.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test418.m
===================================================================
--- /issm/trunk/test/NightlyRun/test418.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test418.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test419.m
===================================================================
--- /issm/trunk/test/NightlyRun/test419.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test419.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test420.m
===================================================================
--- /issm/trunk/test/NightlyRun/test420.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test420.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test421.m
===================================================================
--- /issm/trunk/test/NightlyRun/test421.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test421.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test422.m
===================================================================
--- /issm/trunk/test/NightlyRun/test422.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test422.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test423.m
===================================================================
--- /issm/trunk/test/NightlyRun/test423.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test423.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',300000);
+md=triangle(model,'../Exp/Square.exp',300000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test424.m
===================================================================
--- /issm/trunk/test/NightlyRun/test424.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test424.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',300000);
+md=triangle(model,'../Exp/Square.exp',300000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test425.m
===================================================================
--- /issm/trunk/test/NightlyRun/test425.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test425.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test426.m
===================================================================
--- /issm/trunk/test/NightlyRun/test426.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test426.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test427.m
===================================================================
--- /issm/trunk/test/NightlyRun/test427.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test427.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test428.m
===================================================================
--- /issm/trunk/test/NightlyRun/test428.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test428.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test429.m
===================================================================
--- /issm/trunk/test/NightlyRun/test429.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test429.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',170000);
+md=triangle(model,'../Exp/Square.exp',170000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test430.m
===================================================================
--- /issm/trunk/test/NightlyRun/test430.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test430.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',170000);
+md=triangle(model,'../Exp/Square.exp',170000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test431.m
===================================================================
--- /issm/trunk/test/NightlyRun/test431.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test431.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',170000);
+md=triangle(model,'../Exp/Square.exp',170000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test432.m
===================================================================
--- /issm/trunk/test/NightlyRun/test432.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test432.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',170000);
+md=triangle(model,'../Exp/Square.exp',170000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test434.m
===================================================================
--- /issm/trunk/test/NightlyRun/test434.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test434.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test435.m
===================================================================
--- /issm/trunk/test/NightlyRun/test435.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test435.m	(revision 11027)
@@ -1,4 +1,4 @@
 %test partitioning, and partition averaging
-md=setmesh(model,'../Exp/Square.exp',30000);
+md=triangle(model,'../Exp/Square.exp',30000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test437.m
===================================================================
--- /issm/trunk/test/NightlyRun/test437.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test437.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test438.m
===================================================================
--- /issm/trunk/test/NightlyRun/test438.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test438.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test439.m
===================================================================
--- /issm/trunk/test/NightlyRun/test439.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test439.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test440.m
===================================================================
--- /issm/trunk/test/NightlyRun/test440.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test440.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',200000);
+md=triangle(model,'../Exp/Square.exp',200000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test441.m
===================================================================
--- /issm/trunk/test/NightlyRun/test441.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test441.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test442.m
===================================================================
--- /issm/trunk/test/NightlyRun/test442.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test442.m	(revision 11027)
@@ -1,8 +1,8 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
 md=extrude(md,5,1);
 md=setflowequation(md,'stokes','../Exp/SquareHalfRight.exp','fill','pattyn');
-md.cluster=generic('name',oshostname(),'np',7);
+md.cluster=generic('name',oshostname(),'np',3);
 md=solve(md,DiagnosticSolutionEnum);
 
Index: /issm/trunk/test/NightlyRun/test443.m
===================================================================
--- /issm/trunk/test/NightlyRun/test443.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test443.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test444.m
===================================================================
--- /issm/trunk/test/NightlyRun/test444.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test444.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',180000);
+md=triangle(model,'../Exp/Square.exp',180000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test447.m
===================================================================
--- /issm/trunk/test/NightlyRun/test447.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test447.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test448.m
===================================================================
--- /issm/trunk/test/NightlyRun/test448.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test448.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test449.m
===================================================================
--- /issm/trunk/test/NightlyRun/test449.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test449.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test450.m
===================================================================
--- /issm/trunk/test/NightlyRun/test450.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test450.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test451.m
===================================================================
--- /issm/trunk/test/NightlyRun/test451.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test451.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test452.m
===================================================================
--- /issm/trunk/test/NightlyRun/test452.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test452.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',350000);
+md=triangle(model,'../Exp/Square.exp',350000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test453.m
===================================================================
--- /issm/trunk/test/NightlyRun/test453.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test453.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test454.m
===================================================================
--- /issm/trunk/test/NightlyRun/test454.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test454.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Square.exp',150000);
+md=triangle(model,'../Exp/Square.exp',150000);
 md=setmask(md,'../Exp/SquareShelf.exp','');
 md=parameterize(md,'../Par/SquareSheetShelf.par');
Index: /issm/trunk/test/NightlyRun/test501.m
===================================================================
--- /issm/trunk/test/NightlyRun/test501.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test501.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test502.m
===================================================================
--- /issm/trunk/test/NightlyRun/test502.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test502.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test503.m
===================================================================
--- /issm/trunk/test/NightlyRun/test503.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test503.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test504.m
===================================================================
--- /issm/trunk/test/NightlyRun/test504.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test504.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test505.m
===================================================================
--- /issm/trunk/test/NightlyRun/test505.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test505.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test506.m
===================================================================
--- /issm/trunk/test/NightlyRun/test506.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test506.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test507.m
===================================================================
--- /issm/trunk/test/NightlyRun/test507.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test507.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test508.m
===================================================================
--- /issm/trunk/test/NightlyRun/test508.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test508.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test509.m
===================================================================
--- /issm/trunk/test/NightlyRun/test509.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test509.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test510.m
===================================================================
--- /issm/trunk/test/NightlyRun/test510.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test510.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test511.m
===================================================================
--- /issm/trunk/test/NightlyRun/test511.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test511.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test512.m
===================================================================
--- /issm/trunk/test/NightlyRun/test512.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test512.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test513.m
===================================================================
--- /issm/trunk/test/NightlyRun/test513.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test513.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test514.m
===================================================================
--- /issm/trunk/test/NightlyRun/test514.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test514.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test515.m
===================================================================
--- /issm/trunk/test/NightlyRun/test515.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test515.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test516.m
===================================================================
--- /issm/trunk/test/NightlyRun/test516.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test516.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test517.m
===================================================================
--- /issm/trunk/test/NightlyRun/test517.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test517.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test518.m
===================================================================
--- /issm/trunk/test/NightlyRun/test518.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test518.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test519.m
===================================================================
--- /issm/trunk/test/NightlyRun/test519.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test519.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test520.m
===================================================================
--- /issm/trunk/test/NightlyRun/test520.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test520.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test521.m
===================================================================
--- /issm/trunk/test/NightlyRun/test521.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test521.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',10000);
+md=triangle(model,'../Exp/Pig.exp',10000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test522.m
===================================================================
--- /issm/trunk/test/NightlyRun/test522.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test522.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',10000);
+md=triangle(model,'../Exp/Pig.exp',10000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test523.m
===================================================================
--- /issm/trunk/test/NightlyRun/test523.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test523.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test524.m
===================================================================
--- /issm/trunk/test/NightlyRun/test524.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test524.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',20000);
+md=triangle(model,'../Exp/Pig.exp',20000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test525.m
===================================================================
--- /issm/trunk/test/NightlyRun/test525.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test525.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test526.m
===================================================================
--- /issm/trunk/test/NightlyRun/test526.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test526.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test529.m
===================================================================
--- /issm/trunk/test/NightlyRun/test529.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test529.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test530.m
===================================================================
--- /issm/trunk/test/NightlyRun/test530.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test530.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test531.m
===================================================================
--- /issm/trunk/test/NightlyRun/test531.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test531.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test532.m
===================================================================
--- /issm/trunk/test/NightlyRun/test532.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test532.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/Pig.exp',30000);
+md=triangle(model,'../Exp/Pig.exp',30000);
 md=setmask(md,'../Exp/PigShelves.exp','../Exp/PigIslands.exp');
 md=parameterize(md,'../Par/Pig.par');
Index: /issm/trunk/test/NightlyRun/test601.m
===================================================================
--- /issm/trunk/test/NightlyRun/test601.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test601.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test602.m
===================================================================
--- /issm/trunk/test/NightlyRun/test602.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test602.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test603.m
===================================================================
--- /issm/trunk/test/NightlyRun/test603.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test603.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test604.m
===================================================================
--- /issm/trunk/test/NightlyRun/test604.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test604.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test605.m
===================================================================
--- /issm/trunk/test/NightlyRun/test605.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test605.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test606.m
===================================================================
--- /issm/trunk/test/NightlyRun/test606.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test606.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test607.m
===================================================================
--- /issm/trunk/test/NightlyRun/test607.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test607.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test608.m
===================================================================
--- /issm/trunk/test/NightlyRun/test608.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test608.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test609.m
===================================================================
--- /issm/trunk/test/NightlyRun/test609.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test609.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test610.m
===================================================================
--- /issm/trunk/test/NightlyRun/test610.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test610.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test611.m
===================================================================
--- /issm/trunk/test/NightlyRun/test611.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test611.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test612.m
===================================================================
--- /issm/trunk/test/NightlyRun/test612.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test612.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test613.m
===================================================================
--- /issm/trunk/test/NightlyRun/test613.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test613.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test614.m
===================================================================
--- /issm/trunk/test/NightlyRun/test614.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test614.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test615.m
===================================================================
--- /issm/trunk/test/NightlyRun/test615.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test615.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test616.m
===================================================================
--- /issm/trunk/test/NightlyRun/test616.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test616.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test617.m
===================================================================
--- /issm/trunk/test/NightlyRun/test617.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test617.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test618.m
===================================================================
--- /issm/trunk/test/NightlyRun/test618.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test618.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test619.m
===================================================================
--- /issm/trunk/test/NightlyRun/test619.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test619.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test620.m
===================================================================
--- /issm/trunk/test/NightlyRun/test620.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test620.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test621.m
===================================================================
--- /issm/trunk/test/NightlyRun/test621.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test621.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test622.m
===================================================================
--- /issm/trunk/test/NightlyRun/test622.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test622.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
 md=parameterize(md,'../Par/79North.par');
Index: /issm/trunk/test/NightlyRun/test623.m
===================================================================
--- /issm/trunk/test/NightlyRun/test623.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test623.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test624.m
===================================================================
--- /issm/trunk/test/NightlyRun/test624.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test624.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test625.m
===================================================================
--- /issm/trunk/test/NightlyRun/test625.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test625.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
Index: /issm/trunk/test/NightlyRun/test626.m
===================================================================
--- /issm/trunk/test/NightlyRun/test626.m	(revision 11026)
+++ /issm/trunk/test/NightlyRun/test626.m	(revision 11027)
@@ -1,3 +1,3 @@
-md=setmesh(model,'../Exp/79North.exp',10000);
+md=triangle(model,'../Exp/79North.exp',10000);
 md=meshconvert(md);
 md=setmask(md,'../Exp/79NorthShelf.exp','');
