Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4834)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4835)
@@ -378,23 +378,23 @@
 	}
 	else if (analysis_type==BedSlopeXAnalysisEnum){
-		InputUpdateFromBedSlopeX( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,BedSlopeXEnum);
 	}
 	else if (analysis_type==BedSlopeYAnalysisEnum){
-		InputUpdateFromBedSlopeY( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,BedSlopeYEnum);
 	}
 	else if (analysis_type==SurfaceSlopeXAnalysisEnum){
-		InputUpdateFromSurfaceSlopeX( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,SurfaceSlopeXEnum);
 	}
 	else if (analysis_type==SurfaceSlopeYAnalysisEnum){
-		InputUpdateFromSurfaceSlopeY( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,SurfaceSlopeYEnum);
 	}
 	else if (analysis_type==PrognosticAnalysisEnum){
-		InputUpdateFromSolutionPrognostic( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,ThicknessEnum);
 	}
 	else if (analysis_type==BalancedthicknessAnalysisEnum){
-		InputUpdateFromSolutionBalancedthickness( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,ThicknessEnum);
 	}
 	else if (analysis_type==BalancedvelocitiesAnalysisEnum){
-		InputUpdateFromSolutionBalancedvelocities( solution);
+		InputUpdateFromSolutionOneDofCollapsed(solution,VelEnum);
 	}
 	else if (analysis_type==ThermalAnalysisEnum){
@@ -402,5 +402,5 @@
 	}
 	else if (analysis_type==MeltingAnalysisEnum){
-		InputUpdateFromSolutionMelting( solution);
+		InputUpdateFromSolutionOneDof(solution,MeltingRateEnum);
 	}
 	else{
@@ -2136,4 +2136,5 @@
 	if (collapsed){
 		if (!onbed){
+			/*Do nothing. Element on bed will take care of it*/
 			return;
 		}
@@ -2171,6 +2172,6 @@
 	double       gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
 
-	Input  *VzInput        = NULL;
-	double *VzPtr          = NULL;
+	Input  *vz_input        = NULL;
+	double *vz_ptr          = NULL;
 	Penta  *penta          = NULL;
 
@@ -2205,9 +2206,9 @@
 
 		/*Now Compute vel*/
-		VzInput=inputs->GetInput(VzEnum);
-		if (VzInput){
-			if (VzInput->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(VzInput->Enum()));
-			VzInput->GetValuesPtr(&VzPtr,&dummy);
-			for(i=0;i<numvertices;i++) vz[i]=VzPtr[i];
+		vz_input=inputs->GetInput(VzEnum);
+		if (vz_input){
+			if (vz_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(vz_input->Enum()));
+			vz_input->GetValuesPtr(&vz_ptr,&dummy);
+			for(i=0;i<numvertices;i++) vz[i]=vz_ptr[i];
 		}
 		else{for(i=0;i<numvertices;i++) vz[i]=0.0;}
@@ -2262,6 +2263,6 @@
 	double       gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
 	
-	Input  *VzInput        = NULL;
-	double *VzPtr          = NULL;
+	Input  *vz_input        = NULL;
+	double *vz_ptr          = NULL;
 
 	/*Get dof list: */
@@ -2283,11 +2284,11 @@
 
 	/*Get Vz*/
-	VzInput=inputs->GetInput(VzEnum);
-	if (VzInput){
-		if (VzInput->Enum()!=PentaVertexInputEnum){
-			ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(VzInput->Enum()));
+	vz_input=inputs->GetInput(VzEnum);
+	if (vz_input){
+		if (vz_input->Enum()!=PentaVertexInputEnum){
+			ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(vz_input->Enum()));
 		}
-		VzInput->GetValuesPtr(&VzPtr,&dummy);
-		for(i=0;i<numvertices;i++) vz[i]=VzPtr[i];
+		vz_input->GetValuesPtr(&vz_ptr,&dummy);
+		for(i=0;i<numvertices;i++) vz[i]=vz_ptr[i];
 	}
 	else{
@@ -2343,6 +2344,6 @@
 	double       gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
 	
-	Input*       VzInput=NULL;
-	double*      VzPtr=NULL;
+	Input*       vz_input=NULL;
+	double*      vz_ptr=NULL;
 
 	/*Get dof list: */
@@ -2364,11 +2365,11 @@
 
 	/*Get Vz*/
-	VzInput=inputs->GetInput(VzEnum);
-	if (VzInput){
-		if (VzInput->Enum()!=PentaVertexInputEnum){
-			ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(VzInput->Enum()));
+	vz_input=inputs->GetInput(VzEnum);
+	if (vz_input){
+		if (vz_input->Enum()!=PentaVertexInputEnum){
+			ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumAsString(vz_input->Enum()));
 		}
-		VzInput->GetValuesPtr(&VzPtr,&dummy);
-		for(i=0;i<numvertices;i++) vz[i]=VzPtr[i];
+		vz_input->GetValuesPtr(&vz_ptr,&dummy);
+		for(i=0;i<numvertices;i++) vz[i]=vz_ptr[i];
 	}
 	else{
@@ -2424,8 +2425,8 @@
 	double       gauss[numvertices][4]={{1,0,0,-1},{0,1,0,-1},{0,0,1,-1},{1,0,0,1},{0,1,0,1},{0,0,1,1}};
 
-	Input*       VxInput=NULL;
-	double*      VxPtr=NULL;
-	Input*       VyInput=NULL;
-	double*      VyPtr=NULL;
+	Input*       vx_input=NULL;
+	double*      vx_ptr=NULL;
+	Input*       vy_input=NULL;
+	double*      vy_ptr=NULL;
 
 	/*Get dof list: */
@@ -2446,17 +2447,17 @@
 
 	/*Get Vx and Vy*/
-	VxInput=inputs->GetInput(VxEnum);
-	if (VxInput){
-		if (VxInput->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vx is of type %s",EnumAsString(VxInput->Enum()));
-		VxInput->GetValuesPtr(&VxPtr,&dummy);
-		for(i=0;i<numvertices;i++) vx[i]=VxPtr[i];
+	vx_input=inputs->GetInput(VxEnum);
+	if (vx_input){
+		if (vx_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vx is of type %s",EnumAsString(vx_input->Enum()));
+		vx_input->GetValuesPtr(&vx_ptr,&dummy);
+		for(i=0;i<numvertices;i++) vx[i]=vx_ptr[i];
 	}
 	else for(i=0;i<numvertices;i++) vx[i]=0.0;
 
-	VyInput=inputs->GetInput(VyEnum);
-	if (VyInput){
-		if (VyInput->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vy is of type %s",EnumAsString(VyInput->Enum()));
-		VyInput->GetValuesPtr(&VyPtr,&dummy);
-		for(i=0;i<numvertices;i++) vy[i]=VyPtr[i];
+	vy_input=inputs->GetInput(VyEnum);
+	if (vy_input){
+		if (vy_input->Enum()!=PentaVertexInputEnum) ISSMERROR("Cannot compute Vel as Vy is of type %s",EnumAsString(vy_input->Enum()));
+		vy_input->GetValuesPtr(&vy_ptr,&dummy);
+		for(i=0;i<numvertices;i++) vy[i]=vy_ptr[i];
 	}
 	else for(i=0;i<numvertices;i++) vy[i]=0.0;
@@ -2543,108 +2544,4 @@
 
 /*}}}*/
-/*FUNCTION Penta::InputUpdateFromBedSlopeX{{{1*/
-void  Penta::InputUpdateFromBedSlopeX(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add bedslopex as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(BedSlopeXEnum,values));
-}
-/*}}}*/
-/*FUNCTION Penta::InputUpdateFromBedSlopeY{{{1*/
-void  Penta::InputUpdateFromBedSlopeY(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add bedslopey as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(BedSlopeYEnum,values));
-}
-/*}}}*/
-/*FUNCTION Penta::InputUpdateFromSurfaceSlopeX{{{1*/
-void  Penta::InputUpdateFromSurfaceSlopeX(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add surfaceslopex as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(SurfaceSlopeXEnum,values));
-}
-/*}}}*/
-/*FUNCTION Penta::InputUpdateFromSurfaceSlopeY{{{1*/
-void  Penta::InputUpdateFromSurfaceSlopeY(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add surfaceslopey as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(SurfaceSlopeYEnum,values));
-}
-/*}}}*/
 /*FUNCTION Penta::InputUpdateFromSolutionAdjointStokes {{{1*/
 void  Penta::InputUpdateFromSolutionAdjointStokes(double* solution){
@@ -2725,61 +2622,4 @@
 }
 /*}}}*/
-/*FUNCTION Penta::InputUpdateFromSolutionPrognostic {{{1*/
-void  Penta::InputUpdateFromSolutionPrognostic(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add thickness as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(ThicknessEnum,values));
-}
-/*}}}*/
-/*FUNCTION Penta::InputUpdateFromSolutionBalancedthickness {{{1*/
-void  Penta::InputUpdateFromSolutionBalancedthickness(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add thickness as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(ThicknessEnum,values));
-}
-/*}}}*/
-/*FUNCTION Penta::InputUpdateFromSolutionBalancedvelocities {{{1*/
-void  Penta::InputUpdateFromSolutionBalancedvelocities(double* solution){
-	ISSMERROR(" not supported yet!");
-}
-/*}}}*/
 /*FUNCTION Penta::InputUpdateFromSolutionThermal {{{1*/
 void  Penta::InputUpdateFromSolutionThermal(double* solution){
@@ -2822,17 +2662,13 @@
 }
 /*}}}*/
-/*FUNCTION Penta::InputUpdateFromSolutionMelting {{{1*/
-void  Penta::InputUpdateFromSolutionMelting(double* solution){
-
-	int i;
-
-	const int    numvertices=6;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
+/*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{1*/
+void  Penta::InputUpdateFromSolutionOneDof(double* solution,int enum_type){
+
+	const int numvertices     = 6;
+	const int numdofpervertex = 1;
+	const int numdof          = numdofpervertex *numvertices;
+	int       doflist[numdof];
+	double    values[numdof];
+	int       dummy;
 
 	/*Get dof list: */
@@ -2840,10 +2676,53 @@
 
 	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
+	for(int i=0;i<numdof;i++){
 		values[i]=solution[doflist[i]];
 	}
 
-	/*Add thickness as inputs to the tria element: */
-	this->inputs->AddInput(new PentaVertexInput(MeltingRateEnum,values));
+	/*Add input to the element: */
+	this->inputs->AddInput(new PentaVertexInput(enum_type,values));
+}
+/*}}}*/
+/*FUNCTION Penta::InputUpdateFromSolutionOneDofCollpased{{{1*/
+void  Penta::InputUpdateFromSolutionOneDofCollapsed(double* solution,int enum_type){
+
+	const int  numvertices     = 6;
+	const int  numdofpervertex = 1;
+	const int  numdof          = numdofpervertex *numvertices;
+	const int  numdof2d        = numdof/2;
+	int        doflist[numdof];
+	double     values[numdof];
+	int        dummy;
+	Penta     *penta           = NULL;
+	bool       onbed;
+
+	/*Recover inputs*/
+	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
+
+	/*If not on bed, return*/
+	if (!onbed) return;
+
+	/*Get dof list: */
+	GetDofList(&doflist[0],&dummy);
+
+	/*Use the dof list to index into the solution vector and extrude it */
+	for(int i=0;i<numdof2d;i++){
+		values[i]         =solution[doflist[i]];
+		values[i+numdof2d]=values[i];
+	}
+
+	/*Start looping over all elements above current element and update all inputs*/
+	penta=this;
+	for(;;){
+
+		/*Add input to the element: */
+		penta->inputs->AddInput(new PentaVertexInput(enum_type,values));
+
+		/*Stop if we have reached the surface*/
+		if (penta->IsOnSurface()) break;
+
+		/* get upper Penta*/
+		penta=penta->GetUpperElement(); ISSMASSERT(penta->Id()!=this->id);
+	}
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 4834)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 4835)
@@ -174,6 +174,4 @@
 		void    InputUpdateFromSolutionAdjointHoriz( double* solutiong);
 		void    InputUpdateFromSolutionAdjointStokes( double* solutiong);
-		void    InputUpdateFromSolutionBalancedthickness( double* solutiong);
-		void    InputUpdateFromSolutionBalancedvelocities( double* solutiong);
 		void    InputUpdateFromSolutionDiagnosticHoriz( double* solutiong);
 		void    InputUpdateFromSolutionDiagnosticMacAyeal( double* solutiong);
@@ -182,11 +180,7 @@
 		void    InputUpdateFromSolutionDiagnosticVert( double* solutiong);
 		void    InputUpdateFromSolutionDiagnosticStokes( double* solutiong);
-		void    InputUpdateFromSolutionPrognostic( double* solutiong);
-		void    InputUpdateFromBedSlopeX( double* solutiong);
-		void    InputUpdateFromBedSlopeY( double* solutiong);
-		void    InputUpdateFromSurfaceSlopeX( double* solutiong);
-		void    InputUpdateFromSurfaceSlopeY( double* solutiong);
 		void    InputUpdateFromSolutionThermal( double* solutiong);
-		void    InputUpdateFromSolutionMelting( double* solutiong);
+		void    InputUpdateFromSolutionOneDof(double* solutiong,int enum_type);
+		void    InputUpdateFromSolutionOneDofCollapsed(double* solutiong,int enum_type);
 		bool	  IsInput(int name);
 		bool	  IsOnSurface(void);
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4834)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4835)
@@ -377,23 +377,23 @@
 	}
 	else if (analysis_type==BedSlopeXAnalysisEnum){
-		InputUpdateFromSolutionBedSlopeX( solution);
+		InputUpdateFromSolutionOneDof(solution,BedSlopeXEnum);
 	}
 	else if (analysis_type==BedSlopeYAnalysisEnum){
-		InputUpdateFromSolutionBedSlopeY( solution);
+		InputUpdateFromSolutionOneDof(solution,BedSlopeYEnum);
 	}
 	else if (analysis_type==SurfaceSlopeXAnalysisEnum){
-		InputUpdateFromSolutionSurfaceSlopeX( solution);
+		InputUpdateFromSolutionOneDof(solution,SurfaceSlopeXEnum);
 	}
 	else if (analysis_type==SurfaceSlopeYAnalysisEnum){
-		InputUpdateFromSolutionSurfaceSlopeY( solution);
+		InputUpdateFromSolutionOneDof(solution,SurfaceSlopeYEnum);
 	}
 	else if (analysis_type==PrognosticAnalysisEnum){
-		InputUpdateFromSolutionPrognostic( solution);
+		InputUpdateFromSolutionOneDof(solution,ThicknessEnum);
 	}
 	else if (analysis_type==BalancedthicknessAnalysisEnum){
-		InputUpdateFromSolutionBalancedthickness( solution);
+		InputUpdateFromSolutionOneDof(solution,ThicknessEnum);
 	}
 	else if (analysis_type==BalancedvelocitiesAnalysisEnum){
-		InputUpdateFromSolutionBalancedvelocities( solution);
+		InputUpdateFromSolutionOneDof(solution,VelEnum);
 	}
 	else{
@@ -5551,17 +5551,13 @@
 }
 /*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionBedSlopeX {{{1*/
-void  Tria::InputUpdateFromSolutionBedSlopeX(double* solution){
-
-	int i;
-
-	const int    numvertices=3;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
+/*FUNCTION Tria::InputUpdateFromSolutionOneDof{{{1*/
+void  Tria::InputUpdateFromSolutionOneDof(double* solution,int enum_type){
+
+	const int numvertices     = 3;
+	const int numdofpervertex = 1;
+	const int numdof          = numdofpervertex *numvertices;
+	int       doflist[numdof];
+	double    values[numdof];
+	int       dummy;
 
 	/*Get dof list: */
@@ -5569,146 +5565,10 @@
 
 	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
+	for(int i=0;i<numdof;i++){
 		values[i]=solution[doflist[i]];
 	}
 
-	/*Add slopex as inputs to the tria element: */
-	this->inputs->AddInput(new TriaVertexInput(BedSlopeXEnum,values));
-}
-/*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionBedSlopeX {{{1*/
-void  Tria::InputUpdateFromSolutionBedSlopeY(double* solution){
-
-	int i;
-
-	const int    numvertices=3;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add slopex as inputs to the tria element: */
-	this->inputs->AddInput(new TriaVertexInput(BedSlopeYEnum,values));
-}
-/*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionSurfaceSlopeX {{{1*/
-void  Tria::InputUpdateFromSolutionSurfaceSlopeX(double* solution){
-
-	int i;
-
-	const int    numvertices=3;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add slopex as inputs to the tria element: */
-	this->inputs->AddInput(new TriaVertexInput(SurfaceSlopeXEnum,values));
-}
-/*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionSurfaceSlopeY {{{1*/
-void  Tria::InputUpdateFromSolutionSurfaceSlopeY(double* solution){
-
-	int i;
-
-	const int    numvertices=3;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add slopex as inputs to the tria element: */
-	this->inputs->AddInput(new TriaVertexInput(SurfaceSlopeYEnum,values));
-}
-/*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionPrognostic {{{1*/
-void  Tria::InputUpdateFromSolutionPrognostic(double* solution){
-
-	int i;
-
-	const int    numvertices=3;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add thickness as inputs to the tria element: */
-	this->inputs->AddInput(new TriaVertexInput(ThicknessEnum,values));
-}
-/*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionBalancedthickness {{{1*/
-void  Tria::InputUpdateFromSolutionBalancedthickness(double* solution){
-
-	int i;
-
-	const int    numvertices=3;
-	const int    numdofpervertex=1;
-	const int    numdof=numdofpervertex*numvertices;
-
-	int          doflist[numdof];
-	double       values[numdof];
-	double       thickness[numvertices];
-
-	int          dummy;
-
-	/*Get dof list: */
-	GetDofList(&doflist[0],&dummy);
-
-	/*Use the dof list to index into the solution vector: */
-	for(i=0;i<numdof;i++){
-		values[i]=solution[doflist[i]];
-	}
-
-	/*Add thickness as inputs to the tria element: */
-	this->inputs->AddInput(new TriaVertexInput(ThicknessEnum,values));
-}
-/*}}}*/
-/*FUNCTION Tria::InputUpdateFromSolutionBalancedvelocities {{{1*/
-void  Tria::InputUpdateFromSolutionBalancedvelocities(double* solution){
-	ISSMERROR(" not supported yet!");
+	/*Add input to the element: */
+	this->inputs->AddInput(new TriaVertexInput(enum_type,values));
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 4834)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 4835)
@@ -151,11 +151,5 @@
 		void	  InputUpdateFromSolutionDiagnosticHoriz( double* solution);
 		void	  InputUpdateFromSolutionDiagnosticHutter( double* solution);
-		void	  InputUpdateFromSolutionBedSlopeX( double* solution);
-		void	  InputUpdateFromSolutionBedSlopeY( double* solution);
-		void	  InputUpdateFromSolutionSurfaceSlopeX( double* solution);
-		void	  InputUpdateFromSolutionSurfaceSlopeY( double* solution);
-		void	  InputUpdateFromSolutionPrognostic( double* solution);
-		void	  InputUpdateFromSolutionBalancedthickness( double* solution);
-		void	  InputUpdateFromSolutionBalancedvelocities( double* solution);
+		void	  InputUpdateFromSolutionOneDof(double* solution,int enum_type);
 		bool	  IsInput(int name);
 		void	  SetClone(int* minranks);
Index: /issm/trunk/src/c/solutions/balancedthickness_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/balancedthickness_core.cpp	(revision 4834)
+++ /issm/trunk/src/c/solutions/balancedthickness_core.cpp	(revision 4835)
@@ -34,7 +34,4 @@
 	solver_linear(NULL,femmodel);
 
-	_printf_("extrude computed thickness on all layers:\n");
-	InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,ThicknessEnum);
-
 	if(verbose)_printf_("saving results:\n");
 	if(solution_type==BalancedthicknessSolutionEnum){
Index: /issm/trunk/src/c/solutions/balancedvelocities_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/balancedvelocities_core.cpp	(revision 4834)
+++ /issm/trunk/src/c/solutions/balancedvelocities_core.cpp	(revision 4835)
@@ -34,8 +34,4 @@
 	solver_linear(NULL,femmodel);
 
-	_printf_("extrude computed velocity on all layers:\n");
-	InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,VxEnum);
-	InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,VyEnum);
-
 	if(verbose)_printf_("saving results:\n");
 	if(solution_type==BalancedvelocitiesSolutionEnum){
Index: /issm/trunk/src/c/solutions/bedslope_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/bedslope_core.cpp	(revision 4834)
+++ /issm/trunk/src/c/solutions/bedslope_core.cpp	(revision 4835)
@@ -32,11 +32,4 @@
 	solver_linear(NULL,femmodel);
 	
-	/*extrude inputs if we are in 3D: */
-	if (dim==3){
-		if(verbose)_printf_("%s\n","extruding bed in 3d...");
-		InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,BedSlopeXEnum);
-		InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,BedSlopeYEnum);
-	}
-	
 	if(verbose)_printf_("saving results:\n");
 	if(solution_type==BedSlopeSolutionEnum){
Index: /issm/trunk/src/c/solutions/prognostic_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/prognostic_core.cpp	(revision 4834)
+++ /issm/trunk/src/c/solutions/prognostic_core.cpp	(revision 4835)
@@ -31,7 +31,4 @@
 	solver_linear(NULL,femmodel);
 		
-	_printf_("extrude computed thickness on all layers:\n");
-	InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,ThicknessEnum);
-
 	if(verbose)_printf_("saving results:\n");
 	if(solution_type==PrognosticSolutionEnum){
Index: /issm/trunk/src/c/solutions/surfaceslope_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/surfaceslope_core.cpp	(revision 4834)
+++ /issm/trunk/src/c/solutions/surfaceslope_core.cpp	(revision 4835)
@@ -32,11 +32,4 @@
 	solver_linear(NULL,femmodel);
 	
-	/*extrude inputs if we are in 3D: */
-	if (dim==3){
-		if(verbose)_printf_("%s\n","extruding slope in 3d...");
-		InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,SurfaceSlopeXEnum);
-		InputExtrudex(femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials,femmodel->parameters,SurfaceSlopeYEnum);
-	}
-	
 	if(verbose)_printf_("saving results:\n");
 	if(solution_type==SurfaceSlopeSolutionEnum){
Index: /issm/trunk/src/m/solutions/balancedthickness_core.m
===================================================================
--- /issm/trunk/src/m/solutions/balancedthickness_core.m	(revision 4834)
+++ /issm/trunk/src/m/solutions/balancedthickness_core.m	(revision 4835)
@@ -19,7 +19,4 @@
 	displaystring(verbose,'\n%s',['call computational core...']);
 	femmodel=solver_linear(femmodel);
-	
-	displaystring(verbose,'\n%s',['extude computed thickness on all layers...']);
-	femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,ThicknessEnum);
 
 	if solution_type==BalancedthicknessSolutionEnum,
