Index: issm/trunk/src/c/parallel/DakotaResponses.cpp
===================================================================
--- issm/trunk/src/c/parallel/DakotaResponses.cpp	(revision 587)
+++ issm/trunk/src/c/parallel/DakotaResponses.cpp	(revision 587)
@@ -0,0 +1,32 @@
+/*!\file:  DakotaResponses.cpp
+ * \brief  compute dakota responses, using a list of response descriptors.
+ */ 
+
+#ifdef HAVE_CONFIG_H
+	#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#undef __FUNCT__ 
+#define __FUNCT__ "DakotaResponses"
+    
+void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,Vec u_g,Vec p_g,int analysis_type,int sub_analysis_type){
+
+	int i;
+	char* response_descriptor=NULL;
+
+	for(i=0;i<numresponses;i++){
+
+		response_descriptor=responses_descriptors[i];
+
+		//'min_vx' 'max_vx' 'max_abs_vx' 'min_vy' 'max_vy' 'max_abs_vy' 'min_vel' 'max_vel'
+
+		if(strcmp(response_descriptor,"min_vel")){
+
+
+		}
+		else throw ErrorException(__FUNCT__,exprintf("%s%s%s"," response descriptor : ",response_descriptor," not supported yet!"));
+	}
+
+}
Index: issm/trunk/src/c/parallel/SpawnCore.cpp
===================================================================
--- issm/trunk/src/c/parallel/SpawnCore.cpp	(revision 587)
+++ issm/trunk/src/c/parallel/SpawnCore.cpp	(revision 587)
@@ -0,0 +1,133 @@
+/*!\file:  SpawnCore.cpp
+ * \brief: run core solution, according to analysis_type and sub_analysis_type
+ */ 
+
+#ifdef HAVE_CONFIG_H
+	#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#undef __FUNCT__ 
+#define __FUNCT__ "SpawnCore"
+
+#include "../objects/objects.h"
+#include "../io/io.h"
+#include "../EnumDefinitions/EnumDefinitions.h"
+#include "../shared/shared.h"
+#include "./parallel.h"
+#include "../include/macros.h"
+
+void SpawnCore(double* responses, double* variables, char** variables_descriptors,int numvariables, FemModel* femmodels,ParameterInputs* inputs,int analysis_type,int sub_analysis_type){
+
+	int i;
+	
+	/*output from core solutions: */
+	Vec u_g=NULL;
+	Vec p_g=NULL;
+
+	char** responses_descriptors=NULL;
+	int    numresponses;
+	Param* param=NULL;
+	char*  string=NULL;
+	int    string_length;
+	double* qmu_part=NULL;
+	int     qmu_npart;
+
+	extern int my_rank;
+	
+	/*synchronize all cpus, as CPU 0 is probably late (it is starting the entire dakota strategy!) : */
+	MPI_Barrier(MPI_COMM_WORLD);
+
+	/*First off, recover the responses descriptors for the response functions: */
+	param=(Param*)femmodels[0].parameters->FindParamObject("descriptors");
+	numresponses=param->GetM();
+	param->GetParameterValue(&responses_descriptors);
+
+	/*Recover partitioning for dakota: */
+	femmodels[0].parameters->FindParam((void*)&qmu_npart,"qmu_npart");
+	femmodels[0].parameters->FindParam((void*)&qmu_part,"qmu_part");
+
+	#ifdef _DEBUG_
+	for(i=0;i<numresponses;i++){
+		PetscSynchronizedPrintf(MPI_COMM_WORLD,"descriptor %i: %s\n",i,responses_descriptors[i]);
+		PetscSynchronizedFlush(MPI_COMM_WORLD);
+	}
+	#endif
+
+	/*broadcast variables: only cpu 0 has correct values*/
+	MPI_Bcast(&numvariables,1,MPI_INT,0,MPI_COMM_WORLD); 
+	if(my_rank!=0)variables=(double*)xmalloc(numvariables*sizeof(double));
+	MPI_Bcast(variables,numvariables,MPI_DOUBLE,0,MPI_COMM_WORLD); 
+
+	#ifdef _DEBUG_
+	for(i=0;i<numvariables;i++){
+		PetscSynchronizedPrintf(MPI_COMM_WORLD,"variable %i: %g\n",i,variables[i]);
+		PetscSynchronizedFlush(MPI_COMM_WORLD);
+	}
+	#endif
+
+	/*broadcast variables_descriptors: */
+	if(my_rank!=0){
+		variables_descriptors=(char**)xmalloc(numvariables*sizeof(char*));
+	}
+	for(i=0;i<numvariables;i++){
+		if(my_rank==0){
+			string=variables_descriptors[i];
+			string_length=(strlen(string)+1)*sizeof(char);
+		}
+		MPI_Bcast(&string_length,1,MPI_INT,0,MPI_COMM_WORLD); 
+		if(my_rank!=0)string=(char*)xmalloc(string_length);
+		MPI_Bcast(string,string_length,MPI_CHAR,0,MPI_COMM_WORLD); 
+		if(my_rank!=0)variables_descriptors[i]=string;
+	}
+
+	#ifdef _DEBUG_
+	for(i=0;i<numvariables;i++){
+		PetscSynchronizedPrintf(MPI_COMM_WORLD,"variable descriptor %i: %s\n",i,variables_descriptors[i]);
+		PetscSynchronizedFlush(MPI_COMM_WORLD);
+	}
+	#endif
+
+	/*Modify core inputs to reflect the dakota variables inputs: */
+	inputs->UpdateFromDakota(variables,variables_descriptors,numvariables,qmu_part,qmu_npart);
+
+	/*Run the analysis core solution sequence, with the updated inputs: */
+	if(analysis_type==DiagnosticAnalysisEnum()){
+
+		_printf_("Starting diagnostic core\n");
+		diagnostic_core(&u_g,&p_g,femmodels,inputs);
+
+	}
+	else{
+		throw ErrorException(__FUNCT__,exprintf("%s%i%s%i%s"," analysis_type ",analysis_type," and sub_analysis_type ",sub_analysis_type," not supported yet!"));
+	}
+
+	/*compute responses on cpu 0: dummy for now! */
+	DakotaResponses(responses,responses_descriptors,numresponses,u_g,p_g,analysis_type,sub_analysis_type);
+
+	/*Free ressources:*/
+	
+	//vectors
+	VecFree(&u_g);
+	VecFree(&p_g);
+	
+	//variables only on cpu != 0
+	if(my_rank!=0){
+		xfree((void**)&variables);
+		for(i=0;i<numvariables;i++){
+			string=variables_descriptors[i];
+			xfree((void**)&string);
+		}
+		xfree((void**)&variables_descriptors);
+	}
+	//responses descriptors
+	for(i=0;i<numresponses;i++){
+		string=responses_descriptors[i];
+		xfree((void**)&string);
+	}
+	//rest of dynamic allocations.
+	xfree((void**)&responses_descriptors);
+	xfree((void**)&qmu_part);
+}
+
