Index: /issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp
===================================================================
--- /issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp	(revision 5478)
+++ /issm/trunk/src/c/modules/Qmux/SpawnCoreParallel.cpp	(revision 5479)
@@ -35,15 +35,18 @@
 #include "../modules.h"
 
-void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodel,int counter){
+void SpawnCoreParallel(double* d_responses, int d_numresponses, double* d_variables, char** d_variables_descriptors,int d_numvariables, FemModel* femmodel,int counter){
+
+	/*Notice the d_, which prefixes anything that is being provided to us by the Dakota pluggin. Careful. some things are ours, some are dakotas!: */
 
 	int i;
 	extern int my_rank;
 	
-	char   **responses_descriptors     = NULL;
+	char   **responses_descriptors     = NULL; //these are our!  there are only numresponsedescriptors of them, not d_numresponses!!!
+	int      numresponsedescriptors;
 	char    *string                    = NULL;
 	int      string_length;
 	int      verbose                   = 0;
-	int      dummy;
 	int      solution_type;
+	bool     control_analysis          = false;
 	void (*solutioncore)(FemModel*)    = NULL;
 
@@ -54,24 +57,28 @@
 	/*retrieve parameters: */
 	femmodel->parameters->FindParam(&verbose,VerboseEnum);
-	femmodel->parameters->FindParam(&responses_descriptors,&dummy,ResponseDescriptorsEnum);
+	femmodel->parameters->FindParam(&responses_descriptors,&numresponsedescriptors,ResponseDescriptorsEnum);
 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum);
 
 	/* only cpu 0, running dakota is providing us with variables and variables_descriptors and numresponses: broadcast onto other cpus: */
-	DakotaMPI_Bcast(&variables,&variables_descriptors,&numvariables,&numresponses);
+	DakotaMPI_Bcast(&d_variables,&d_variables_descriptors,&d_numvariables,&d_numresponses);
 
 	/*Modify core inputs in objects contained in femmodel, to reflect the dakota variables inputs: */
-	InputUpdateFromDakotax(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,femmodel->partition,variables,variables_descriptors,numvariables);
+	InputUpdateFromDakotax(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,femmodel->partition,d_variables,d_variables_descriptors,d_numvariables);
+
+	/*Determine solution sequence: */
+	if(verbose)_printf_("%s%s%s\n","Starting ",EnumToString(solution_type)," core:");
+	SolutionConfiguration(NULL,NULL,&solutioncore,solution_type); 
+	if(control_analysis)solutioncore=&control_core;
 
 	/*Run the core solution sequence: */
-	if(verbose)_printf_("%s%s%s\n","Starting ",EnumToString(solution_type)," core:");
-	SolutionConfiguration(NULL,NULL,&solutioncore,solution_type); 
 	solutioncore(femmodel);
 
 	/*compute responses: */
 	if(verbose)_printf_("compute dakota responses:\n");
-	DakotaResponsesx(responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,responses_descriptors,numresponses);
-
+	DakotaResponsesx(d_responses,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,femmodel->partition,responses_descriptors,numresponsedescriptors,d_numresponses);
+	
 	/*Free ressources:*/
-	DakotaFree(&variables,&variables_descriptors,&responses_descriptors, numvariables, numresponses);
+	DakotaFree(&d_variables,&d_variables_descriptors,&responses_descriptors, d_numvariables, numresponsedescriptors);
 }
 
