Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5733)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5734)
@@ -1333,6 +1333,6 @@
 	double mass_flux=0;
 	double xyz_list[NUMVERTICES][3];
-	double gauss_1[3];
-	double gauss_2[3];
+	GaussTria* gauss_1=NULL;
+	GaussTria* gauss_2=NULL;
 	double normal[2];
 	double length;
@@ -1355,8 +1355,8 @@
 
 	/*get area coordinates of 0 and 1 locations: */
-	for(i=0;i<3;i++){
-		gauss_1[i]=this->GetAreaCoordinate(x1,y1,i+1);
-		gauss_2[i]=this->GetAreaCoordinate(x2,y2,i+1);
-	}
+	gauss_1=new GaussTria();
+	gauss_1->GaussFromCoords(x1,y1,&xyz_list[0][0]);
+	gauss_2=new GaussTria();
+	gauss_2->GaussFromCoords(x2,y2,&xyz_list[0][0]);
 
 	/*get normal of segment: */
@@ -1368,10 +1368,10 @@
 
 	/*get thickness and velocity at two segment extremities: */
-	inputs->GetParameterValue(&h1, &gauss_1[0],ThicknessEnum);
-	inputs->GetParameterValue(&h2, &gauss_2[0],ThicknessEnum);
-	inputs->GetParameterValue(&vx1, &gauss_1[0],VxEnum);
-	inputs->GetParameterValue(&vx2, &gauss_2[0],VxEnum);
-	inputs->GetParameterValue(&vy1, &gauss_1[0],VyEnum);
-	inputs->GetParameterValue(&vy2, &gauss_2[0],VyEnum);
+	inputs->GetParameterValue(&h1, gauss_1,ThicknessEnum);
+	inputs->GetParameterValue(&h2, gauss_2,ThicknessEnum);
+	inputs->GetParameterValue(&vx1,gauss_1,VxEnum);
+	inputs->GetParameterValue(&vx2,gauss_2,VxEnum);
+	inputs->GetParameterValue(&vy1,gauss_1,VyEnum);
+	inputs->GetParameterValue(&vy2,gauss_2,VyEnum);
 
 	mass_flux= rho_ice*length*(  
@@ -1382,4 +1382,8 @@
 	/*Process units: */
 	mass_flux=UnitConversion(mass_flux,IuToExtEnum,MassFluxEnum,this->parameters);
+
+	/*clean up*/
+	delete gauss_1;
+	delete gauss_2;
 
 	return mass_flux;
@@ -5416,36 +5420,4 @@
 }
 /*}}}*/
-/*FUNCTION Tria::GetAreaCoordinate {{{1*/
-double Tria::GetAreaCoordinate(double x, double y, int which_one){
-
-	/*Intermediaries*/
-	double    area = 0;
-	double    xyz_list[NUMVERTICES][3];
-	double    x1,y1,x2,y2,x3,y3;
-
-	/*Get area: */
-	area=this->GetArea();
-
-	/*Get xyz list: */
-	GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
-	x1=xyz_list[0][0]; y1=xyz_list[0][1];
-	x2=xyz_list[1][0]; y2=xyz_list[1][1];
-	x3=xyz_list[2][0]; y3=xyz_list[2][1];
-
-	switch(which_one){
-		case 1:
-			/*Get first area coordinate = det(x-x3  x2-x3 ; y-y3   y2-y3)/area*/
-			return ((x-x3)*(y2-y3)-(x2-x3)*(y-y3))/area;
-		case 2:
-			/*Get second area coordinate = det(x1-x3  x-x3 ; y1-y3   y-y3)/area*/
-			return ((x1-x3)*(y-y3)-(x-x3)*(y1-y3))/area;
-		case 3:
-			/*Get third  area coordinate 1-area1-area2: */
-			return 1-((x-x3)*(y2-y3)-(x2-x3)*(y-y3))/area -((x1-x3)*(y-y3)-(x-x3)*(y1-y3))/area;
-		default:
-			ISSMERROR("%s%i%s\n"," error message: area coordinate ",which_one," done not exist!");
-	}
-}
-/*}}}*/
 /*FUNCTION Tria::GetElementType {{{1*/
 int Tria::GetElementType(){
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 5733)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 5734)
@@ -147,7 +147,6 @@
 		void	  CreatePVectorThermalSheet( Vec pg);
 		void	  CreatePVectorThermalShelf( Vec pg);
-		double    GetArea(void);
-		double    GetAreaCoordinate(double x, double y, int which_one);
-		int       GetElementType(void);
+		double  GetArea(void);
+		int     GetElementType(void);
 		void	  GetDofList(int** pdoflist,int approximation_enum=0);
 		void	  GetDofList1(int* doflist);
Index: /issm/trunk/src/c/objects/Gauss/GaussTria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Gauss/GaussTria.cpp	(revision 5733)
+++ /issm/trunk/src/c/objects/Gauss/GaussTria.cpp	(revision 5734)
@@ -164,4 +164,31 @@
 	 coord2=coords2[ig];
 	 coord3=coords3[ig];
+
+}
+/*}}}*/
+/*FUNCTION GaussTria::GaussFromCoords{{{1*/
+void GaussTria::GaussFromCoords(double x,double y,double* xyz_list){
+
+	/*Intermediaries*/
+	double    area = 0;
+	double    x1,y1,x2,y2,x3,y3;
+
+	/*in debugging mode: check that the default constructor has been called*/
+	ISSMASSERT(numgauss==-1);
+
+	x1=*(xyz_list+3*0+0); y1=*(xyz_list+3*0+1);
+	x2=*(xyz_list+3*1+0); y2=*(xyz_list+3*1+1);
+	x3=*(xyz_list+3*2+0); y3=*(xyz_list+3*2+1);
+
+	area=(x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2;
+
+	/*Get first area coordinate = det(x-x3  x2-x3 ; y-y3   y2-y3)/area*/
+	coord1=((x-x3)*(y2-y3)-(x2-x3)*(y-y3))/area;
+
+	/*Get second area coordinate = det(x1-x3  x-x3 ; y1-y3   y-y3)/area*/
+	coord2=((x1-x3)*(y-y3)-(x-x3)*(y1-y3))/area;
+
+	/*Get third  area coordinate 1-area1-area2: */
+	coord3=1-coord1-coord2;
 
 }
Index: /issm/trunk/src/c/objects/Gauss/GaussTria.h
===================================================================
--- /issm/trunk/src/c/objects/Gauss/GaussTria.h	(revision 5733)
+++ /issm/trunk/src/c/objects/Gauss/GaussTria.h	(revision 5734)
@@ -38,4 +38,5 @@
 		int  end(void);
 		void Echo(void);
+		void GaussFromCoords(double x1,double y1,double* xyz_list);
 		void GaussPoint(int ig);
 		void GaussVertex(int iv);
