Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4285)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4286)
@@ -5110,4 +5110,40 @@
 }
 /*}}}*/
+/*FUNCTION Tria::GetSolutionFromInputsDiagnosticHoriz(Vec solution){{{1*/
+void  Tria::GetSolutionFromInputsDiagnosticHoriz(Vec solution){
+
+	int i;
+
+	const int    numvertices=3;
+	const int    numdofpervertex=2;
+	const int    numdof=numdofpervertex*numvertices;
+	double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
+
+	int          doflist[numdof];
+	double       values[numdof];
+	double       vx;
+	double       vy;
+
+	int          dummy;
+
+	/*Get dof list: */
+	GetDofList(&doflist[0],&dummy);
+
+	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+	/*P1 element only for now*/
+	for(i=0;i<numvertices;i++){
+
+		/*Recover vx and vy*/
+		inputs->GetParameterValue(&vx,&gauss[i][0],VxEnum);
+		inputs->GetParameterValue(&vy,&gauss[i][0],VyEnum);
+		values[i*numdofpervertex+0]=vx;
+		values[i*numdofpervertex+1]=vy;
+	}
+
+	/*Add value to global vector*/
+	VecSetValues(solution,numdof,doflist,(const double*)values,INSERT_VALUES);
+
+}
+/*}}}*/
 /*FUNCTION Tria::GradjDragStokes {{{1*/
 void  Tria::GradjDragStokes(Vec gradient){
@@ -5283,4 +5319,165 @@
 }
 /*}}}*/
+/*FUNCTION Tria::InputUpdateFromSolutionDiagnosticHoriz {{{1*/
+void  Tria::InputUpdateFromSolutionDiagnosticHoriz(double* solution){
+	
+	int i;
+
+	const int    numvertices=3;
+	const int    numdofpervertex=2;
+	const int    numdof=numdofpervertex*numvertices;
+	
+	int          doflist[numdof];
+	double       values[numdof];
+	double       vx[numvertices];
+	double       vy[numvertices];
+	double       vz[numvertices];
+	double       vel[numvertices];
+	double       pressure[numvertices];
+	double       thickness[numvertices];
+	double       rho_ice,g;
+	double       gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}};
+
+	int          dummy;
+	Input*       VzInput=NULL;
+	double*      VzPtr=NULL;
+	
+	/*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]];
+	}
+
+	/*Ok, we have vx and vy in values, fill in vx and vy arrays: */
+	for(i=0;i<numvertices;i++){
+		vx[i]=values[i*numdofpervertex+0];
+		vy[i]=values[i*numdofpervertex+1];
+	}
+
+	/*Get Vz*/
+	VzInput=inputs->GetInput(VzEnum);
+	if (VzInput){
+		if (VzInput->Enum()!=TriaVertexInputEnum){
+			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];
+	}
+	else{
+		for(i=0;i<numvertices;i++) vz[i]=0.0;
+	}
+
+	/*Now Compute vel*/
+	for(i=0;i<numvertices;i++) vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
+
+	/*For pressure: we have not computed pressure in this analysis, for this element. We are in 2D, 
+	 *so the pressure is just the pressure at the bedrock: */
+	rho_ice=matpar->GetRhoIce();
+	g=matpar->GetG();
+	inputs->GetParameterValues(&thickness[0],&gauss[0][0],3,ThicknessEnum);
+	
+	for(i=0;i<numvertices;i++){
+		pressure[i]=rho_ice*g*thickness[i];
+	}
+
+	/*Now, we have to move the previous Vx and Vy inputs  to old 
+	 * status, otherwise, we'll wipe them off: */
+	this->inputs->ChangeEnum(VxEnum,VxOldEnum);
+	this->inputs->ChangeEnum(VyEnum,VyOldEnum);
+	this->inputs->ChangeEnum(PressureEnum,PressureOldEnum);
+
+	/*Add vx and vy as inputs to the tria element: */
+	this->inputs->AddInput(new TriaVertexInput(VxEnum,vx));
+	this->inputs->AddInput(new TriaVertexInput(VyEnum,vy));
+	this->inputs->AddInput(new TriaVertexInput(VelEnum,vel));
+	this->inputs->AddInput(new TriaVertexInput(PressureEnum,pressure));
+
+}
+/*}}}*/
+/*FUNCTION Tria::InputUpdateFromSolutionSlopeCompute {{{1*/
+void  Tria::InputUpdateFromSolutionSlopeCompute(double* solution){
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
+/*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];
+	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::InputUpdateFromSolutionPrognostic2 {{{1*/
+void  Tria::InputUpdateFromSolutionPrognostic2(double* solution){
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
+/*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::InputUpdateFromSolutionBalancedthickness2 {{{1*/
+void  Tria::InputUpdateFromSolutionBalancedthickness2(double* solution){
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Tria::InputUpdateFromSolutionBalancedvelocities {{{1*/
+void  Tria::InputUpdateFromSolutionBalancedvelocities(double* solution){
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Tria::IsInput{{{1*/
+bool Tria::IsInput(int name){
+	if (name==SurfaceSlopeXEnum ||
+				name==SurfaceSlopeYEnum){
+		return true;
+	}
+	else return false;
+}
+/*}}}*/
 /*FUNCTION Tria::SetClone {{{1*/
 void  Tria::SetClone(int* minranks){
