Index: /issm/trunk/src/mex/Response/Response.cpp
===================================================================
--- /issm/trunk/src/mex/Response/Response.cpp	(revision 6688)
+++ /issm/trunk/src/mex/Response/Response.cpp	(revision 6689)
@@ -16,7 +16,4 @@
 	char       *response   = NULL;
 	bool        process_units;
-
-	/* output datasets: */
-	double resp;
 
 	/*Boot module: */
@@ -41,9 +38,47 @@
 	loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
 
-	/*!Call core code: */
-	Responsex(&resp, elements,nodes,vertices, loads,materials,parameters,response,process_units);
+	/*for MassFlux, loop over all profiles: */
+	if (StringToEnum(response) == MassFluxEnum) {
+		int  counter;
 
-	/*write output : */
-	WriteData(OUTPUT,resp);
+		/*all segments: */
+		double** array=NULL;
+		int      M;
+
+		/* output datasets: */
+		double*  resp;
+
+		/*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
+		if(!parameters->FindParam(&array,&M,NULL,NULL,QmuMassFluxSegmentsEnum))_error_(" could not find QmuMassFluxSegmentsEnum");
+
+		/*Retrieve index of segments being used for MassFlux computation: */
+//		if(!parameters->FindParam(&counter,IndexEnum))_error_(" could not find IndexEnum");
+
+		resp=(double*)xcalloc(M,sizeof(double));
+		for (counter=0; counter<M; counter++) {
+			/*indexed response: plug index into parameters and call response module: */
+			parameters->SetParam(counter+1,IndexEnum);
+
+			/*!Call core code: */
+			Responsex(&resp[counter], elements,nodes,vertices, loads,materials,parameters,response,process_units);
+		}
+
+		/*write output : */
+		WriteData(OUTPUT,resp,M);
+//		WriteData does not copy data, so don't free (jes, 11/30/10)
+//		xfree((void**)&resp);
+	}
+
+	/*otherwise a single call: */
+	else {
+		/* output datasets: */
+		double   resp;
+
+		/*!Call core code: */
+		Responsex(&resp, elements,nodes,vertices, loads,materials,parameters,response,process_units);
+
+		/*write output : */
+		WriteData(OUTPUT,resp);
+	}
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Response/Response.h
===================================================================
--- /issm/trunk/src/mex/Response/Response.h	(revision 6688)
+++ /issm/trunk/src/mex/Response/Response.h	(revision 6689)
@@ -3,6 +3,6 @@
 */
 
-#ifndef _COSTFUNCTION_H
-#define _COSTFUNCTION_H
+#ifndef _RESPONSE_H
+#define _RESPONSE_H
 
 /* local prototypes: */
@@ -12,4 +12,5 @@
 #include "../../c/Container/Container.h"
 #include "../../c/shared/shared.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
 
 #undef __FUNCT__ 
@@ -35,5 +36,5 @@
 #define NRHS  8
 
-#endif  /* _COSTFUNCTION_H */
+#endif  /* _RESPONSE_H */
 
 
