Index: /issm/trunk/src/c/objects/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Penta.cpp	(revision 2710)
+++ /issm/trunk/src/c/objects/Penta.cpp	(revision 2711)
@@ -16,11 +16,14 @@
 #include "../include/typedefs.h"
 
+/*FUNCTION Penta constructor {{{1*/
 Penta::Penta(){
 	return;
 }
+/*}}}*/
+/*FUNCTION Penta creation {{{1*/
 Penta::Penta( int penta_id, int penta_mid, int penta_mparid, int penta_numparid, int penta_node_ids[6], double penta_h[6], double penta_s[6], double penta_b[6], double penta_k[6], int penta_friction_type, 
-				double penta_p, double penta_q, int penta_shelf, int penta_onbed, int penta_onsurface,  int penta_collapse, double penta_melting[6], double penta_accumulation[6], double penta_geothermalflux[6], 
-				 int penta_thermal_steadystate,bool penta_onwater){
-	
+			double penta_p, double penta_q, int penta_shelf, int penta_onbed, int penta_onsurface,  int penta_collapse, double penta_melting[6], double penta_accumulation[6], double penta_geothermalflux[6], 
+			int penta_thermal_steadystate,bool penta_onwater){
+
 	int i;
 
@@ -61,8 +64,11 @@
 	return;
 }
-
+/*}}}*/
+/*FUNCTION Penta destructor {{{1*/
 Penta::~Penta(){
 	return;
 }
+/*}}}*/
+/*FUNCTION Penta Echo {{{1*/
 void Penta::Echo(void){
 
@@ -82,5 +88,5 @@
 	printf("   b=[%g,%g,%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3],b[4],b[5]);
 	printf("   k=[%g,%g,%g,%g,%g,%g]\n",k[0],k[1],k[2],k[3],k[4],k[5]);
-	
+
 	printf("   friction_type: %i\n",friction_type);
 	printf("   p: %g\n",p);
@@ -91,5 +97,5 @@
 	printf("   onsurface: %i\n",onsurface);
 	printf("   collapse: %i\n",collapse);
-	
+
 	printf("   melting=[%g,%g,%g,%g,%g,%g]\n",melting[0],melting[1],melting[2],melting[3],melting[4],melting[5]);
 	printf("   accumulation=[%g,%g,%g,%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2],accumulation[3],accumulation[4],accumulation[5]);
@@ -98,4 +104,6 @@
 	return;
 }
+/*}}}*/
+/*FUNCTION Penta DeepEcho {{{1*/
 void Penta::DeepEcho(void){
 
@@ -115,5 +123,5 @@
 	printf("   b=[%i,%i,%i,%i,%i,%i]\n",b[0],b[1],b[2],b[3],b[4],b[5]);
 	printf("   k=[%i,%i,%i,%i,%i,%i]\n",k[0],k[1],k[2],k[3],k[4],k[5]);
-	
+
 	printf("   friction_type: %i\n",friction_type);
 	printf("   p: %g\n",p);
@@ -124,5 +132,5 @@
 	printf("   onsurface: %i\n",onsurface);
 	printf("   collapse: %i\n",collapse);
-	
+
 	printf("   melting=[%i,%i,%i,%i,%i,%i]\n",melting[0],melting[1],melting[2],melting[3],melting[4],melting[5]);
 	printf("   accumulation=[%i,%i,%i,%i,%i,%i]\n",accumulation[0],accumulation[1],accumulation[2],accumulation[3],accumulation[4],accumulation[5]);
@@ -131,4 +139,6 @@
 	return;
 }
+/*}}}*/
+/*FUNCTION Penta Marshall {{{1*/
 void  Penta::Marshall(char** pmarshalled_dataset){
 
@@ -141,8 +151,8 @@
 	/*get enum type of Penta: */
 	enum_type=PentaEnum();
-	
+
 	/*marshall enum: */
 	memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
-	
+
 	/*marshall Penta data: */
 	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
@@ -175,47 +185,50 @@
 	memcpy(marshalled_dataset,&geothermalflux,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux);
 	memcpy(marshalled_dataset,&thermal_steadystate,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate);
-	
+
 	*pmarshalled_dataset=marshalled_dataset;
 	return;
 }
-		
+/*}}}*/
+/*FUNCTION Penta MarshallSize {{{1*/
 int   Penta::MarshallSize(){
 
 	return sizeof(id)+
-		sizeof(mid)+
-		sizeof(mparid)+
-		sizeof(node_ids)+
-		sizeof(nodes)+
-		sizeof(node_offsets)+
-		sizeof(matice)+
-		sizeof(matice_offset)+
-		sizeof(matpar)+
-		sizeof(matpar_offset)+
-		+sizeof(numparid)+
-		+sizeof(numpar)+
-		+sizeof(numpar_offset)+
-		sizeof(h)+
-		sizeof(s)+
-		sizeof(b)+
-		sizeof(k)+
-		sizeof(friction_type)+
-		sizeof(p)+
-		sizeof(q)+
-		sizeof(shelf)+
-		sizeof(onbed)+
-		sizeof(onwater)+
-		sizeof(onsurface)+
-		sizeof(collapse)+
-		sizeof(melting)+
-		sizeof(accumulation)+
-		sizeof(geothermalflux)+
-		sizeof(thermal_steadystate) +
-		sizeof(int); //sizeof(int) for enum type
-}
-
+	  sizeof(mid)+
+	  sizeof(mparid)+
+	  sizeof(node_ids)+
+	  sizeof(nodes)+
+	  sizeof(node_offsets)+
+	  sizeof(matice)+
+	  sizeof(matice_offset)+
+	  sizeof(matpar)+
+	  sizeof(matpar_offset)+
+	  +sizeof(numparid)+
+	  +sizeof(numpar)+
+	  +sizeof(numpar_offset)+
+	  sizeof(h)+
+	  sizeof(s)+
+	  sizeof(b)+
+	  sizeof(k)+
+	  sizeof(friction_type)+
+	  sizeof(p)+
+	  sizeof(q)+
+	  sizeof(shelf)+
+	  sizeof(onbed)+
+	  sizeof(onwater)+
+	  sizeof(onsurface)+
+	  sizeof(collapse)+
+	  sizeof(melting)+
+	  sizeof(accumulation)+
+	  sizeof(geothermalflux)+
+	  sizeof(thermal_steadystate) +
+	  sizeof(int); //sizeof(int) for enum type
+}
+/*}}}*/
+/*FUNCTION Penta GetName {{{1*/
 char* Penta::GetName(void){
 	return "penta";
 }
-
+/*}}}*/
+/*FUNCTION Penta Demarshall {{{1*/
 void  Penta::Demarshall(char** pmarshalled_dataset){
 
@@ -269,4 +282,6 @@
 	return;
 }
+/*}}}*/
+/*FUNCTION Penta Enum {{{1*/
 int Penta::Enum(void){
 
@@ -274,18 +289,23 @@
 
 }
-int    Penta::GetId(void){ return id; }
-
+/*}}}*/
+/*FUNCTION Penta GetId {{{1*/
+int    Penta::GetId(void){
+	return id; 
+}
+/*}}}*/
+/*FUNCTION Penta MyRank {{{1*/
 int    Penta::MyRank(void){ 
 	extern int my_rank;
 	return my_rank; 
 }
-
-
-#undef __FUNCT__ 
+/*}}}*/
+/*FUNCTION Penta Configure {{{1*/
+#undef __FUConfigure NCT__ 
 #define __FUNCT__ "Penta::Configure"
 void  Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
 
 	int i;
-	
+
 	DataSet* loadsin=NULL;
 	DataSet* nodesin=NULL;
@@ -301,5 +321,5 @@
 	/*Link this element with its nodes, ie find pointers to the nodes in the nodes dataset.: */
 	ResolvePointers((Object**)nodes,node_ids,node_offsets,6,nodesin);
-	
+
 	/*Same for materials: */
 	ResolvePointers((Object**)&matice,&mid,&matice_offset,1,materialsin);
@@ -310,5 +330,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrix {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreateKMatrix"
@@ -323,34 +344,34 @@
 	}
 	else if (analysis_type==DiagnosticAnalysisEnum()){
-	
+
 		if (sub_analysis_type==HorizAnalysisEnum()){
-		
+
 			CreateKMatrixDiagnosticHoriz( Kgg,inputs,analysis_type,sub_analysis_type);
 		}
 		else if (sub_analysis_type==VertAnalysisEnum()){
-		
+
 			CreateKMatrixDiagnosticVert( Kgg,inputs,analysis_type,sub_analysis_type);
 		}
 		else if (sub_analysis_type==StokesAnalysisEnum()){
-		
+
 			CreateKMatrixDiagnosticStokes( Kgg,inputs,analysis_type,sub_analysis_type);
-		
+
 		}
 		else throw ErrorException(__FUNCT__,exprintf("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"));
 	}
 	else if (analysis_type==SlopeComputeAnalysisEnum()){
-		
+
 		CreateKMatrixSlopeCompute( Kgg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==PrognosticAnalysisEnum()){
-		
+
 		CreateKMatrixPrognostic( Kgg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==ThermalAnalysisEnum()){
-		
+
 		CreateKMatrixThermal( Kgg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==MeltingAnalysisEnum()){
-		
+
 		CreateKMatrixMelting( Kgg,inputs,analysis_type,sub_analysis_type);
 	}
@@ -360,5 +381,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixDiagnosticHoriz {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta:CreateKMatrixDiagnosticHoriz"
@@ -375,6 +397,6 @@
 	int          doflist[numdof];
 	int          numberofdofspernode;
-	
-	
+
+
 	/* 3d gaussian points: */
 	int     num_gauss,ig;
@@ -392,5 +414,5 @@
 	int     num_area_gauss;
 	double  gauss_weight;
-	
+
 	/* 2d gaussian point: */
 	int     num_gauss2d;
@@ -424,5 +446,5 @@
 	double Ke_gg_drag_gaussian[numdof][numdof]; //stiffness matrix contribution from drag
 	double Jdet;
-	
+
 	/*slope: */
 	double  slope[2]={0.0,0.0};
@@ -491,5 +513,5 @@
 		}
 
-		#ifdef _DEBUGELEMENTS_
+#ifdef _DEBUGELEMENTS_
 		if(my_rank==RANK && id==ELID){ 
 			printf("El id %i Rank %i PentaElement input list before gaussian loop: \n",ELID,RANK); 
@@ -508,5 +530,5 @@
 			printf("   temperature_average [%g %g %g %g %g %g]\n",temperature_average_list[0],temperature_average_list[1],temperature_average_list[2],temperature_average_list[3],temperature_average_list[4],temperature_average_list[5]);
 		}
-		#endif
+#endif
 
 		/*Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore 
@@ -521,5 +543,5 @@
 		GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, &fourth_gauss_vert_coord,&vert_gauss_weights,order_area_gauss,num_vert_gauss);
 
-		#ifdef _DEBUGGAUSS_
+#ifdef _DEBUGGAUSS_
 		if(my_rank==RANK && id==ELID){ 
 			printf("El id %i Rank %i PentaElement gauss points\n",ELID,RANK); 
@@ -531,15 +553,15 @@
 			}	
 		}
-		#endif
+#endif
 		/* Start  looping on the number of gaussian points: */
 		for (ig1=0; ig1<num_area_gauss; ig1++){
 			for (ig2=0; ig2<num_vert_gauss; ig2++){
-			
+
 				/*Pick up the gaussian point: */
 				gauss_weight1=*(area_gauss_weights+ig1);
 				gauss_weight2=*(vert_gauss_weights+ig2);
 				gauss_weight=gauss_weight1*gauss_weight2;
-				
-				
+
+
 				gauss_l1l2l3l4[0]=*(first_gauss_area_coord+ig1); 
 				gauss_l1l2l3l4[1]=*(second_gauss_area_coord+ig1);
@@ -551,5 +573,5 @@
 				GetStrainRate(&epsilon[0],&vxvy_list[0][0],&xyz_list[0][0],gauss_l1l2l3l4);
 				GetStrainRate(&oldepsilon[0],&oldvxvy_list[0][0],&xyz_list[0][0],gauss_l1l2l3l4);
-			
+
 				/*Get viscosity: */
 				matice->GetViscosity3d(&viscosity, &epsilon[0]);
@@ -562,8 +584,8 @@
 				/* Get Jacobian determinant: */
 				GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3l4);
-	
+
 				/*Build the D matrix: we plug the gaussian weight, the thickness, the viscosity, and the jacobian determinant 
 				  onto this scalar matrix, so that we win some computational time: */
-				
+
 				newviscosity=viscosity+numpar->viscosity_overshoot*(viscosity-oldviscosity);
 				D_scalar=newviscosity*gauss_weight*Jdet;
@@ -571,10 +593,10 @@
 					D[i][i]=D_scalar;
 				}
-		
+
 				/*  Do the triple product tB*D*Bprime: */
 				TripleMultiply( &B[0][0],5,numdof,1,
-						&D[0][0],5,5,0,
-						&Bprime[0][0],5,numdof,0,
-						&Ke_gg_gaussian[0][0],0);
+							&D[0][0],5,5,0,
+							&Bprime[0][0],5,numdof,0,
+							&Ke_gg_gaussian[0][0],0);
 
 				/* Add the Ke_gg_gaussian, and optionally Ke_gg_gaussian onto Ke_gg: */
@@ -586,9 +608,9 @@
 			} //for (ig2=0; ig2<num_vert_gauss; ig2++)
 		} //for (ig1=0; ig1<num_area_gauss; ig1++)
-		
+
 
 		/*Add Ke_gg to global matrix Kgg: */
 		MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES);
