Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5911)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5912)
@@ -738,7 +738,7 @@
 void  Tria::CreatePVector(Vec pg, Vec pf){
 
+	/*retrive parameters: */
+	ElementVector* pe=NULL;
 	int analysis_type;
-
-	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
 
@@ -749,40 +749,41 @@
 
 	/*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
-	if (analysis_type==DiagnosticHorizAnalysisEnum){
-		CreatePVectorDiagnosticMacAyeal( pg,pf);
-	}
-	else if (analysis_type==AdjointHorizAnalysisEnum){
-		CreatePVectorAdjointHoriz( pg);
-	}
-	else if (analysis_type==DiagnosticHutterAnalysisEnum){
-		CreatePVectorDiagnosticHutter( pg);
-	}
-	else if (analysis_type==BedSlopeXAnalysisEnum || analysis_type==SurfaceSlopeXAnalysisEnum || analysis_type==BedSlopeYAnalysisEnum || analysis_type==SurfaceSlopeYAnalysisEnum){
-		CreatePVectorSlope( pg);
-	}
-	else if (analysis_type==PrognosticAnalysisEnum){
-		if (GetElementType()==P1Enum)
-		 CreatePVectorPrognostic_CG( pg);
-		else if (GetElementType()==P1DGEnum)
-		CreatePVectorPrognostic_DG( pg);
-		else
-		 ISSMERROR("Element type %s not supported yet",EnumToString(GetElementType()));
-	}
-	else if (analysis_type==BalancedthicknessAnalysisEnum){
-		if (GetElementType()==P1Enum)
-		 CreatePVectorBalancedthickness_CG( pg);
-		else if (GetElementType()==P1DGEnum)
-		 CreatePVectorBalancedthickness_DG( pg);
-		else
-		 ISSMERROR("Element type %s not supported yet",EnumToString(GetElementType()));
-	}
-	else if (analysis_type==AdjointBalancedthicknessAnalysisEnum){
-		CreatePVectorAdjointBalancedthickness(pg);
-	}
-	else if (analysis_type==BalancedvelocitiesAnalysisEnum){
-		CreatePVectorBalancedvelocities( pg);
-	}
-	else{
-		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumToString(analysis_type));
+	switch(analysis_type){
+		case DiagnosticHorizAnalysisEnum:
+			CreatePVectorDiagnosticMacAyeal( pg,pf);
+			break;
+		case AdjointHorizAnalysisEnum:
+			CreatePVectorAdjointHoriz( pg);
+			break;
+		case DiagnosticHutterAnalysisEnum:
+			CreatePVectorDiagnosticHutter( pg);
+			break;
+		case BedSlopeXAnalysisEnum: case SurfaceSlopeXAnalysisEnum: case BedSlopeYAnalysisEnum: case SurfaceSlopeYAnalysisEnum:
+			CreatePVectorSlope( pg);
+			break;
+		case PrognosticAnalysisEnum:
+			if (GetElementType()==P1Enum)
+			 CreatePVectorPrognostic_CG( pg);
+			else if (GetElementType()==P1DGEnum)
+			 CreatePVectorPrognostic_DG( pg);
+			else
+			 ISSMERROR("Element type %s not supported yet",EnumToString(GetElementType()));
+			break;
+		case BalancedthicknessAnalysisEnum:
+			if (GetElementType()==P1Enum)
+			 CreatePVectorBalancedthickness_CG( pg);
+			else if (GetElementType()==P1DGEnum)
+			 CreatePVectorBalancedthickness_DG( pg);
+			else
+			 ISSMERROR("Element type %s not supported yet",EnumToString(GetElementType()));
+			break;
+		case AdjointBalancedthicknessAnalysisEnum:
+			CreatePVectorAdjointBalancedthickness(pg);
+			break;
+		case BalancedvelocitiesAnalysisEnum:
+			CreatePVectorBalancedvelocities( pg);
+			break;
+		default:
+			ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumToString(analysis_type));
 	}
 
