Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5779)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5780)
@@ -753,5 +753,5 @@
 	/*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
 	if (analysis_type==DiagnosticHorizAnalysisEnum){
-		CreatePVectorDiagnosticMacAyeal( pg);
+		CreatePVectorDiagnosticMacAyeal( pg,pf);
 	}
 	else if (analysis_type==AdjointHorizAnalysisEnum){
@@ -4196,5 +4196,5 @@
 /*}}}*/
 /*FUNCTION Tria::CreatePVectorDiagnosticMacAyeal {{{1*/
-void Tria::CreatePVectorDiagnosticMacAyeal( Vec pg){
+void Tria::CreatePVectorDiagnosticMacAyeal( Vec pg, Vec pf){
 
 	int             i,j,ig;
@@ -4203,5 +4203,4 @@
 	const int    numdof=NDOF2*NUMVERTICES;
 	double       xyz_list[NUMVERTICES][3];
-	int*         doflist=NULL;
 	
 	/* parameters: */
@@ -4218,4 +4217,7 @@
 	int  drag_type;
 
+	/*intermediary: */
+	ElementVector* pe=NULL;
+
 	/*retrieve inputs :*/
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
@@ -4229,5 +4231,4 @@
 	/* Get node coordinates and dof list: */
 	GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
-	GetDofList(&doflist,MacAyealApproximationEnum,GsetEnum);
 
 	/* Start  looping on the number of gaussian points: */
@@ -4276,10 +4277,20 @@
 	}
 
-	/*Add pe_g to global vector pg: */
-	VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
+	/*Initialize element vector: */
+	pe=this->NewElementVector(MacAyealApproximationEnum);
+
+	/*Add pe_g values to pe element stifness load: */
+	pe->AddValues(&pe_g[0]);
+
+	/*Add pe element load vector to global load vector: */
+	pe->AddToGlobal(pg,pf);
+
+	/*Free ressources:*/
+	delete pe;
 
 	/*Free ressources:*/
 	delete gauss;
-	xfree((void**)&doflist);
+
+
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 5779)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 5780)
@@ -141,5 +141,5 @@
 		void	  CreatePVectorBalancedvelocities(Vec pg);
 		void	  CreatePVectorDiagnosticBaseVert(Vec pg);
-		void	  CreatePVectorDiagnosticMacAyeal(Vec pg);
+		void	  CreatePVectorDiagnosticMacAyeal(Vec pg,Vec pf);
 		void	  CreatePVectorAdjointHoriz(Vec pg);
 		void	  CreatePVectorAdjointStokes(Vec pg);