-	
+
 		//Deal with 2d friction at the bedrock interface
 		if((onbed && !shelf)){
@@ -605,5 +627,5 @@
 	} 
 
-	cleanup_and_return: 
+cleanup_and_return: 
 	xfree((void**)&first_gauss_area_coord);
 	xfree((void**)&second_gauss_area_coord);
@@ -618,5 +640,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixDiagnosticVert {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta:CreateKMatrixDiagnosticVert"
@@ -668,5 +691,5 @@
 	/*recover pointers: */
 	inputs=(ParameterInputs*)vinputs;
-	
+
 
 	/*If this element  is on the surface, we have a dynamic boundary condition that applies, as a stiffness 
@@ -701,5 +724,5 @@
 
 	GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, &fourth_gauss_vert_coord,&vert_gauss_weights,order_area_gauss,num_vert_gauss);
-	#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<num_area_gauss;i++){
 		printf("Area Gauss coord %i: %lf %lf %lf Weight: %lf\n",i,*(first_gauss_area_coord+i),*(second_gauss_area_coord+i),*(third_gauss_area_coord+i),*(area_gauss_weights+i));
@@ -708,15 +731,15 @@
 		printf("Vert Gauss coord %i: %lf Weight: %lf\n",i,*(fourth_gauss_vert_coord+i),*(vert_gauss_weights+i));
 	}
-	#endif
-	
+#endif
+
 	/* Start  looping on the number of gaussian points: */
 	for (ig1=0; ig1<num_area_gauss; ig1++){
 		for (ig2=0; ig2<num_vert_gauss; ig2++){
-		
+
 			/*Pick up the gaussian point: */
 			gauss_weight1=*(area_gauss_weights+ig1);
 			gauss_weight2=*(vert_gauss_weights+ig2);
 			gauss_weight=gauss_weight1*gauss_weight2;
-			
+
 			gauss_l1l2l3l4[0]=*(first_gauss_area_coord+ig1); 
 			gauss_l1l2l3l4[1]=*(second_gauss_area_coord+ig1);
@@ -734,7 +757,7 @@
 			/*  Do the triple product tB*D*Bprime: */
 			TripleMultiply( &B[0][0],1,numgrids,1,
-					&DL_scalar,1,1,0,
-					&Bprime[0][0],1,numgrids,0,
-					&Ke_gg_gaussian[0][0],0);
+						&DL_scalar,1,1,0,
+						&Bprime[0][0],1,numgrids,0,
+						&Ke_gg_gaussian[0][0],0);
 
 			/* Add the Ke_gg_gaussian, and optionally Ke_gg_drag_gaussian onto Ke_gg: */
@@ -749,6 +772,6 @@
 	/*Add Ke_gg to global matrix Kgg: */
 	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES);
-	
-	cleanup_and_return: 
+
+cleanup_and_return: 
 	xfree((void**)&first_gauss_area_coord);
 	xfree((void**)&second_gauss_area_coord);
@@ -758,5 +781,6 @@
 	xfree((void**)&vert_gauss_weights);
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixDiagnosticStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta:CreateKMatrixDiagnosticStokes"
@@ -786,5 +810,5 @@
 	/*Grid data: */
 	double        xyz_list[numgrids][3];
-	
+
 	/*parameters: */
 	double		   xyz_list_tria[numgrids2d][3];
@@ -810,5 +834,5 @@
 	double     DLStokes[14][14]={0.0};
 	double     tLDStokes[numdof2d][14];
-	
+
 	/* gaussian points: */
 	int     num_area_gauss;
@@ -832,5 +856,5 @@
 	double  alpha2_list[numgrids2d];
 	double  alpha2_gauss;
-	
+
 	ParameterInputs* inputs=NULL;
 
@@ -847,5 +871,5 @@
 		}
 	}
-	
+
 	/*recovre material parameters: */
 	rho_water=matpar->GetRhoWater();
@@ -861,8 +885,8 @@
 
 	/* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore 
-	   get tria gaussian points as well as segment gaussian points. For tria gaussian 
-	   points, order of integration is 2, because we need to integrate the product tB*D*B' 
-	   which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
-	   points, same deal, which yields 3 gaussian points.*/
+		get tria gaussian points as well as segment gaussian points. For tria gaussian 
+		points, order of integration is 2, because we need to integrate the product tB*D*B' 
+		which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
+		points, same deal, which yields 3 gaussian points.*/
 
 	area_order=5;
@@ -888,5 +912,5 @@
 			/*Compute strain rate: */
 			GetStrainRateStokes(&epsilon[0],&vxvyvz_list[0][0],&xyz_list[0][0],gauss_coord);
-		
+
 			/*Get viscosity: */
 			matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
@@ -926,9 +950,9 @@
 		/*Build alpha2_list used by drag stiffness matrix*/
 		Friction* friction=NewFriction();
-		
+
 		/*Initialize all fields: */
 		friction->element_type=(char*)xmalloc((strlen("2d")+1)*sizeof(char));
 		strcpy(friction->element_type,"2d");
-		
+
 		friction->gravity=matpar->GetG();
 		friction->rho_ice=matpar->GetRhoIce();
@@ -953,5 +977,5 @@
 			}
 		}
-		
+
 		xfree((void**)&first_gauss_area_coord); xfree((void**)&second_gauss_area_coord); xfree((void**)&third_gauss_area_coord); xfree((void**)&area_gauss_weights);
 		GaussTria (&num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, 2);
@@ -964,25 +988,25 @@
 			gauss_coord[2]=*(third_gauss_area_coord+igarea);
 			gauss_coord[3]=-1;
