Index: /issm/trunk/src/mex/MassFlux/MassFlux.cpp
===================================================================
--- /issm/trunk/src/mex/MassFlux/MassFlux.cpp	(revision 6570)
+++ /issm/trunk/src/mex/MassFlux/MassFlux.cpp	(revision 6570)
@@ -0,0 +1,68 @@
+/*\file MassFlux.c
+ *\brief: compute mass flux along a profile.
+ */
+
+#include "./MassFlux.h"
+
+void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
+
+	/*input datasets: */
+	Elements* elements=NULL;
+	Nodes* nodes=NULL;
+	Vertices* vertices=NULL;
+	Loads* loads=NULL;
+	Materials* materials=NULL;
+	Parameters* parameters=NULL;
+	bool process_units=false;
+
+	double*  segments=NULL;
+	int      num_segments;
+
+	/* output datasets: */
+	double   mass_flux;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&MassFluxUsage);
+
+	/*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);
+	parameters->FindParam(&segments,&num_segments,NULL,QmuMassFluxSegmentsEnum);
+
+	/*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);
+
+	/*!Compute mass flux along the profile: */
+	MassFluxx(&mass_flux, elements,nodes,vertices,loads,materials,parameters,segments,num_segments,process_units);
+
+
+	/*write output datasets: */
+	WriteData(RESPONSE,mass_flux);
+	
+	/*Free ressources: */
+	delete elements;
+	delete nodes;
+	delete vertices;
+	delete loads;
+	delete materials;
+	delete parameters;
+
+	/*end module: */
+	MODULEEND();
+}
+
+void MassFluxUsage(void)
+{
+	_printf_("\n");
+	_printf_("   usage: [mass_flux] = %s(elements,nodes,vertices,loads,materials,parameters);\n",__FUNCT__);
+	_printf_("\n");
+}
Index: /issm/trunk/src/mex/MassFlux/MassFlux.h
===================================================================
--- /issm/trunk/src/mex/MassFlux/MassFlux.h	(revision 6570)
+++ /issm/trunk/src/mex/MassFlux/MassFlux.h	(revision 6570)
@@ -0,0 +1,40 @@
+
+/*
+	MassFlux.h
+*/
+
+
+#ifndef _MASSFLUX_H
+#define _MASSFLUX_H
+
+/* local prototypes: */
+void MassFluxUsage(void);
+
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
+
+#undef __FUNCT__ 
+#define __FUNCT__  "MassFlux"
+
+/* 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 UG (mxArray*)prhs[6]
+
+/* serial output macros: */
+#define RESPONSE (mxArray**)&plhs[0]
+
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  1
+#undef NRHS
+#define NRHS  7
+
+
+#endif  /* _MASSFLUX_H */
