Index: issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp
===================================================================
--- issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp	(revision 4121)
+++ issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp	(revision 4122)
@@ -56,4 +56,5 @@
 			element=(Element*)elements->GetObjectByOffset(counter);
 			element->Update(i,iomodel,analysis_counter,analysis_type); //we need i to index into elements.
+			counter++;
 		}
 	}
Index: issm/trunk/src/c/objects/Elements/Beam.cpp
===================================================================
--- issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 4122)
@@ -222,22 +222,15 @@
 void  Beam::CreateKMatrix(Mat Kgg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
 
 	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
-	if (analysis_type==DiagnosticAnalysisEnum) {
-	
-		if (sub_analysis_type==HutterAnalysisEnum) {
-
-			CreateKMatrixDiagnosticHutter( Kgg);
-		}
-		else 
-			ISSMERROR("%s%i%s\n","sub_analysis_type: ",sub_analysis_type," not supported yet");
+	if (analysis_type==DiagnosticHutterAnalysisEnum) {
+		CreateKMatrixDiagnosticHutter( Kgg);
 	}
 	else{
-		ISSMERROR("%s%i%s\n","analysis: ",analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
@@ -306,13 +299,9 @@
 	
 	/*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
-	if (analysis_type==DiagnosticAnalysisEnum) {
-		if (sub_analysis_type==HutterAnalysisEnum) {
-			CreatePVectorDiagnosticHutter( pg);
-		}
-		else
-			ISSMERROR("%s%i%s"," analysis ",analysis_type," not supported yet");
+	if (analysis_type==DiagnosticHutterAnalysisEnum) {
+		CreatePVectorDiagnosticHutter( pg);
 	}
 	else{
-		ISSMERROR("%s%i%s"," analysis ",analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
Index: issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4122)
@@ -1242,9 +1242,8 @@
 void  Penta::CreateKMatrix(Mat Kgg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
 
 	/*if debugging mode, check that all pointers exist*/
@@ -1255,18 +1254,15 @@
 		CreateKMatrixDiagnosticHoriz( Kgg);
 	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
-		if (sub_analysis_type==HorizAnalysisEnum){
-			CreateKMatrixDiagnosticHoriz( Kgg);
-		}
-		else if (sub_analysis_type==HutterAnalysisEnum){
-			CreateKMatrixDiagnosticHutter( Kgg);
-		}
-		else if (sub_analysis_type==VertAnalysisEnum){
-			CreateKMatrixDiagnosticVert( Kgg);
-		}
-		else if (sub_analysis_type==StokesAnalysisEnum){
-			CreateKMatrixDiagnosticStokes( Kgg);
-		}
-		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
+	else if (analysis_type==DiagnosticHorizAnalysisEnum){
+		CreateKMatrixDiagnosticHoriz( Kgg);
+	}
+	else if (analysis_type==DiagnosticHutterAnalysisEnum){
+		CreateKMatrixDiagnosticHutter( Kgg);
+	}
+	else if (analysis_type==DiagnosticVertAnalysisEnum){
+		CreateKMatrixDiagnosticVert( Kgg);
+	}
+	else if (analysis_type==DiagnosticStokesAnalysisEnum){
+		CreateKMatrixDiagnosticStokes( Kgg);
 	}
 	else if (analysis_type==SlopeAnalysisEnum){
@@ -1288,5 +1284,5 @@
 		CreateKMatrixMelting( Kgg);
 	}
-	else ISSMERROR("%s%i%s\n","analysis: ",analysis_type," not supported yet");
+	else ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 
 }
@@ -2342,18 +2338,15 @@
 		CreatePVectorDiagnosticHoriz( pg);
 	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
-		if (sub_analysis_type==HorizAnalysisEnum){
-			CreatePVectorDiagnosticHoriz( pg);
-		}
-		else if (sub_analysis_type==HutterAnalysisEnum){
-			CreatePVectorDiagnosticHutter( pg);
-		}
-		else if (sub_analysis_type==VertAnalysisEnum){
-			CreatePVectorDiagnosticVert( pg);
-		}
-		else if (sub_analysis_type==StokesAnalysisEnum){
-			CreatePVectorDiagnosticStokes( pg);
-		}
-		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
+	else if (analysis_type==DiagnosticHorizAnalysisEnum){
+		CreatePVectorDiagnosticHoriz( pg);
+	}
+	else if (analysis_type==DiagnosticHutterAnalysisEnum){
+		CreatePVectorDiagnosticHutter( pg);
+	}
+	else if (analysis_type==DiagnosticVertAnalysisEnum){
+		CreatePVectorDiagnosticVert( pg);
+	}
+	else if (analysis_type==DiagnosticStokesAnalysisEnum){
+		CreatePVectorDiagnosticStokes( pg);
 	}
 	else if (analysis_type==SlopeAnalysisEnum){
@@ -2375,5 +2368,5 @@
 		CreatePVectorMelting( pg);
 	}
-	else ISSMERROR("%s%i%s\n","analysis: ",analysis_type," not supported yet");
+	else ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 
 }
Index: issm/trunk/src/c/objects/Elements/Sing.cpp
===================================================================
--- issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 4122)
@@ -194,18 +194,15 @@
 void  Sing::CreateKMatrix(Mat Kgg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
 
 	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
-	if ((analysis_type==DiagnosticAnalysisEnum) && (sub_analysis_type==HutterAnalysisEnum)){
-
+	if (analysis_type==DiagnosticHutterAnalysisEnum){
 		CreateKMatrixDiagnosticHutter( Kgg);
-
 	}
 	else{
-		ISSMERROR("%s%i%s%i%s\n","analysis: ",analysis_type," and sub_analysis_type: ",sub_analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
@@ -237,18 +234,15 @@
 void  Sing::CreatePVector(Vec pg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
 	
 	/*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
-	if ((analysis_type==DiagnosticAnalysisEnum) && (sub_analysis_type==HutterAnalysisEnum)){
-	
+	if (analysis_type==DiagnosticHutterAnalysisEnum){
 			CreatePVectorDiagnosticHutter( pg);
-
 	}
 	else{
-		ISSMERROR("%s%i%s"," analysis ",analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
Index: issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4122)
@@ -973,9 +973,8 @@
 void  Tria::CreateKMatrix(Mat Kgg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
 
 	/*asserts: {{{2*/
@@ -987,12 +986,9 @@
 		CreateKMatrixDiagnosticHoriz( Kgg);
 	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
-		if (sub_analysis_type==HorizAnalysisEnum){
-			CreateKMatrixDiagnosticHoriz( Kgg);
+	else if (analysis_type==DiagnosticHorizAnalysisEnum){
+		CreateKMatrixDiagnosticHoriz( Kgg);
 		}
-		else if (sub_analysis_type==HutterAnalysisEnum){
-			CreateKMatrixDiagnosticHutter( Kgg);
-		}
-		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
+	else if (analysis_type==DiagnosticHutterAnalysisEnum){
+		CreateKMatrixDiagnosticHutter( Kgg);
 	}
 	else if (analysis_type==SlopeAnalysisEnum){
@@ -1015,5 +1011,5 @@
 	}
 	else{
-		ISSMERROR("%s%i%s\n","analysis: ",analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
@@ -2387,9 +2383,8 @@
 void  Tria::CreatePVector(Vec pg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&sub_analysis_type,AnalysisTypeEnum);
 
 	/*asserts: {{{*/
@@ -2402,12 +2397,9 @@
 		CreatePVectorDiagnosticHoriz( pg);
 	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
-		if (sub_analysis_type==HorizAnalysisEnum){
-			CreatePVectorDiagnosticHoriz( pg);
-		}
-		else if (sub_analysis_type==HutterAnalysisEnum){
-			CreatePVectorDiagnosticHutter( pg);
-		}
-		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
+	else if (analysis_type==DiagnosticHorizAnalysisEnum){
+		CreatePVectorDiagnosticHoriz( pg);
+	}
+	else if (analysis_type==DiagnosticHutterAnalysisEnum){
+		CreatePVectorDiagnosticHutter( pg);
 	}
 	else if (analysis_type==SlopeAnalysisEnum){
@@ -2430,5 +2422,5 @@
 	}
 	else{
-		ISSMERROR("%s%i%s"," analysis ",analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
Index: issm/trunk/src/c/objects/FemModel.cpp
===================================================================
--- issm/trunk/src/c/objects/FemModel.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/FemModel.cpp	(revision 4122)
@@ -55,6 +55,7 @@
 	for(i=0;i<nummodels;i++){
 
+		_printf_("   processing finite element model of analysis %s:\n",EnumAsString(analysis_type_list[i]));
 		analysis_type=analysis_type_list[i];
-		_printf_("   processing finite element model of analysis %s:\n",EnumAsString(analysis_type));
+		this->SetCurrentAnalysis(analysis_type);
 	
 		_printf_("      create degrees of freedom\n");
Index: issm/trunk/src/c/objects/Loads/Icefront.cpp
===================================================================
--- issm/trunk/src/c/objects/Loads/Icefront.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Loads/Icefront.cpp	(revision 4122)
@@ -277,9 +277,7 @@
 /*Object functions*/
 /*FUNCTION Icefront::CreateKMatrix {{{1*/
-
 void  Icefront::CreateKMatrix(Mat Kgg){
 
 	/*No stiffness loads applied, do nothing: */
-
 	return;
 
@@ -289,33 +287,21 @@
 void  Icefront::CreatePVector(Vec pg){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*Retrieve parameters: */
 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	this->parameters->FindParam(&sub_analysis_type,SubAnalysisTypeEnum);
 
 	/*Just branch to the correct element icefront vector generator, according to the type of analysis we are carrying out: */
 	if (analysis_type==ControlAnalysisEnum){
-		
 		CreatePVectorDiagnosticHoriz( pg);
-
-	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
-	
-		if (sub_analysis_type==HorizAnalysisEnum){
-		
-			CreatePVectorDiagnosticHoriz( pg);
-
-		}
-		else if (sub_analysis_type==StokesAnalysisEnum){
-			
-			CreatePVectorDiagnosticStokes( pg);
-
-		}
-		else ISSMERROR("%s%i%s"," sub_analysis_type: ",sub_analysis_type," not supported yet");
-
+	}
+	else if (analysis_type==DiagnosticHorizAnalysisEnum){
+		CreatePVectorDiagnosticHoriz( pg);
+	}
+	else if (analysis_type==DiagnosticStokesAnalysisEnum){
+		CreatePVectorDiagnosticStokes( pg);
 	}
 	else{
-		ISSMERROR("%s%i%s"," analysis ",analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 }
Index: issm/trunk/src/c/objects/Loads/Numericalflux.cpp
===================================================================
--- issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 4122)
@@ -291,9 +291,7 @@
 
 	if (type==InternalEnum){
-
 		CreateKMatrixInternal(Kgg);
 	}
 	else if (type==BoundaryEnum){
-
 		CreateKMatrixBoundary(Kgg);
 	}
@@ -552,9 +550,7 @@
 
 	if (type==InternalEnum){
-
 		CreatePVectorInternal(pg);
 	}
 	else if (type==BoundaryEnum){
-
 		CreatePVectorBoundary(pg);
 	}
Index: issm/trunk/src/c/objects/Loads/Pengrid.cpp
===================================================================
--- issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 4122)
@@ -248,5 +248,4 @@
 /*Object functions*/
 /*FUNCTION Pengrid::CreateKMatrix {{{1*/
-
 void  Pengrid::CreateKMatrix(Mat Kgg){
 
@@ -406,26 +405,20 @@
 void  Pengrid::PenaltyCreateKMatrix(Mat Kgg,double kmax){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*Retrieve parameters: */
 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	this->parameters->FindParam(&sub_analysis_type,SubAnalysisTypeEnum);
-
-	if ((analysis_type==DiagnosticAnalysisEnum) && ((sub_analysis_type==StokesAnalysisEnum))){
-
+
+	if (analysis_type==DiagnosticStokesAnalysisEnum){
 		PenaltyCreateKMatrixDiagnosticStokes( Kgg,kmax);
 	}
 	else if (analysis_type==ThermalAnalysisEnum){
-		
 		PenaltyCreateKMatrixThermal( Kgg,kmax);
-		
 	}
 	else if (analysis_type==MeltingAnalysisEnum){
-			
 		PenaltyCreateKMatrixMelting( Kgg,kmax);
-
 	}
 	else{
-		ISSMERROR("%s%i%s%i%s","analysis: ",analysis_type," and sub_analysis_type: ",sub_analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
@@ -564,21 +557,16 @@
 void  Pengrid::PenaltyCreatePVector(Vec pg,double kmax){
 
-	int analysis_type,sub_analysis_type;
+	int analysis_type;
 
 	/*Retrieve parameters: */
 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	this->parameters->FindParam(&sub_analysis_type,SubAnalysisTypeEnum);
 
 	if (analysis_type==ThermalAnalysisEnum){
-		
 		PenaltyCreatePVectorThermal( pg,kmax);
-		
 	}
 	else if (analysis_type==MeltingAnalysisEnum){
-			
 		PenaltyCreatePVectorMelting( pg,kmax);
-
-	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
+	}
+	else if (analysis_type==DiagnosticStokesAnalysisEnum){
 
 		/*No loads applied, do nothing: */
@@ -587,5 +575,5 @@
 	}
 	else{
-		ISSMERROR("%s%i%s%i%s","analysis: ",analysis_type," and sub_analysis_type: ",sub_analysis_type," not supported yet");
+		ISSMERROR("analysis %i (%s) not supported yet",analysis_type,EnumAsString(analysis_type));
 	}
 
Index: issm/trunk/src/c/objects/Loads/Penpair.cpp
===================================================================
--- issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 4121)
+++ issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 4122)
@@ -180,5 +180,4 @@
 /*Object functions*/
 /*FUNCTION Penpair::CreateKMatrix {{{1*/
-
 void  Penpair::CreateKMatrix(Mat Kgg){
 