-			
+
 			gauss_coord_tria[0]=*(first_gauss_area_coord+igarea); 
 			gauss_coord_tria[1]=*(second_gauss_area_coord+igarea);
 			gauss_coord_tria[2]=*(third_gauss_area_coord+igarea);
-	
+
 			/*Get the Jacobian determinant */
 			tria->GetJacobianDeterminant3d(&Jdet2d, &xyz_list_tria[0][0], gauss_coord_tria);
-			
+
 			/*Get L matrix if viscous basal drag present: */
 			GetLStokes(&LStokes[0][0],  gauss_coord_tria);
 			GetLprimeStokes(&LprimeStokes[0][0], &xyz_list[0][0], gauss_coord_tria, gauss_coord);
-				
+
 			/*Compute strain rate: */
 			GetStrainRateStokes(&epsilon[0],&vxvyvz_list[0][0],&xyz_list[0][0],gauss_coord);
-		
+
 			/*Get viscosity at last iteration: */
 			matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
-	
+
 			/*Get normal vecyor to the bed */
 			SurfaceNormal(&surface_normal[0],xyz_list_tria);
-			
+
 			bed_normal[0]=-surface_normal[0]; //Program is for surface, so the normal to the bed is the opposite of the result
 			bed_normal[1]=-surface_normal[1];
@@ -1018,5 +1042,5 @@
 		}
 	} //if ( (onbed==1) && (shelf==0))
-	
+
 	/*Reduce the matrix */
 	ReduceMatrixStokes(&Ke_reduced[0][0], &Ke_temp[0][0]);
@@ -1030,7 +1054,7 @@
 	/*Add Ke_gg to global matrix Kgg: */
 	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)K_terms,ADD_VALUES);
-	
-	cleanup_and_return: 
-	
+
+cleanup_and_return: 
+
 	/*Free ressources:*/
 	xfree((void**)&first_gauss_area_coord);
@@ -1043,5 +1067,6 @@
 	return;
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVector {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVector"
@@ -1050,9 +1075,9 @@
 	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
 	if (analysis_type==ControlAnalysisEnum()){
-		
+
 		CreatePVectorDiagnosticHoriz( pg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==DiagnosticAnalysisEnum()){
-	
+
 		if (sub_analysis_type==HorizAnalysisEnum()){
 
@@ -1060,9 +1085,9 @@
 		}
 		else if (sub_analysis_type==VertAnalysisEnum()){
-		
+
 			CreatePVectorDiagnosticVert( pg,inputs,analysis_type,sub_analysis_type);
 		}
 		else if (sub_analysis_type==StokesAnalysisEnum()){
-		
+
 			CreatePVectorDiagnosticStokes( pg,inputs,analysis_type,sub_analysis_type);
 		}
@@ -1070,17 +1095,17 @@
 	}
 	else if (analysis_type==SlopeComputeAnalysisEnum()){
-		
+
 		CreatePVectorSlopeCompute( pg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==PrognosticAnalysisEnum()){
-		
+
 		CreatePVectorPrognostic( pg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==ThermalAnalysisEnum()){
-		
+
 		CreatePVectorThermal( pg,inputs,analysis_type,sub_analysis_type);
 	}
 	else if (analysis_type==MeltingAnalysisEnum()){
-		
+
 		CreatePVectorMelting( pg,inputs,analysis_type,sub_analysis_type);
 	}
@@ -1090,4 +1115,6 @@
 
 }
+/*}}}*/
+/*FUNCTION Penta UpdateFromInputs {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::UpdateFromInputs"
@@ -1126,5 +1153,5 @@
 		}
 	}
-	
+
 	if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){
 		if(matice && collapse){
@@ -1136,5 +1163,5 @@
 		}
 	}
-	
+
 	if(inputs->Recover("B",&B_list[0],1,dofs,6,(void**)nodes)){
 		if(matice){
@@ -1145,14 +1172,16 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta GetMatPar {{{1*/
 void* Penta::GetMatPar(){
 	return matpar;
 }
-
+/*}}}*/
+/*FUNCTION Penta GetShelf {{{1*/
 int   Penta::GetShelf(){
 	return shelf;
 }
-
-
+/*}}}*/
+/*FUNCTION Penta GetNodes {{{1*/
 void  Penta::GetNodes(void** vpnodes){
 	int i;
@@ -1163,25 +1192,31 @@
 	}
 }
-		
+/*}}}*/
+/*FUNCTION Penta GetOnBed {{{1*/
 int Penta::GetOnBed(){
 	return onbed;
 }
-
-void          Penta::GetThicknessList(double* thickness_list){
+/*}}}*/
+/*FUNCTION Penta GetThicknessList {{{1*/
+void Penta::GetThicknessList(double* thickness_list){
 
 	int i;
 	for(i=0;i<6;i++)thickness_list[i]=h[i];
 }
-void          Penta::GetBedList(double* bed_list){
-	
+/*}}}*/
+/*FUNCTION Penta GetBedList {{{1*/
+void Penta::GetBedList(double* bed_list){
+
 	int i;
 	for(i=0;i<6;i++)bed_list[i]=b[i];
 
 }
-
+/*}}}*/
+/*FUNCTION Penta copy {{{1*/
 Object* Penta::copy() {
 	return new Penta(*this); 
 }
-
+/*}}}*/
+/*FUNCTION Penta Du {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::Du"
@@ -1193,5 +1228,5 @@
 	/*If on water, skip: */
 	if(onwater)return;
-	
+
 	/*Bail out if this element if:
 	 * -> Non collapsed and not on the surface
@@ -1210,5 +1245,5 @@
 	}
 	else{
-		
+
 		tria=(Tria*)SpawnTria(3,4,5); //grids 3, 4 and 5 make the new tria (upper face).
 		tria->Du(du_g,inputs,analysis_type,sub_analysis_type);
@@ -1217,9 +1252,10 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta Gradj {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::Gradj"
 void  Penta::Gradj(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type,char* control_type){
-	
+
 	/*If on water, skip grad (=0): */
 	if(onwater)return;
@@ -1233,9 +1269,10 @@
 	else throw ErrorException(__FUNCT__,exprintf("%s%s","control type not supported yet: ",control_type));
 }
-
+/*}}}*/
+/*FUNCTION Penta GradjDrag {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GradjDrag"
 void  Penta::GradjDrag(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type){
-	
+
 	Tria* tria=NULL;
 
@@ -1267,5 +1304,6 @@
 	else throw ErrorException(__FUNCT__,exprintf("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"));
 }
-
+/*}}}*/
+/*FUNCTION Penta GradjB {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GradjB"
@@ -1296,12 +1334,13 @@
 	}
 }
-        
+/*}}}*/
+/*FUNCTION Penta Misfit {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::Misfit"
 double Penta::Misfit(void* inputs,int analysis_type,int sub_analysis_type){
-	
+
 	double J;
 	Tria* tria=NULL;
-	
+
 	/*If on water, return 0: */
 	if(onwater)return 0;
@@ -1330,5 +1369,6 @@
 	}
 }
-		
+/*}}}*/
+/*FUNCTION Penta SpawnTria {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::SpawnTria"
@@ -1345,5 +1385,5 @@
 	double   tria_accumulation[3];
 	double   tria_geothermalflux[3];
-	
+
 	/*configuration: */
 	int tria_node_ids[3];
@@ -1370,5 +1410,5 @@
 	tria_melting[1]=melting[g1];
 	tria_melting[2]=melting[g2];
-	
+
 	tria_accumulation[0]=accumulation[g0];
 	tria_accumulation[1]=accumulation[g1];
@@ -1401,6 +1441,6 @@
 
 }
