Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 24365)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 24366)
@@ -280,5 +280,5 @@
 	if(M!=iomodel->numberofvertices) _error_("not supported yet");
 	if(N!=num_inputs) _error_("sizes are not consistent");
-	
+
 
 	int        tria_vertex_ids[3];
@@ -2128,5 +2128,5 @@
 	/*stack the input for each timestep in the slice*/
 	int offset = start_offset;
-	while(offset <= end_offset ){
+	while(offset < end_offset ){
 
 		if(offset==-1){
@@ -2142,5 +2142,5 @@
 		}
 		else{
-			TriaInput2* input = transient_input->GetTriaInput(offset);
+			TriaInput2* input = transient_input->GetTriaInput(offset+1);
 			_assert_(input->GetInterpolation()==P1Enum);
 			this->InputServe(input);
@@ -2155,5 +2155,5 @@
 			dt = timesteps[0] - start_time;
 		}
-		else if(offset = numtimesteps-1){
+		else if(offset == numtimesteps-1){
 			dt = end_time - timesteps[offset];
 		}
@@ -2176,5 +2176,5 @@
 				}
 				else{
-					for(int iv=0;iv<NUMVERTICES;iv++) averaged_values[iv] += dt*current_values[iv];
+					for(int iv=0;iv<NUMVERTICES;iv++) averaged_values[iv] *= dt*current_values[iv];
 				}
 				break;
@@ -2189,5 +2189,5 @@
 					for(int iv=0;iv<NUMVERTICES;iv++){
 						_assert_(current_values[iv]>1.e-50);
-						averaged_values[iv]  = dt*1./current_values[iv];
+						averaged_values[iv]  += dt*1./current_values[iv];
 					}
 				}
@@ -3843,5 +3843,5 @@
 
 	/*First, serarch the input: */
-	Input2* data=this->GetInput2(natureofdataenum); 
+	Input2* data=this->GetInput2(natureofdataenum);
 
 	/*figure out if we have the vertex id: */
@@ -4759,9 +4759,9 @@
 	/*Get material parameters :*/
 	rho_ice=FindParam(MaterialsRhoIceEnum);
-	Input2* floatingmelt_input = this->GetInput2(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input); 
+	Input2* floatingmelt_input = this->GetInput2(BasalforcingsFloatingiceMeltingRateEnum); _assert_(floatingmelt_input);
 	Input2* gllevelset_input   = this->GetInput2(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
 	Input2* scalefactor_input  = NULL;
 	if(scaled==true){
-		scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input); 
+		scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
 	}
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
@@ -4804,9 +4804,9 @@
 	/*Get material parameters :*/
 	rho_ice=FindParam(MaterialsRhoIceEnum);
-	Input2* groundedmelt_input = this->GetInput2(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input); 
+	Input2* groundedmelt_input = this->GetInput2(BasalforcingsGroundediceMeltingRateEnum); _assert_(groundedmelt_input);
 	Input2* gllevelset_input = this->GetInput2(MaskGroundediceLevelsetEnum); _assert_(gllevelset_input);
 	Input2* scalefactor_input = NULL;
 	if(scaled==true){
-		scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input); 
+		scalefactor_input = this->GetInput2(MeshScaleFactorEnum); _assert_(scalefactor_input);
 	}
 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
@@ -5298,5 +5298,5 @@
 
 	/*Compute ice thickness change: */
-	Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum); 
+	Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum);
 	if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
 	deltathickness_input->GetInputAverage(&I);
@@ -5436,5 +5436,5 @@
 
 	/*Compute ice thickness change: */
-	Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum); 
+	Input2* deltathickness_input=this->GetInput2(EsaDeltathicknessEnum);
 	if (!deltathickness_input)_error_("delta thickness input needed to compute elastic adjustment!");
 	deltathickness_input->GetInputAverage(&I);
@@ -5670,5 +5670,5 @@
 
 		/*Compute ice thickness change: */
-		Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 
+		Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
 		if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
 		deltathickness_input->GetInputAverage(&I);
@@ -5806,5 +5806,5 @@
 
 	/*Compute ice thickness change: */
-	Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 
+	Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
 	if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
 
@@ -6149,5 +6149,5 @@
 
 	/*Compute ice thickness change: */
-	Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum); 
+	Input2* deltathickness_input=this->GetInput2(SealevelriseDeltathicknessEnum);
 	if (!deltathickness_input)_error_("delta thickness input needed to compute sea level rise!");
 	deltathickness_input->GetInputAverage(&I);
