Index: /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 13863)
+++ /issm/trunk-jpl/src/wrappers/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 13864)
@@ -11,5 +11,5 @@
 		filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)
 	output:
-		segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment 
+		segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremities for a segment 
 		belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the 
 		mesh.
@@ -26,5 +26,5 @@
 	_printLine_("        filename: name of Argus style .exp file containing the segments (can be groups of disconnected segments)");
 	_printLine_("   output:");
-	_printLine_("        segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremitis for a segment ");
+	_printLine_("        segments: array made of x1,y1,x2,y2,element_id lines (x1,y1) and (x2,y2) are segment extremities for a segment ");
 	_printLine_("        belonging to the elemnt_id element. there are as many lines in segments as there are segments intersecting the ");
 	_printLine_("        mesh.");
@@ -45,5 +45,5 @@
 	
 	//contours
-	mxArray*  matlabstructure=NULL;
+	DataSet *domain = NULL;
 	Contour<double>** contours=NULL;
 	int       numcontours;
@@ -57,9 +57,6 @@
 	MODULEBOOT();
 
-	/*checks on arguments on the matlab side: */
-	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&MeshProfileIntersectionUsage);
-
-	/*First, call expread on filename to build a contour array in the matlab workspace: */
-	mexCallMATLAB( 1, &matlabstructure, 1, (mxArray**)&FILENAME, "expread");
+	/*checks on arguments: */
+	CHECKARGUMENTS(NLHS,NRHS,&MeshProfileIntersectionUsage);
 
 	/*Fetch inputs: */
@@ -78,16 +75,10 @@
 
 	//contours
-	numcontours=mxGetNumberOfElements(matlabstructure);
+	FetchData(&domain,FILENAME);
+	// MeshProfileIntersectionx should be modified to take DataSet directly (and perhaps SeqMat and SeqVec).
+	numcontours=domain->Size();
 	contours=xNew<Contour<double>*>(numcontours);
-	for(i=0;i<numcontours;i++){
-		//allocate
-		contouri=xNew<Contour<double> >(1);
-		//retrieve dimension of this contour.
-		contouri->nods=(int)mxGetScalar(mxGetField(matlabstructure,i,"nods"));
-		//set pointers.
-		contouri->x=mxGetPr(mxGetField(matlabstructure,i,"x"));
-		contouri->y=mxGetPr(mxGetField(matlabstructure,i,"y"));
-		*(contours+i)=contouri;
-	}
+	for(i=0;i<numcontours;i++)
+		*(contours+i)=(Contour<double>*)domain->GetObjectByOffset(i);
 
 	/* Debugging of contours :{{{1*/
Index: /issm/trunk-jpl/src/wrappers/python/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/wrappers/python/Makefile.am	(revision 13863)
+++ /issm/trunk-jpl/src/wrappers/python/Makefile.am	(revision 13864)
@@ -33,4 +33,5 @@
 						EnumToString.la\
 						InterpFromMeshToMesh2d.la\
+						MeshProfileIntersection.la\
 						NodeConnectivity.la\
 						StringToEnum.la\
@@ -108,4 +109,8 @@
 InterpFromMeshToMesh2d_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB) $(MULTITHREADINGLIB)
 
+MeshProfileIntersection_la_SOURCES = ../MeshProfileIntersection/MeshProfileIntersection.cpp\
+										../MeshProfileIntersection/MeshProfileIntersection.h
+MeshProfileIntersection_la_LIBADD = ${deps} $(MPILIB) $(PETSCLIB)
+
 NodeConnectivity_la_SOURCES = ../NodeConnectivity/NodeConnectivity.cpp\
 										../NodeConnectivity/NodeConnectivity.h