-
-
+/*}}}*/
+/*FUNCTION Penta GetDofList {{{1*/
 void  Penta::GetDofList(int* doflist,int* pnumberofdofspernode){
 
@@ -1408,5 +1448,5 @@
 	int doflist_per_node[MAXDOFSPERNODE];
 	int numberofdofspernode;
-	
+
 	for(i=0;i<6;i++){
 		nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode);
@@ -1420,5 +1460,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta GetDofList1 {{{1*/
 void  Penta::GetDofList1(int* doflist){
 
@@ -1429,4 +1470,6 @@
 
 }
+/*}}}*/
+/*FUNCTION Penta GetStrainRate {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetStrainRate"
@@ -1442,5 +1485,5 @@
 	GetB(&B[0][0], xyz_list, gauss_l1l2l3l4);
 
-	#ifdef _ISSM_DEBUG_
+#ifdef _ISSM_DEBUG_
 	printf("B for grid1 : [ %lf   %lf  \n",B[0][0],B[0][1]);
 	printf("              [ %lf   %lf  \n",B[1][0],B[1][1]);
@@ -1448,5 +1491,5 @@
 	printf("              [ %lf   %lf  ]\n",B[3][0],B[3][1]);
 	printf("              [ %lf   %lf  ]\n",B[4][0],B[4][1]);
-	
+
 	printf("B for grid2 : [ %lf   %lf  \n",B[0][2],B[0][3]);
 	printf("              [ %lf   %lf  \n",B[1][2],B[1][3]);
@@ -1454,5 +1497,5 @@
 	printf("              [ %lf   %lf  ]\n",B[3][2],B[3][3]);
 	printf("              [ %lf   %lf  ]\n",B[4][2],B[4][3]);
-	
+
 	printf("B for grid3 : [ %lf   %lf  \n", B[0][4],B[0][5]);
 	printf("              [ %lf   %lf  \n", B[1][4],B[1][5]);
@@ -1460,5 +1503,5 @@
 	printf("              [ %lf   %lf  ]\n",B[3][4],B[3][5]);
 	printf("              [ %lf   %lf  ]\n",B[4][4],B[4][5]);
-	
+
 	printf("B for grid4 : [ %lf   %lf  \n", B[0][6],B[0][7]);
 	printf("              [ %lf   %lf  \n", B[1][6],B[1][7]);
@@ -1466,5 +1509,5 @@
 	printf("              [ %lf   %lf  ]\n",B[3][6],B[3][7]);
 	printf("              [ %lf   %lf  ]\n",B[4][6],B[4][7]);
-				
+
 	printf("B for grid5 : [ %lf   %lf  \n", B[0][8],B[0][9]);
 	printf("              [ %lf   %lf  \n", B[1][8],B[1][9]);
@@ -1479,13 +1522,14 @@
 	printf("              [ %lf   %lf  ]\n",B[4][10],B[4][11]);
 
-	#endif
+#endif
 
 	/*Multiply B by velocity, to get strain rate: */
 	MatrixMultiply( &B[0][0],5,NDOF2*numgrids,0,
-			              velocity,NDOF2*numgrids,1,0,
-						  epsilon,0);
-
-}
-
+				velocity,NDOF2*numgrids,1,0,
+				epsilon,0);
+
+}
+/*}}}*/
+/*FUNCTION Penta GetB {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetB"
@@ -1504,5 +1548,5 @@
 	 * We assume B has been allocated already, of size: 5x(NDOF2*numgrids)
 	 */
-	
+
 	int i;
 	const int numgrids=6;
@@ -1515,9 +1559,9 @@
 	GetNodalFunctionsDerivativesBasic(&dh1dh2dh3dh4dh5dh6_basic[0][0],xyz_list, gauss_l1l2l3l4);
 
-	#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<numgrids;i++){
 		printf("Node %i  dh/dx=%lf dh/dy=%lf dh/dz=%lf\n",i,dh1dh2dh3dh4dh5dh6_basic[0][i],dh1dh2dh3dh4dh5dh6_basic[1][i],dh1dh2dh3dh4dh5dh6_basic[2][i]);
 	}
-	#endif
+#endif
 
 	/*Build B: */
@@ -1534,5 +1578,5 @@
 		*(B+NDOF2*numgrids*3+NDOF2*i)=(float).5*dh1dh2dh3dh4dh5dh6_basic[2][i]; 
 		*(B+NDOF2*numgrids*3+NDOF2*i+1)=0.0;
-		
+
 		*(B+NDOF2*numgrids*4+NDOF2*i)=0.0;
 		*(B+NDOF2*numgrids*4+NDOF2*i+1)=(float).5*dh1dh2dh3dh4dh5dh6_basic[2][i]; 
@@ -1540,6 +1584,6 @@
 
 }
-
-
+/*}}}*/
+/*FUNCTION Penta GetBPrime {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetBPrime"
@@ -1558,5 +1602,5 @@
 	 * We assume B has been allocated already, of size: 5x(NDOF2*numgrids)
 	 */
-	
+
 	int i;
 	const int NDOF3=3;
@@ -1569,9 +1613,9 @@
 	GetNodalFunctionsDerivativesBasic(&dh1dh2dh3dh4dh5dh6_basic[0][0],xyz_list, gauss_l1l2l3l4);
 
-	#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<numgrids;i++){
 		printf("Node %i  dh/dx=%lf dh/dy=%lf dh/dz=%lf\n",i,dh1dh2dh3dh4dh5dh6_basic[0][i],dh1dh2dh3dh4dh5dh6_basic[1][i],dh1dh2dh3dh4dh5dh6_basic[2][i]);
 	}
-	#endif
+#endif
 
 	/*Build BPrime: */
@@ -1588,10 +1632,11 @@
 		*(B+NDOF2*numgrids*3+NDOF2*i)=dh1dh2dh3dh4dh5dh6_basic[2][i]; 
 		*(B+NDOF2*numgrids*3+NDOF2*i+1)=0.0;
