Index: issm/trunk/src/c/parallel/diagnostic.cpp
===================================================================
--- issm/trunk/src/c/parallel/diagnostic.cpp	(revision 1910)
+++ issm/trunk/src/c/parallel/diagnostic.cpp	(revision 1911)
@@ -23,6 +23,7 @@
 	char* outputfilename=NULL;
 	char* lockname=NULL;
-	int   waitonlock=0;
 	int   qmu_analysis=0;
+	int   control_analysis=0;
+	char* control_type=NULL;
 
 	/*Model: */
@@ -34,8 +35,12 @@
 	
 	ParameterInputs* inputs=NULL;
+	int waitonlock=0;
 	int   numberofnodes;
 	
 	double* u_g_initial=NULL;
+	double* u_g_obs=NULL;
 	Param*  param=NULL;
+	int      count;
+	DataSet* parameters=NULL;
 
 	MODULEBOOT();
@@ -80,4 +85,5 @@
 	/*get parameters: */
 	model->FindParam(&qmu_analysis,"qmu_analysis");
+	model->FindParam(&control_analysis,"control_analysis");
 	model->FindParam(&waitonlock,"waitonlock");
 
@@ -85,7 +91,13 @@
 	model->FindParam(&u_g_initial,"u_g",DiagnosticAnalysisEnum(),HorizAnalysisEnum());
 	model->FindParam(&numberofnodes,"numberofnodes");
+	if(control_analysis){
+		model->FindParam(&u_g_obs,"u_g_obs",DiagnosticAnalysisEnum(),HorizAnalysisEnum());
+	}
 
 	inputs=new ParameterInputs;
 	inputs->Add("velocity",u_g_initial,3,numberofnodes);
+	if(control_analysis){
+		inputs->Add("velocity_obs",u_g_obs,2,numberofnodes);
+	}
 	
 	_printf_("initialize results:\n");
@@ -94,9 +106,14 @@
 	/*are we running the solution sequence, or a qmu wrapper around it? : */
 	if(!qmu_analysis){
-
-		/*run diagnostic analysis: */
-		_printf_("call computational core:\n");
-		diagnostic_core(results,model,inputs);
-
+		if(!control_analysis){
+			/*run diagnostic analysis: */
+			_printf_("call computational core:\n");
+			diagnostic_core(results,model,inputs);
+		}
+		else{
+			/*run control analysis: */
+			_printf_("call computational core:\n");
+			control_core(results,model,inputs);
+		}
 	}
 	else{
@@ -111,11 +128,25 @@
 	}
 
-	/*Add analysis_type to results: */
-	result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic");
-	results->AddObject(result);
+	if(!control_analysis){
+		/*Add analysis_type to results: */
+		result=new Result(results->Size()+1,0,1,"analysis_type","diagnostic");
+		results->AddObject(result);
+		
+		_printf_("process results:\n");
+		ProcessResults(&results,model,DiagnosticAnalysisEnum());
+	}
+	else{
+		/*Add analysis_type and control_type to results: */
+		result=new Result(results->Size()+1,0,1,"analysis_type","control");
+		results->AddObject(result);
+		
+		model->FindParam(&control_type,"control_type");
+		result=new Result(results->Size()+1,0,1,"control_type",control_type);
+		results->AddObject(result);
 
-	_printf_("process results:\n");
-	ProcessResults(&results,model,DiagnosticAnalysisEnum());
-	
+		_printf_("process results:\n");
+		ProcessResults(&results,model,ControlAnalysisEnum());
+	}
+
 	_printf_("write results to disk:\n");
 	OutputResults(results,outputfilename);
@@ -132,4 +163,8 @@
 	MODULEEND();
 	
+	/*Free ressources */
+	xfree((void**)&u_g_initial);
+	xfree((void**)&u_g_obs);
+
 	return 0; //unix success return;
 }
Index: issm/trunk/src/m/classes/public/loadresultsfromdisk.m
===================================================================
--- issm/trunk/src/m/classes/public/loadresultsfromdisk.m	(revision 1910)
+++ issm/trunk/src/m/classes/public/loadresultsfromdisk.m	(revision 1911)
@@ -21,8 +21,8 @@
 %Check result is consistent, only if it exists
 disp(sprintf('%s\n','checking result consistency'));
-if ~isresultconsistent(md,md.analysis_type),
-	%it would be very cruel to put an error, it would kill the computed results (even if not consistent...)
-	disp('!! results not consistent correct the model !!') 
-end
+%if ~isresultconsistent(md,md.analysis_type),
+%	%it would be very cruel to put an error, it would kill the computed results (even if not consistent...)
+%	disp('!! results not consistent correct the model !!') 
+%end
 
 %convert analysis type to string
Index: issm/trunk/src/m/classes/public/marshall.m
===================================================================
--- issm/trunk/src/m/classes/public/marshall.m	(revision 1910)
+++ issm/trunk/src/m/classes/public/marshall.m	(revision 1911)
@@ -96,4 +96,5 @@
 
 %Control methods
+WriteData(fid,md.control_analysis,'Integer','control_analysis');
 WriteData(fid,md.control_type,'String','control_type');
 