Index: /issm/trunk/src/m/solutions/balancedvelocities_core.m
===================================================================
--- /issm/trunk/src/m/solutions/balancedvelocities_core.m	(revision 4834)
+++ /issm/trunk/src/m/solutions/balancedvelocities_core.m	(revision 4835)
@@ -23,8 +23,4 @@
 	femmodel=solver_linear(femmodel);
 	
-	displaystring(verbose,'\n%s',['extude computed thickness on all layers...']);
-	femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VxEnum);
-	femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VyEnum);
-
 	if solution_type==BalancedvelocitiesSolutionEnum,
 		displaystring(verbose,'\n%s',['saving results...']);
Index: /issm/trunk/src/m/solutions/bedslope_core.m
===================================================================
--- /issm/trunk/src/m/solutions/bedslope_core.m	(revision 4834)
+++ /issm/trunk/src/m/solutions/bedslope_core.m	(revision 4835)
@@ -19,11 +19,4 @@
 	femmodel=solver_linear(femmodel);
 	
-	%extrude inputs if we are in 3D: */
-	if dim==3,
-		displaystring(verbose,'\n%s',['extruding bed slope in 3d...']);
-		femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes, femmodel.vertices,femmodel.loads, femmodel.materials,femmodel.parameters,BedSlopeXEnum);
-		femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes, femmodel.vertices,femmodel.loads, femmodel.materials,femmodel.parameters,BedSlopeYEnum);
-	end
-	
 	if solution_type==BedSlopeSolutionEnum,
 		displaystring(verbose,'\n%s',['saving results...']);