-		
+
 		*(B+NDOF2*numgrids*4+NDOF2*i)=0.0;
 		*(B+NDOF2*numgrids*4+NDOF2*i+1)=dh1dh2dh3dh4dh5dh6_basic[2][i]; 
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetJacobianDeterminant {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetJacobianDeterminant" 
@@ -1601,5 +1646,5 @@
 	 * the determinant of it: */
 	const int NDOF3=3;
-	
+
 	double J[NDOF3][NDOF3];
 
@@ -1611,12 +1656,13 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetNodalFunctionsDerivativesBasic {{{1*/
 #undef __FUNCT__
 #define __FUNCT__ "Penta::GetNodalFunctionsDerivativesBasic" 
 void Penta::GetNodalFunctionsDerivativesBasic(double* dh1dh2dh3dh4dh5dh6_basic,double* xyz_list, double* gauss_l1l2l3l4){
-	
+
 	/*This routine returns the values of the nodal functions derivatives  (with respect to the basic coordinate system: */
 
-	
+
 	int i;
 	const int NDOF3=3;
@@ -1646,5 +1692,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta GetJacobian {{{1*/
 #undef __FUNCT__
 #define __FUNCT__ "Penta::GetJacobian" 
@@ -1653,5 +1700,5 @@
 	const int NDOF3=3;
 	int i,j;
-	
+
 	/*The Jacobian is constant over the element, discard the gaussian points. 
 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
@@ -1663,7 +1710,7 @@
 	double y1,y2,y3,y4,y5,y6;
 	double z1,z2,z3,z4,z5,z6;
-	
+
 	double sqrt3=sqrt(3.0);
-	
+
 	/*Figure out xi,eta and zi (parametric coordinates), for this gaussian point: */
 	A1=gauss_l1l2l3l4[0];
@@ -1681,5 +1728,5 @@
 	x5=*(xyz_list+3*4+0);
 	x6=*(xyz_list+3*5+0);
-	
+
 	y1=*(xyz_list+3*0+1);
 	y2=*(xyz_list+3*1+1);
@@ -1709,5 +1756,5 @@
 	*(J+NDOF3*2+2)=sqrt3/12.0*(z1+z2-2*z3-z4-z5+2*z6)*eta+1.0/4.0*(z1-z2-z4+z5)*xi+1.0/4.0*(-z1+z5-z2+z4);
 
-	#ifdef _ISSM_DEBUG_
+#ifdef _ISSM_DEBUG_
 	for(i=0;i<3;i++){
 		for (j=0;j<3;j++){
@@ -1716,11 +1763,12 @@
 		printf("\n");
 	}
-	#endif
-}
-
+#endif
+}
+/*}}}*/
+/*FUNCTION Penta GetNodalFunctionsDerivativesParams {{{1*/
 #undef __FUNCT__
 #define __FUNCT__ "Penta::GetNodalFunctionsDerivativesParams" 
 void Penta::GetNodalFunctionsDerivativesParams(double* dl1dl2dl3dl4dl5dl6,double* gauss_l1l2l3l4){
-	
+
 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
 	 * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */
@@ -1729,5 +1777,5 @@
 	double A1,A2,A3,z;
 	double sqrt3=sqrt(3.0);
-	
+
 	A1=gauss_l1l2l3l4[0]; //first area coordinate value. In term of xi and eta: A1=(1-xi)/2-eta/(2*sqrt(3));
 	A2=gauss_l1l2l3l4[1]; //second area coordinate value In term of xi and eta: A2=(1+xi)/2-eta/(2*sqrt(3));
@@ -1766,5 +1814,6 @@
 	*(dl1dl2dl3dl4dl5dl6+numgrids*2+5)=1.0/2.0*A3;
 }
-
+/*}}}*/
+/*FUNCTION Penta GetJacobianInvert {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetJacobianInvert"
@@ -1780,7 +1829,6 @@
 	MatrixInverse(Jinv,NDOF3,NDOF3,NULL,0,&Jdet);
 }
-
-
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorDiagnosticHoriz {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVectorDiagnosticHoriz"
@@ -1796,5 +1844,5 @@
 	int          doflist[numdof];
 	int          numberofdofspernode;
-	
+
 	/* parameters: */
 	double  slope[NDOF2];
@@ -1874,5 +1922,5 @@
 
 		GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, &fourth_gauss_vert_coord,&vert_gauss_weights,order_area_gauss,num_vert_gauss);
-		#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 		for (i=0;i<num_area_gauss;i++){
 			printf("Area Gauss coord %i: %lf %lf %lf Weight: %lf\n",i,*(first_gauss_area_coord+i),*(second_gauss_area_coord+i),*(third_gauss_area_coord+i),*(area_gauss_weights+i));
@@ -1881,20 +1929,20 @@
 			printf("Vert Gauss coord %i: %lf Weight: %lf\n",i,*(fourth_gauss_vert_coord+i),*(vert_gauss_weights+i));
 		}
-		#endif
-	
+#endif
+
 		/* Start  looping on the number of gaussian points: */
 		for (ig1=0; ig1<num_area_gauss; ig1++){
 			for (ig2=0; ig2<num_vert_gauss; ig2++){
-			
+
 				/*Pick up the gaussian point: */
 				gauss_weight1=*(area_gauss_weights+ig1);
 				gauss_weight2=*(vert_gauss_weights+ig2);
 				gauss_weight=gauss_weight1*gauss_weight2;
-				
+
 				gauss_l1l2l3l4[0]=*(first_gauss_area_coord+ig1); 
 				gauss_l1l2l3l4[1]=*(second_gauss_area_coord+ig1);
 				gauss_l1l2l3l4[2]=*(third_gauss_area_coord+ig1);
 				gauss_l1l2l3l4[3]=*(fourth_gauss_vert_coord+ig2);
-		
+
 				/*Compute thickness at gaussian point: */
 				GetParameterValue(&thickness, &h[0],gauss_l1l2l3l4);
@@ -1905,6 +1953,6 @@
 				/* Get Jacobian determinant: */
 				GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3l4);
-		
-				 /*Get nodal functions: */
+
+				/*Get nodal functions: */
 				GetNodalFunctions(l1l2l3l4l5l6, gauss_l1l2l3l4);
 
@@ -1930,5 +1978,5 @@
 	VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
 
-	cleanup_and_return: 
+cleanup_and_return: 
 	xfree((void**)&first_gauss_area_coord);
 	xfree((void**)&second_gauss_area_coord);
@@ -1939,10 +1987,10 @@
 
 }
-
-
+/*}}}*/
+/*FUNCTION Penta GetParameterValue {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetParameterValue"
 void Penta::GetParameterValue(double* pvalue, double* v_list,double* gauss_l1l2l3l4){
-	
+
 	const int numgrids=6;
 	double l1l2l3l4l5l6[numgrids];
@@ -1952,9 +2000,10 @@
 	*pvalue=l1l2l3l4l5l6[0]*v_list[0]+l1l2l3l4l5l6[1]*v_list[1]+l1l2l3l4l5l6[2]*v_list[2]+l1l2l3l4l5l6[3]*v_list[3]+l1l2l3l4l5l6[4]*v_list[4]+l1l2l3l4l5l6[5]*v_list[5];
 }
-
+/*}}}*/
+/*FUNCTION Penta GetParameterDerivativeValue {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetParameterDerivativeValue"
 void Penta::GetParameterDerivativeValue(double* p, double* p_list,double* xyz_list, double* gauss_l1l2l3l4){
-				
+
 	/*From grid values of parameter p (p_list[0], p_list[1], p_list[2], p_list[3], p_list[4] and p_list[4]), return parameter derivative value at gaussian point specified by gauss_l1l2l3l4:
 	 *   dp/dx=p_list[0]*dh1/dx+p_list[1]*dh2/dx+p_list[2]*dh3/dx+p_list[3]*dh4/dx+p_list[4]*dh5/dx+p_list[5]*dh6/dx;
@@ -1971,7 +2020,7 @@
 	/*Get dh1dh2dh3dh4dh5dh6_basic in basic coordinate system: */
 	GetNodalFunctionsDerivativesBasic(&dh1dh2dh3dh4dh5dh6_basic[0][0],xyz_list, gauss_l1l2l3l4);
-	
+
 	*(p+0)=p_list[0]*dh1dh2dh3dh4dh5dh6_basic[0][0]+p_list[1]*dh1dh2dh3dh4dh5dh6_basic[0][1]+p_list[2]*dh1dh2dh3dh4dh5dh6_basic[0][2]+p_list[3]*dh1dh2dh3dh4dh5dh6_basic[0][3]+p_list[4]*dh1dh2dh3dh4dh5dh6_basic[0][4]+p_list[5]*dh1dh2dh3dh4dh5dh6_basic[0][5];
-;
+	;
 	*(p+1)=p_list[0]*dh1dh2dh3dh4dh5dh6_basic[1][0]+p_list[1]*dh1dh2dh3dh4dh5dh6_basic[1][1]+p_list[2]*dh1dh2dh3dh4dh5dh6_basic[1][2]+p_list[3]*dh1dh2dh3dh4dh5dh6_basic[1][3]+p_list[4]*dh1dh2dh3dh4dh5dh6_basic[1][4]+p_list[5]*dh1dh2dh3dh4dh5dh6_basic[1][5];
 
@@ -1979,9 +2028,10 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta GetNodalFunctions {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetNodalFunctions"
 void Penta::GetNodalFunctions(double* l1l2l3l4l5l6, double* gauss_l1l2l3l4){
-	
+
 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
 
@@ -1989,5 +2039,5 @@
 
 	l1l2l3l4l5l6[1]=gauss_l1l2l3l4[1]*(1-gauss_l1l2l3l4[3])/2.0;
-	
+
 	l1l2l3l4l5l6[2]=gauss_l1l2l3l4[2]*(1-gauss_l1l2l3l4[3])/2.0;
 
@@ -1995,13 +2045,14 @@
 
 	l1l2l3l4l5l6[4]=gauss_l1l2l3l4[1]*(1+gauss_l1l2l3l4[3])/2.0;
-	
+
 	l1l2l3l4l5l6[5]=gauss_l1l2l3l4[2]*(1+gauss_l1l2l3l4[3])/2.0;
 
 }
-
+/*}}}*/
+/*FUNCTION Penta FieldExtrude {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::FieldExtrude"
 void  Penta::FieldExtrude(Vec field,double* field_serial,char* field_name, int iscollapsed){
-		
+
 	/* node data: */
 	const int    numgrids=6;
@@ -2044,7 +2095,7 @@
 			 * inserting the same field value into field, until we reach the surface: */
 			for(i=0;i<3;i++){
-		
+
 				node=nodes[i]; //base nodes
-		
+
 				/*get field for this base node: */
 				fieldel[0]=field_serial[doflist[numberofdofspernode*i+0]];
@@ -2096,10 +2147,10 @@
 		}
 		else if ( 
-				(strcmp(field_name,"thickness")==0) ||
-				(strcmp(field_name,"surface")==0)  ||
-				(strcmp(field_name,"bed")==0)  ||
-				(strcmp(field_name,"slopex")==0)  ||
-				(strcmp(field_name,"slopey")==0)
-				){
+					(strcmp(field_name,"thickness")==0) ||
+					(strcmp(field_name,"surface")==0)  ||
+					(strcmp(field_name,"bed")==0)  ||
+					(strcmp(field_name,"slopex")==0)  ||
+					(strcmp(field_name,"slopey")==0)
+				  ){
 
 			/* node data: */
@@ -2108,5 +2159,5 @@
 			int          nodedofs;
 			double       fieldel;
-				
+
 			GetDofList(&doflist[0],&numberofdofspernode);
 
@@ -2115,7 +2166,7 @@
 			 * inserting the same thickness value into tg, until we reach the surface: */
 			for(i=0;i<3;i++){
-		
+
 				node=nodes[i]; //base nodes
-		
+
 				/*get velocity for this base node: */
 				fieldel=field_serial[doflist[numberofdofspernode*i+0]];
@@ -2139,5 +2190,6 @@
 	} //if (extrude)
 }
-
+/*}}}*/
+/*FUNCTION Penta GetB_vert {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta:GetB_vert"
@@ -2146,5 +2198,5 @@
 
 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
-	where hi is the interpolation function for grid i.*/
+		where hi is the interpolation function for grid i.*/
 
 	int i;
@@ -2156,9 +2208,9 @@
 	GetNodalFunctionsDerivativesBasic(&dh1dh2dh3dh4dh5dh6_basic[0][0],xyz_list, gauss_l1l2l3l4);
 
-	#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<numgrids;i++){
 		printf("Node %i  dh/dx=%lf dh/dy=%lf dh/dz=%lf\n",i,dh1dh2dh3dh4dh5dh6_basic[0][i],dh1dh2dh3dh4dh5dh6_basic[1][i],dh1dh2dh3dh4dh5dh6_basic[2][i]);
 	}
-	#endif
+#endif
 
 	/*Build B: */
@@ -2166,8 +2218,8 @@
 		B[i]=dh1dh2dh3dh4dh5dh6_basic[2][i];  
 	}
-	
-}
-
-
+
+}
+/*}}}*/
+/*FUNCTION Penta GetBPrime_vert {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta:GetBPrime_vert"
@@ -2177,9 +2229,10 @@
 
 	int i;
-				
+
 	GetNodalFunctions(B, gauss_l1l2l3l4);
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorDiagnosticVert {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta:CreatePVectorDiagnosticVert"
@@ -2196,5 +2249,5 @@
 	int          doflist[numdof];
 	int          numberofdofspernode;
-	
+
 	/* gaussian points: */
 	int     num_gauss,ig;
@@ -2259,5 +2312,5 @@
 	/* recover input parameters: */
 	if(!inputs->Recover("velocity",&vx_list[0],1,dofs1,numgrids,(void**)nodes))throw ErrorException(__FUNCT__," cannot compute vertical velocity without horizontal velocity!");
-	    inputs->Recover("velocity",&vy_list[0],1,dofs2,numgrids,(void**)nodes);
+	inputs->Recover("velocity",&vy_list[0],1,dofs2,numgrids,(void**)nodes);
 
 	/*Get gaussian points and weights :*/
@@ -2266,5 +2319,5 @@
 
 	GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, &fourth_gauss_vert_coord,&vert_gauss_weights,order_area_gauss,num_vert_gauss);
-	#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<num_area_gauss;i++){
 		printf("Area Gauss coord %i: %lf %lf %lf Weight: %lf\n",i,*(first_gauss_area_coord+i),*(second_gauss_area_coord+i),*(third_gauss_area_coord+i),*(area_gauss_weights+i));
@@ -2273,20 +2326,20 @@
 		printf("Vert Gauss coord %i: %lf Weight: %lf\n",i,*(fourth_gauss_vert_coord+i),*(vert_gauss_weights+i));
 	}
