Index: /issm/trunk/src/mex/Makefile.am
===================================================================
--- /issm/trunk/src/mex/Makefile.am	(revision 6572)
+++ /issm/trunk/src/mex/Makefile.am	(revision 6573)
@@ -57,4 +57,5 @@
 				Reducevectorgtos\
 				Reducevectorgtof\
+				Response\
 				Scotch\
 				Solver\
@@ -260,4 +261,7 @@
 									Reducevectorgtof/Reducevectorgtof.h
 
+Response_SOURCES = Response/Response.cpp\
+									Response/Response.h
+
 Scotch_SOURCES = Scotch/Scotch.cpp\
 			  Scotch/Scotch.h
Index: /issm/trunk/src/mex/Response/Response.cpp
===================================================================
--- /issm/trunk/src/mex/Response/Response.cpp	(revision 6573)
+++ /issm/trunk/src/mex/Response/Response.cpp	(revision 6573)
@@ -0,0 +1,70 @@
+/*\file Response.c
+ *\brief: compute misfit between modeled velocity and observed velocity
+ */
+
+#include "./Response.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
+
+	/*input datasets: */
+	Elements   *elements   = NULL;
+	Loads      *loads      = NULL;
+	Nodes      *nodes      = NULL;
+	Vertices   *vertices   = NULL;
+	Materials  *materials  = NULL;
+	Parameters *parameters = NULL;
+	char       *response   = NULL;
+	bool        process_units;
+
+	/* output datasets: */
+	double resp;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&ResponseUsage);
+
+	/*Input datasets: */
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchParams(&parameters,PARAMETERS);
+	FetchData(&response,RESPONSE);
+	FetchData(&process_units,PROCESSUNITS);
+
+	/*configure: */
+	elements->  Configure(elements,loads, nodes,vertices, materials,parameters);
+	nodes->     Configure(elements,loads, nodes,vertices, materials,parameters);
+	loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
+
+	/*!Call core code: */
+	Responsex(&resp, elements,nodes,vertices, loads,materials,parameters,response,process_units);
+
+	/*write output : */
+	WriteData(OUTPUT,resp);
+
+	/*Free ressources: */
+	delete elements;
+	delete nodes;
+	delete vertices;
+	delete loads;
+	delete materials;
+	delete parameters;
+	xfree((void**)&response);
+
+	/*end module: */
+	MODULEEND();
+}
+
+void ResponseUsage(void)
+{
+	_printf_(true,"\n");
+	_printf_(true,"   usage: [resp] = %s(elements,nodes,vertices,loads,materials,parameters,response,process_units);\n",__FUNCT__);
+	_printf_(true,"\n");
+	_printf_(true,"      response:      string ('MinVel', 'MassFlux', 'MaxAbsVx',...)\n");
+	_printf_(true,"      process_units: bolean\n");
+	_printf_(true,"\n");
+}
Index: /issm/trunk/src/mex/Response/Response.h
===================================================================
--- /issm/trunk/src/mex/Response/Response.h	(revision 6573)
+++ /issm/trunk/src/mex/Response/Response.h	(revision 6573)
@@ -0,0 +1,40 @@
+/*
+	Response.h
+*/
+
+#ifndef _COSTFUNCTION_H
+#define _COSTFUNCTION_H
+
+/* local prototypes: */
+void ResponseUsage(void);
+
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "Response"
+
+/* serial input macros: */
+#define ELEMENTS (mxArray*)prhs[0]
+#define NODES (mxArray*)prhs[1]
+#define VERTICES (mxArray*)prhs[2]
+#define LOADS (mxArray*)prhs[3]
+#define MATERIALS (mxArray*)prhs[4]
+#define PARAMETERS (mxArray*)prhs[5]
+#define RESPONSE (mxArray*)prhs[6]
+#define PROCESSUNITS (mxArray*)prhs[7]
+
+/* serial output macros: */
+#define OUTPUT (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  8
+
+#endif  /* _COSTFUNCTION_H */
+
+
+