Index: /issm/trunk/src/m/solutions/prognostic_core.m
===================================================================
--- /issm/trunk/src/m/solutions/prognostic_core.m	(revision 4834)
+++ /issm/trunk/src/m/solutions/prognostic_core.m	(revision 4835)
@@ -19,7 +19,4 @@
 	femmodel=solver_linear(femmodel);
 	
-	displaystring(verbose,'\n%s',['extude computed thickness on all layers...']);
-	femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,ThicknessEnum);
-
 	if solution_type==PrognosticSolutionEnum,
 		displaystring(verbose,'\n%s',['saving results...']);
Index: /issm/trunk/src/m/solutions/surfaceslope_core.m
===================================================================
--- /issm/trunk/src/m/solutions/surfaceslope_core.m	(revision 4834)
+++ /issm/trunk/src/m/solutions/surfaceslope_core.m	(revision 4835)
@@ -19,11 +19,4 @@
 	femmodel=solver_linear(femmodel);
 	
-	%extrude inputs if we are in 3D: */
-	if dim==3,
-		displaystring(verbose,'\n%s',['extruding surface slope in 3d...']);
-		femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes, femmodel.vertices,femmodel.loads, femmodel.materials,femmodel.parameters,SurfaceSlopeXEnum);
-		femmodel.elements=InputExtrude(femmodel.elements,femmodel.nodes, femmodel.vertices,femmodel.loads, femmodel.materials,femmodel.parameters,SurfaceSlopeYEnum);
-	end
-	
 	if solution_type==SurfaceSlopeSolutionEnum,
 		displaystring(verbose,'\n%s',['saving results...']);