-	#endif
+#endif
 
 	/* Start  looping on the number of gaussian points: */
 	for (ig1=0; ig1<num_area_gauss; ig1++){
 		for (ig2=0; ig2<num_vert_gauss; ig2++){
-		
+
 			/*Pick up the gaussian point: */
 			gauss_weight1=*(area_gauss_weights+ig1);
 			gauss_weight2=*(vert_gauss_weights+ig2);
 			gauss_weight=gauss_weight1*gauss_weight2;
-			
+
 			gauss_l1l2l3l4[0]=*(first_gauss_area_coord+ig1); 
 			gauss_l1l2l3l4[1]=*(second_gauss_area_coord+ig1);
 			gauss_l1l2l3l4[2]=*(third_gauss_area_coord+ig1);
 			gauss_l1l2l3l4[3]=*(fourth_gauss_vert_coord+ig2);
-	
+
 			/*Get velocity derivative, with respect to x and y: */
 			GetParameterDerivativeValue(&du[0], &vx_list[0],&xyz_list[0][0], gauss_l1l2l3l4);
@@ -2294,13 +2347,13 @@
 			dudx=du[0];
 			dvdy=dv[1];
-			
+
 
 			/* Get Jacobian determinant: */
 			GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_l1l2l3l4);
-			#ifdef _ISSM_DEBUG_ 
+#ifdef _ISSM_DEBUG_ 
 			printf("Element id %i Jacobian determinant: %lf\n",GetId(),Jdet);
-			#endif
-		
-			 /*Get nodal functions: */
+#endif
+
+			/*Get nodal functions: */
 			GetNodalFunctions(l1l2l3l4l5l6, gauss_l1l2l3l4);
 
@@ -2319,5 +2372,5 @@
 	VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
 
-	cleanup_and_return: 
+cleanup_and_return: 
 	xfree((void**)&first_gauss_area_coord);
 	xfree((void**)&second_gauss_area_coord);
@@ -2326,8 +2379,7 @@
 	xfree((void**)&area_gauss_weights);
 	xfree((void**)&vert_gauss_weights);
-
-
-}
-
+}
+/*}}}*/
+/*FUNCTION Penta ComputePressure {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::ComputePressure"
@@ -2343,8 +2395,8 @@
 	/*If on water, skip: */
 	if(onwater)return;
-		
+
 	/*Get node data: */
 	GetElementNodeData( &xyz_list[0][0], nodes, numgrids);
-        
+
 	/*pressure is lithostatic: */
 	//md.pressure=md.rho_ice*md.g*(md.surface-md.z); a la matlab
@@ -2359,11 +2411,11 @@
 		pressure[i]=rho_ice*g*(s[i]-xyz_list[i][2]);
 	}
-	
+
 	/*plug local pressure values into global pressure vector: */
 	VecSetValues(pg,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
 
 }
-
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixSlopeCompute {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreateKMatrixSlopeCompute"
@@ -2376,5 +2428,5 @@
 	/*If on water, skip: */
 	if(onwater)return;
-	
+
 	/*Is this element on the bed? :*/
 	if(!onbed)return;
@@ -2387,10 +2439,11 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorSlopeCompute {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVectorSlopeCompute"
 
 void Penta::CreatePVectorSlopeCompute( Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
-	
+
 	/*Collapsed formulation: */
 	Tria*  tria=NULL;
@@ -2398,5 +2451,5 @@
 	/*If on water, skip: */
 	if(onwater)return;
-	
+
 	/*Is this element on the bed? :*/
 	if(!onbed)return;
@@ -2408,5 +2461,6 @@
 	return;
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixPrognostic {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreateKMatrixPrognostic"
@@ -2419,5 +2473,5 @@
 	/*If on water, skip: */
 	if(onwater)return;
-	
+
 	/*Is this element on the bed? :*/
 	if(!onbed)return;
@@ -2430,10 +2484,11 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorPrognostic {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVectorPrognostic"
 
 void Penta::CreatePVectorPrognostic( Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
-	
+
 	/*Collapsed formulation: */
 	Tria*  tria=NULL;
@@ -2441,5 +2496,5 @@
 	/*If on water, skip: */
 	if(onwater)return;
-	
+
 	/*Is this element on the bed? :*/
 	if(!onbed)return;
@@ -2451,9 +2506,10 @@
 	return;
 }
-
+/*}}}*/
+/*FUNCTION Penta ReduceMatrixStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "ReduceMatrixStokes" 
 void Penta::ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp){
-		
+
 	int i,j;
 
@@ -2497,8 +2553,7 @@
 		}
 	}
-
-
-}
-
+}
+/*}}}*/
+/*FUNCTION Penta GetMatrixInvert {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "GetMatrixInvert"
@@ -2509,5 +2564,5 @@
 	double det;
 	int calculationdof=3;
-	
+
 	/*Take the matrix components: */
 	a=*(Ke+calculationdof*0+0);
@@ -2522,5 +2577,5 @@
 
 	det=a*(e*i-f*h)-b*(d*i-f*g)+c*(d*h-e*g);
-	
+
 	*(Ke_invert+calculationdof*0+0)=(e*i-f*h)/det;
 	*(Ke_invert+calculationdof*0+1)=(c*h-b*i)/det;
@@ -2534,8 +2589,8 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta SurfaceNormal {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::SurfaceNormal"
-
 void Penta::SurfaceNormal(double* surface_normal, double xyz_list[3][3]){
 
@@ -2562,5 +2617,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta GetStrainRateStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetStrainRateStokes"
@@ -2601,5 +2657,6 @@
 	MatrixMultiply( &B_reduced[0][0],6,DOFVELOCITY*numgrids, 0, velocity,DOFVELOCITY*numgrids,1,0,epsilon, 0);
 }
-
+/*}}}*/
+/*FUNCTION Penta GetBStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetBStokes"
@@ -2609,15 +2666,15 @@
 	 * For grid i, Bi can be expressed in the basic coordinate system
 	 * by: 				Bi_basic=[ dh/dx          0             0       0  ]
-		*					[   0           dh/dy           0       0  ]
-		*					[   0             0           dh/dy     0  ]
-		*					[ 1/2*dh/dy    1/2*dh/dx        0       0  ]
-		*					[ 1/2*dh/dz       0         1/2*dh/dx   0  ]
-		*					[   0          1/2*dh/dz    1/2*dh/dy   0  ]
-		*					[   0             0             0       h  ]
-		*					[ dh/dx         dh/dy         dh/dz     0  ]
-		*	where h is the interpolation function for grid i.
-		*	Same thing for Bb except the last column that does not exist.
-		*/
-	
+	 *					[   0           dh/dy           0       0  ]
+	 *					[   0             0           dh/dy     0  ]
+	 *					[ 1/2*dh/dy    1/2*dh/dx        0       0  ]
+	 *					[ 1/2*dh/dz       0         1/2*dh/dx   0  ]
+	 *					[   0          1/2*dh/dz    1/2*dh/dy   0  ]
+	 *					[   0             0             0       h  ]
+	 *					[ dh/dx         dh/dy         dh/dz     0  ]
+	 *	where h is the interpolation function for grid i.
+	 *	Same thing for Bb except the last column that does not exist.
+	 */
+
 	int i;
 	const int calculationdof=3;
@@ -2633,11 +2690,11 @@
 
 	GetNodalFunctions(l1l6, gauss_coord);
-	
-	#ifdef _ISSM_DEBUG_ 
+
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<7;i++){
 		printf("Node %i  dh/dx=%lf dh/dy=%lf dh/dz=%lf \n",i,dh1dh7_basic[0][i],dh1dh7_basic[1][i],dh1dh7_basic[2][i]);
 	}
 
-	#endif
+#endif
 
 	/*Build B: */
@@ -2681,5 +2738,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta GetBprimeStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetBprimeStokes"
@@ -2687,18 +2745,18 @@
 
 	/*	Compute B'  matrix. B'=[B1' B2' B3' B4' B5' B6' Bb'] where Bi' is of size 3*NDOF2. 
-	*	For grid i, Bi' can be expressed in the basic coordinate system
-	*	by: 
-	*				Bi_basic'=[ dh/dx   0          0       0]
-	*					 [   0      dh/dy      0       0]
-	*					 [   0      0         dh/dz    0]
-	*					 [  dh/dy   dh/dx      0       0]
-	*					 [  dh/dz   0        dh/dx     0]
-	*					 [   0      dh/dz    dh/dy     0]
-	*					 [  dh/dx   dh/dy    dh/dz     0]
-	*					 [   0      0          0       h]
-	*	where h is the interpolation function for grid i.
-	*
-	* 	Same thing for the bubble fonction except that there is no fourth column
-	*/
+	 *	For grid i, Bi' can be expressed in the basic coordinate system
+	 *	by: 
+	 *				Bi_basic'=[ dh/dx   0          0       0]
+	 *					 [   0      dh/dy      0       0]
+	 *					 [   0      0         dh/dz    0]
+	 *					 [  dh/dy   dh/dx      0       0]
+	 *					 [  dh/dz   0        dh/dx     0]
+	 *					 [   0      dh/dz    dh/dy     0]
+	 *					 [  dh/dx   dh/dy    dh/dz     0]
+	 *					 [   0      0          0       h]
+	 *	where h is the interpolation function for grid i.
+	 *
+	 * 	Same thing for the bubble fonction except that there is no fourth column
+	 */
 
 	int i;
@@ -2710,16 +2768,15 @@
 	double l1l6[numgrids];
 
-
 	/*Get dh1dh7 in basic coordinate system: */
 	GetNodalFunctionsDerivativesBasicStokes(&dh1dh7_basic[0][0],xyz_list, gauss_coord);
 
 	GetNodalFunctions(l1l6, gauss_coord);
-	
-	#ifdef _ISSM_DEBUG_ 
+
+#ifdef _ISSM_DEBUG_ 
 	for (i=0;i<6;i++){
 		printf("Node %i  dh/dx=%lf dh/dy=%lf dh/dz=%lf \n",i,dh1dh7_basic[0][i],dh1dh7_basic[1][i]);
 	}
 
-	#endif
+#endif
 
 	/*B_primeuild B_prime: */
@@ -2763,4 +2820,6 @@
 
 }
+/*}}}*/
+/*FUNCTION Penta GetLStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetLStokes"
@@ -2768,23 +2827,23 @@
 
 	/*
-	* Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
-	* For grid i, Li can be expressed in the basic coordinate system
-	* by: 
-	*       Li_basic=[ h    0    0   0]
-	*	 	 [ 0    h    0   0]
-	*		 [ 0    0    h   0]
-	*		 [ 0    0    h   0]
-	*	 	 [ h    0    0   0]
-	*	 	 [ 0    h    0   0]
-	*	 	 [ h    0    0   0]
-	*	 	 [ 0    h    0   0]
-	*		 [ 0    0    h   0]
-	*		 [ 0    0    h   0]
-	*		 [ 0    0    h   0]
-	*	 	 [ h    0    0   0]
-	*	 	 [ 0    h    0   0]
-	*		 [ 0    0    h   0]
-	* where h is the interpolation function for grid i.
-	*/
+	 * Compute L  matrix. L=[L1 L2 L3] where Li is square and of size numdof. 
+	 * For grid i, Li can be expressed in the basic coordinate system
+	 * by: 
+	 *       Li_basic=[ h    0    0   0]
+	 *	 	 [ 0    h    0   0]
+	 *		 [ 0    0    h   0]
+	 *		 [ 0    0    h   0]
+	 *	 	 [ h    0    0   0]
+	 *	 	 [ 0    h    0   0]
+	 *	 	 [ h    0    0   0]
+	 *	 	 [ 0    h    0   0]
+	 *		 [ 0    0    h   0]
+	 *		 [ 0    0    h   0]
+	 *		 [ 0    0    h   0]
+	 *	 	 [ h    0    0   0]
+	 *	 	 [ 0    h    0   0]
+	 *		 [ 0    0    h   0]
+	 * where h is the interpolation function for grid i.
+	 */
 
 	int i;
@@ -2799,11 +2858,11 @@
 	l1l2l3[1]=gauss_coord_tria[1];
 	l1l2l3[2]=gauss_coord_tria[2];
-	
-
-	#ifdef _DELUG_ 
+
+
+#ifdef _DELUG_ 
 	for (i=0;i<3;i++){
 		printf("Node %i  h=%lf \n",i,l1l2l3[i]);
 	}
-	#endif
+#endif
 
 	/*Build LStokes: */
@@ -2865,9 +2924,9 @@
 		*(LStokes+num_dof*numgrids2d*13+num_dof*i+2)=l1l2l3[i];
 		*(LStokes+num_dof*numgrids2d*13+num_dof*i+3)=0;
-	
-	}
-}
-
-
+
+	}
+}
+/*}}}*/
+/*FUNCTION Penta GetLprimeStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetLprimeStokes"
@@ -2875,23 +2934,23 @@
 
 	/*
-	* Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
-	* For grid i, Lpi can be expressed in the basic coordinate system
-	* by: 
-	*       Lpi_basic=[ h    0    0   0]
-	*		 [ 0    h    0   0]
-	*		 [ h    0    0   0]
-	*		 [ 0    h    0   0]
-	*		 [ 0    0    h   0]
-	*		 [ 0    0    h   0]
-	*		 [ 0    0  dh/dz 0]
-	*		 [ 0    0  dh/dz 0]
-	*		 [ 0    0  dh/dz 0]
-	*		 [dh/dz 0  dh/dx 0]
-	*		 [ 0 dh/dz dh/dy 0]
-	* 		 [ 0    0    0   h]
-	* 		 [ 0    0    0   h]
-	* 		 [ 0    0    0   h]
-	* where h is the interpolation function for grid i.
-	*/
+	 * Compute Lprime  matrix. Lprime=[Lp1 Lp2 Lp3] where Lpi is square and of size numdof. 
+	 * For grid i, Lpi can be expressed in the basic coordinate system
+	 * by: 
+	 *       Lpi_basic=[ h    0    0   0]
+	 *		 [ 0    h    0   0]
+	 *		 [ h    0    0   0]
+	 *		 [ 0    h    0   0]
+	 *		 [ 0    0    h   0]
+	 *		 [ 0    0    h   0]
+	 *		 [ 0    0  dh/dz 0]
+	 *		 [ 0    0  dh/dz 0]
+	 *		 [ 0    0  dh/dz 0]
+	 *		 [dh/dz 0  dh/dx 0]
+	 *		 [ 0 dh/dz dh/dy 0]
+	 * 		 [ 0    0    0   h]
+	 * 		 [ 0    0    0   h]
+	 * 		 [ 0    0    0   h]
+	 * where h is the interpolation function for grid i.
+	 */
 
 	int i;
@@ -2907,12 +2966,12 @@
 	l1l2l3[1]=gauss_coord_tria[1];
 	l1l2l3[2]=gauss_coord_tria[2];
-	
+
 	GetNodalFunctionsDerivativesBasic(&dh1dh6_basic[0][0],xyz_list,gauss_coord);
 
-	#ifdef _DELUG_ 
+#ifdef _DELUG_ 
 	for (i=0;i<3;i++){
 		printf("Node %i  h=%lf \n",i,l1l2l3[i]);
 	}
-	#endif
+#endif
 
 	/*Build LprimeStokes: */
@@ -2974,13 +3033,13 @@
 		*(LprimeStokes+num_dof*numgrids2d*13+num_dof*i+2)=0;
 		*(LprimeStokes+num_dof*numgrids2d*13+num_dof*i+3)=l1l2l3[i];
-	
-	}
-	
-}
-
+
+	}
+}
+/*}}}*/
+/*FUNCTION Penta GetNodalFunctionsDerivativesBasicStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetNodalFunctionsDerivativesBasicStokes"
 void Penta::GetNodalFunctionsDerivativesBasicStokes(double* dh1dh7_basic,double* xyz_list, double* gauss_coord){
-	
+
 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
 	 * basic coordinate system: */
@@ -3013,10 +3072,10 @@
 
 }
-
-
+/*}}}*/
+/*FUNCTION Penta GetNodalFunctionsDerivativesParamsStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetNodalFunctionsDerivativesParamsStokes"
 void Penta::GetNodalFunctionsDerivativesParamsStokes(double* dl1dl7,double* gauss_coord){
-	
+
 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
 	 * natural coordinate system) at the gaussian point. */
@@ -3065,5 +3124,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorDiagnosticStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVectorDiagnosticStokes"
@@ -3109,5 +3169,5 @@
 	int     area_order=5;
 	int	  num_vert_gauss=5;
-	
+
 	double  epsilon[6]; /* epsilon=[exx,eyy,ezz,exy,exz,eyz];*/
 	double  viscosity;
@@ -3132,5 +3192,5 @@
 	double     tBD[27][8];
 	double     P_terms[numdof];
-	
+
 	ParameterInputs* inputs=NULL;
 	Tria*            tria=NULL;
@@ -3160,8 +3220,8 @@
 
 	/* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore 
-	   get tria gaussian points as well as segment gaussian points. For tria gaussian 
-	   points, order of integration is 2, because we need to integrate the product tB*D*B' 
-	   which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
-	   points, same deal, which yields 3 gaussian points.*/
+		get tria gaussian points as well as segment gaussian points. For tria gaussian 
+		points, order of integration is 2, because we need to integrate the product tB*D*B' 
+		which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
+		points, same deal, which yields 3 gaussian points.*/
 
 	/* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
@@ -3183,5 +3243,5 @@
 			GetStrainRateStokes(&epsilon[0],&vxvyvz_list[0][0],&xyz_list[0][0],gauss_coord);
 			matice->GetViscosity3dStokes(&viscosity,&epsilon[0]);
-		
+
 			/* Get Jacobian determinant: */
 			GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss_coord);
@@ -3203,5 +3263,5 @@
 			GetBStokes(&B[0][0],&xyz_list[0][0],gauss_coord); 
 			GetBprimeStokes(&B_prime[0][0],&xyz_list[0][0], gauss_coord); 
-			
+
 			/*Get bubble part of Bprime */
 			for(i=0;i<8;i++){
@@ -3242,5 +3302,5 @@
 			}
 		}
-	
+
 		xfree((void**)&first_gauss_area_coord); xfree((void**)&second_gauss_area_coord); xfree((void**)&third_gauss_area_coord); xfree((void**)&area_gauss_weights);
 		GaussTria (&num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights, 2);
@@ -3253,5 +3313,5 @@
 			gauss_coord[2]=*(third_gauss_area_coord+igarea);
 			gauss_coord[3]=-1;
-			
+
 			gauss_coord_tria[0]=*(first_gauss_area_coord+igarea); 
 			gauss_coord_tria[1]=*(second_gauss_area_coord+igarea);
@@ -3260,5 +3320,5 @@
 			/*Get the Jacobian determinant */
 			tria->GetJacobianDeterminant3d(&Jdet2d, &xyz_list_tria[0][0], gauss_coord_tria);
-			
+
 			/* Get bed at gaussian point */
 			GetParameterValue(&bed,&b[0],gauss_coord);
@@ -3266,5 +3326,5 @@
 			/*Get L matrix : */
 			tria->GetL(&L[0], &xyz_list[0][0], gauss_coord_tria,1);
-				
+
 			/*Get water_pressure at gaussian point */
 			water_pressure=gravity*rho_water*bed;
@@ -3272,5 +3332,5 @@
 			/*Get normal vecyor to the bed */
 			SurfaceNormal(&surface_normal[0],xyz_list_tria);
-			
+
 			bed_normal[0]=-surface_normal[0]; //Program is for surface, so the normal to the bed is the opposite of the result
 			bed_normal[1]=-surface_normal[1];
@@ -3284,5 +3344,5 @@
 		}
 	} //if ( (onbed==1) && (shelf==1))
-	
+
 	/*Reduce the matrix */
 	ReduceVectorStokes(&Pe_reduced[0], &Ke_temp[0][0], &Pe_temp[0]);
@@ -3304,9 +3364,10 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta ReduceVectorStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::ReduceVectorStokes" 
 void Penta::ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp){
-		
+
 	int i,j;
 
@@ -3347,9 +3408,10 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetNodalFunctionsStokes {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetNodalFunctionsStokes" 
 void Penta::GetNodalFunctionsStokes(double* l1l7, double* gauss_coord){
-	
+
 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
 
@@ -3376,9 +3438,10 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixThermal {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreateKMatrixThermal"
 void  Penta::CreateKMatrixThermal(Mat Kgg,void* vinputs,int analysis_type,int sub_analysis_type){
-	
+
 	/* local declarations */
 	int i,j;
@@ -3466,5 +3529,5 @@
 	GetElementNodeData( &xyz_list[0][0], nodes, numgrids);
 	GetDofList(&doflist[0],&numberofdofspernode);
-	
+
 	// /*recovre material parameters: */
 	rho_water=matpar->GetRhoWater();
@@ -3473,5 +3536,5 @@
 	heatcapacity=matpar->GetHeatCapacity();
 	thermalconductivity=matpar->GetThermalConductivity();
-		
+
 	/*recover extra inputs from users, dt and velocity: */
 	found=inputs->Recover("velocity",&vxvyvz_list[0][0],3,dofs,numgrids,(void**)nodes);
@@ -3488,9 +3551,9 @@
 
 	/* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore 
-	   get tria gaussian points as well as segment gaussian points. For tria gaussian 
-	   points, order of integration is 2, because we need to integrate the product tB*D*B' 
-	   which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
-	   points, same deal, which yields 3 gaussian points.: */
-	
+		get tria gaussian points as well as segment gaussian points. For tria gaussian 
+		points, order of integration is 2, because we need to integrate the product tB*D*B' 
+		which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
+		points, same deal, which yields 3 gaussian points.: */
+
 	/*Get gaussian points: */
 	area_order=2;
@@ -3601,5 +3664,5 @@
 				}
 			}
-					
+
 			/*Add Ke_gaussian to pKe: */
 			for(i=0;i<numdof;i++){
@@ -3615,5 +3678,5 @@
 	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)K_terms,ADD_VALUES);
 
-	cleanup_and_return: 
+cleanup_and_return: 
 	xfree((void**)&first_gauss_area_coord);
 	xfree((void**)&second_gauss_area_coord);
@@ -3622,5 +3685,5 @@
 	xfree((void**)&vert_gauss_weights);
 	xfree((void**)&vert_gauss_coord);
-	
+
 	//Ice/ocean heat exchange flux on ice shelf base 
 	if(onbed && shelf){
@@ -3631,5 +3694,6 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetB_conduct {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetB_conduct"
@@ -3646,5 +3710,5 @@
 	 * We assume B has been allocated already, of size: 3x(DOFPERGRID*numgrids)
 	 */
-	
+
 	int i;
 	const int calculationdof=3;
@@ -3665,5 +3729,6 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetB_artdiff {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetB_artdiff"
@@ -3697,5 +3762,6 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetB_advec {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetB_advec"
@@ -3712,5 +3778,5 @@
 	 * We assume B has been allocated already, of size: 3x(DOFPERGRID*numgrids)
 	 */
-	
+
 	int i;
 	int calculationdof=3;
@@ -3731,5 +3797,6 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta GetBprime_advec {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetBprime_advec"
@@ -3747,5 +3814,5 @@
 	 * We assume B has been allocated already, of size: 3x(DOFPERGRID*numgrids)
 	 */
-	
+
 	int i;
 	const int calculationdof=3;
@@ -3766,11 +3833,12 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta CreateKMatrixMelting {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreateKMatrixMelting"
 void  Penta::CreateKMatrixMelting(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
-	
+
 	Tria* tria=NULL;
-	
+
 	/*If on water, skip: */
 	if(onwater)return;
@@ -3780,5 +3848,5 @@
 	}
 	else{
-		
+
 		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
 		tria->CreateKMatrixMelting(Kgg,inputs, analysis_type,sub_analysis_type);
@@ -3787,5 +3855,6 @@
 	}
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorThermal {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVectorThermal"
@@ -3805,5 +3874,5 @@
 	/*Grid data: */
 	double        xyz_list[numgrids][3];
-	
+
 	/* gaussian points: */
 	int     num_area_gauss,igarea,igvert;
@@ -3818,5 +3887,5 @@
 	int     area_order=2;
 	int	  num_vert_gauss=3;
-	
+
 	double dt;
 	double vx_list[numgrids];
@@ -3834,5 +3903,5 @@
 	/* element parameters: */
 	int    friction_type;
-	
+
 	int    dofs[3]={0,1,2};
 	int    dofs1[1]={0};
@@ -3872,5 +3941,5 @@
 	GetElementNodeData( &xyz_list[0][0], nodes, numgrids);
 	GetDofList(&doflist[0],&numberofdofspernode);
-	
+
 	/*recovre material parameters: */
 	rho_water=matpar->GetRhoWater();
@@ -3891,5 +3960,5 @@
 		if(!found)throw ErrorException(__FUNCT__," could not find temperature in inputs!");
 	}
-	
+
 	for(i=0;i<numgrids;i++){
 		vx_list[i]=vxvyvz_list[i][0];
@@ -3899,9 +3968,9 @@
 
 	/* Get gaussian points and weights. Penta is an extrusion of a Tria, we therefore 
-	   get tria gaussian points as well as segment gaussian points. For tria gaussian 
-	   points, order of integration is 2, because we need to integrate the product tB*D*B' 
-	   which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
-	   points, same deal, which yields 3 gaussian points.: */
-	
+		get tria gaussian points as well as segment gaussian points. For tria gaussian 
+		points, order of integration is 2, because we need to integrate the product tB*D*B' 
+		which is a polynomial of degree 3 (see GaussTria for more details). For segment gaussian 
+		points, same deal, which yields 3 gaussian points.: */
+
 	/*Get gaussian points: */
 	GaussPenta( &num_area_gauss, &first_gauss_area_coord, &second_gauss_area_coord, &third_gauss_area_coord, &area_gauss_weights,&vert_gauss_coord, &vert_gauss_weights, area_order, num_vert_gauss);
@@ -3918,5 +3987,5 @@
 			gauss_coord[2]=*(third_gauss_area_coord+igarea);
 			gauss_coord[3]=*(vert_gauss_coord+igvert);
-	
+
 			/*Compute strain rate and viscosity: */
 			GetStrainRateStokes(&epsilon[0],&vxvyvz_list[0][0],&xyz_list[0][0],gauss_coord);
@@ -3973,5 +4042,5 @@
 	extern int my_rank;
 
-	cleanup_and_return:
+cleanup_and_return:
 	xfree((void**)&first_gauss_area_coord);
 	xfree((void**)&second_gauss_area_coord);
@@ -3982,5 +4051,6 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Penta CreatePVectorMelting {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::CreatePVectorMelting"
@@ -3988,5 +4058,6 @@
 	return;
 }
-
+/*}}}*/
+/*FUNCTION Penta GetPhi {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::GetPhi"
@@ -4023,6 +4094,6 @@
 	*phi=2*pow(epsilon_eff,2.0)*viscosity;
 }
-
-
+/*}}}*/
+/*FUNCTION Penta MassFlux {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::MassFlux"
@@ -4030,2 +4101,3 @@
 	throw ErrorException(__FUNCT__," not supported yet!");
 }
+/*}}}*/
Index: /issm/trunk/src/c/objects/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Tria.cpp	(revision 2710)
+++ /issm/trunk/src/c/objects/Tria.cpp	(revision 2711)
@@ -1973,14 +1973,16 @@
 	*(J+NDOF2*1+1)=sqrt3/6.0*(2*y3-y1-y2);
 }
-
+/*}}}*/
+/*FUNCTION GetMatPar {{{1*/
 void* Tria::GetMatPar(){
 	return matpar;
 }
-
+/*}}}*/
+/*FUNCTION GetShelf {{{1*/
 int   Tria::GetShelf(){
 	return shelf;
 }
-
-		
+/*}}}*/
+/*FUNCTION GetNodes {{{1*/
 void  Tria::GetNodes(void** vpnodes){
 	int i;
@@ -1991,16 +1993,19 @@
 	}
 }
-		
-
+/*}}}*/
+/*FUNCTION GetOnBed {{{1*/
 int Tria::GetOnBed(){
 	return onbed;
 }
-
-void          Tria::GetThicknessList(double* thickness_list){
+/*}}}*/
+/*FUNCTION GetThicknessList {{{1*/
+void Tria::GetThicknessList(double* thickness_list){
 
 	int i;
 	for(i=0;i<3;i++)thickness_list[i]=h[i];
 }
-void          Tria::GetBedList(double* bed_list){
+/*}}}*/
+/*FUNCTION GetBedList {{{1*/
+void  Tria::GetBedList(double* bed_list){
 	
 	int i;
@@ -2008,6 +2013,6 @@
 
 }
-  
-
+/*}}}*/
+/*FUNCTION copy {{{1*/
 Object* Tria::copy() {
 	
