Index: /issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp	(revision 11934)
+++ /issm/trunk-jpl/src/c/shared/Exp/DomainOutlineRead.cpp	(revision 11935)
@@ -9,11 +9,12 @@
 #include "../Alloc/alloc.h"
 #include "../../include/include.h"
+#include "../../objects/objects.h"
 #include "../Exceptions/exceptions.h"
+#include "../../Container/DataSet.h"
 
 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole=true){
 
 	
-	/*Error management: */
-	int noerr=1;
+	/*indexing: */
 	int i,counter;
 
@@ -39,5 +40,4 @@
 	if ((fid=fopen(domainname,"r"))==NULL){
 		_error_("%s%s","could not find domain file ",domainname); 
-		noerr=0; goto cleanupandreturn;
 	}
 
@@ -95,5 +95,5 @@
 		/*Read vertices: */
 		for (i=0;i<n;i++){
-			fscanf(fid,"%20lf %20lf\n",x+i,y+i);
+			fscanf(fid,"%20lf %20lf\n",&x[i],&y[i]);
 		}
 
@@ -117,12 +117,4 @@
 	fclose(fid);
 
-	cleanupandreturn: 
-	/*Free ressources: */
-	if(!noerr){
-		xfree((void**)&x);
-		xfree((void**)&y);
-		n=-1;
-	}
-	
 	/*Assign output pointers: */
 	*pnprof=nprof;
@@ -132,5 +124,32 @@
 	if(pclosed)*pclosed=closed;
 	else       xfree((void**)&closed);
-	return noerr;
 }
 
+DataSet* DomainOutlineRead(char* domainname,bool whole=true){
+
+	/*indexing: */
+	int i;
+
+	/*intermediary: */
+	int nprof;
+	int* profnvertices=NULL;
+	double** pprofx=NULL;
+	double** pprofy=NULL;
+
+	Contour* contour=NULL;
+
+	/*output: */
+	DataSet* domain=NULL;
+
+	/*get domain outline from intermediary function:*/
+	DomainOutlineRead(&nprof,&profnvertices,&pprofx, &pprofy, NULL,domainname,whole);
+
+	/*now create dataset of contours: */
+	domain=new DataSet(0);
+
+	for(i=0;i<nprof;i++){
+		domain->AddObject(new Contour(i,profnvertices[i],pprofx[i],pprofy[i],1));
+	}
+
+	return domain;
+}
Index: /issm/trunk-jpl/src/c/shared/Exp/exp.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exp/exp.h	(revision 11934)
+++ /issm/trunk-jpl/src/c/shared/Exp/exp.h	(revision 11935)
@@ -13,7 +13,10 @@
 int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
 int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue);
-int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole);
 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname,bool whole);
 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue);
 
+int      DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole);
+DataSet* DomainOutlineRead(char* domainname,bool whole);
+
+
 #endif
Index: /issm/trunk-jpl/src/c/shared/Matlab/CheckNumMatlabArguments.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/CheckNumMatlabArguments.cpp	(revision 11934)
+++ /issm/trunk-jpl/src/c/shared/Matlab/CheckNumMatlabArguments.cpp	(revision 11935)
@@ -3,5 +3,12 @@
  */
 
-#ifdef _SERIAL_
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 #include "../Exceptions/exceptions.h"
Index: sm/trunk-jpl/src/c/shared/Matlab/ModuleBoot.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/ModuleBoot.cpp	(revision 11934)
+++ 	(revision )
@@ -1,66 +1,0 @@
-/* \file ModuleBoot.cpp
- * \brief Carry out operations needed to boot, for example, petsc, MPI, plapack, etc ... 
- * at the beginning of a module
- */
-
-#include "../../toolkits/toolkits.h"
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-
-int my_rank;
-int num_procs;
-
-int ModuleBoot(void){
-	
-	/*Declare my_rank and num_procs global variables!: */
-	my_rank=0;
-	num_procs=1;
-
-	/*Some test for MPI_Init crash with mpich2 1.4 on larsen, just ignore*/
-	#ifdef _HAVE_PETSC_
-		#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 1
-		if(0){
-			int              mp_init = 0;
-			PetscErrorCode   ierr;
-			extern PetscBool PetscBeganMPI;
-			MPI_Initialized(&mp_init); 
-			if(mp_init!=1){
-				MPI_Init(NULL,NULL); 
-				PetscBeganMPI = PETSC_TRUE;
-				ierr=PetscInitializeNoArguments();CHKERRQ(ierr);
-			} 
-		}
-		else if (0){
-			PetscErrorCode   ierr;
-			PetscBool flg;
-			ierr=PetscInitialized(&flg);CHKERRQ(ierr);
-			if(flg){
-				extern PetscBool PetscBeganMPI;
-				PetscBeganMPI = PETSC_FALSE;
-				ierr=PetscFinalize();CHKERRQ(ierr);
-			}
-			ierr=PetscInitializeNoArguments();CHKERRQ(ierr);
-			ierr=PetscPopSignalHandler();CHKERRQ(ierr);
-		}
-		#endif
-
-		/*Initialize Petsc: */
-		PetscInitializeNoArguments();
-	#else
-		#ifdef _HAVE_MPI_
-		int mp_init = 0;
-		MPI_Initialized(&mp_init); 
-		if(!mp_init){
-			MPI_Init(NULL,NULL); 
-		}
-		#else
-		/*Do nothing*/
-		#endif
-	#endif
-	return 1;
-}
Index: sm/trunk-jpl/src/c/shared/Matlab/ModuleEnd.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/ModuleEnd.cpp	(revision 11934)
+++ 	(revision )
@@ -1,25 +1,0 @@
-/* \file ModuleBoot.cpp
- * \brief Carry out operations needed to boot, for example, petsc, MPI, plapack, etc ... 
- * at the beginning of a module
- */
-
-#include "../../toolkits/toolkits.h"
-
-int ModuleEnd(void){
-
-	#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 1
-	if(0){
-		PetscBool        flg;
-		PetscErrorCode   ierr;
-		extern PetscBool PetscBeganMPI;
-
-		/*Close PETSc but do not close MPI*/
-		PetscBeganMPI = PETSC_FALSE;
-		ierr=PetscFinalize();CHKERRQ(ierr);
-	}
-	#else
-		/*Do nothing*/
-	#endif
-
-	return 1;
-}
Index: /issm/trunk-jpl/src/c/shared/Matlab/matlabshared.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/matlabshared.h	(revision 11934)
+++ /issm/trunk-jpl/src/c/shared/Matlab/matlabshared.h	(revision 11935)
@@ -8,10 +8,4 @@
 #include "../../objects/objects.h"
 
-
-#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
-int ModuleBoot(void);
-int ModuleEnd(void);
-#endif
-
 #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
Index: sm/trunk-jpl/src/c/shared/Matlab/mxGetField.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Matlab/mxGetField.cpp	(revision 11934)
+++ 	(revision )
@@ -1,12 +1,0 @@
-/* \file mxGetField.c: 
- * \brief: placeholder for parallel mxGetField dummy routine.
- * This routine does nothing, just returns a NULL pointer, and is only present in the parallel compilation 
- * to "mirror" the mxGetField matlab routine. This makes coding of parallel applications a lot easier. 
- * It is  used in ModelProcessorx/Model.c for example.
- */
-
-#include <stdio.h>
-
-#ifdef _PARALLEL_
-FILE* mxGetField(FILE* fid,int number, char* field){ return fid; }
-#endif
Index: /issm/trunk-jpl/src/c/shared/Wrapper/ModuleBoot.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Wrapper/ModuleBoot.cpp	(revision 11935)
+++ /issm/trunk-jpl/src/c/shared/Wrapper/ModuleBoot.cpp	(revision 11935)
@@ -0,0 +1,59 @@
+/* \file ModuleBoot.cpp
+ * \brief Carry out operations needed to boot, for example, petsc, MPI, plapack, etc ... 
+ * at the beginning of a module
+ */
+
+#include "../../toolkits/toolkits.h"
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+
+int ModuleBoot(void){
+	
+	/*Some test for MPI_Init crash with mpich2 1.4 on larsen, just ignore*/
+	#ifdef _HAVE_PETSC_
+		#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 1
+		if(0){
+			int              mp_init = 0;
+			PetscErrorCode   ierr;
+			extern PetscBool PetscBeganMPI;
+			MPI_Initialized(&mp_init); 
+			if(mp_init!=1){
+				MPI_Init(NULL,NULL); 
+				PetscBeganMPI = PETSC_TRUE;
+				ierr=PetscInitializeNoArguments();CHKERRQ(ierr);
+			} 
+		}
+		else if (0){
+			PetscErrorCode   ierr;
+			PetscBool flg;
+			ierr=PetscInitialized(&flg);CHKERRQ(ierr);
+			if(flg){
+				extern PetscBool PetscBeganMPI;
+				PetscBeganMPI = PETSC_FALSE;
+				ierr=PetscFinalize();CHKERRQ(ierr);
+			}
+			ierr=PetscInitializeNoArguments();CHKERRQ(ierr);
+			ierr=PetscPopSignalHandler();CHKERRQ(ierr);
+		}
+		#endif
+
+		/*Initialize Petsc: */
+		PetscInitializeNoArguments();
+	#else
+		#ifdef _HAVE_MPI_
+		int mp_init = 0;
+		MPI_Initialized(&mp_init); 
+		if(!mp_init){
+			MPI_Init(NULL,NULL); 
+		}
+		#else
+		/*Do nothing*/
+		#endif
+	#endif
+	return 1;
+}
Index: /issm/trunk-jpl/src/c/shared/Wrapper/ModuleEnd.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Wrapper/ModuleEnd.cpp	(revision 11935)
+++ /issm/trunk-jpl/src/c/shared/Wrapper/ModuleEnd.cpp	(revision 11935)
@@ -0,0 +1,31 @@
+/* \file ModuleBoot.cpp
+ * \brief Carry out operations needed to boot, for example, petsc, MPI, plapack, etc ... 
+ * at the beginning of a module
+ */
+
+#include "../../toolkits/toolkits.h"
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+int ModuleEnd(void){
+
+	#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 1
+	if(0){
+		PetscBool        flg;
+		PetscErrorCode   ierr;
+		extern PetscBool PetscBeganMPI;
+
+		/*Close PETSc but do not close MPI*/
+		PetscBeganMPI = PETSC_FALSE;
+		ierr=PetscFinalize();CHKERRQ(ierr);
+	}
+	#else
+		/*Do nothing*/
+	#endif
+
+	return 1;
+}
Index: /issm/trunk-jpl/src/c/shared/Wrapper/wrappershared.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Wrapper/wrappershared.h	(revision 11935)
+++ /issm/trunk-jpl/src/c/shared/Wrapper/wrappershared.h	(revision 11935)
@@ -0,0 +1,15 @@
+/* \file Wrapper.h
+ * \brief  header file for all routines related to wrapper.
+ */
+
+#ifndef _WRAPPER_SHARED_H_
+#define _WRAPPER_SHARED_H_
+
+#include "../../objects/objects.h"
+
+#ifdef _SERIAL_
+int ModuleBoot(void);
+int ModuleEnd(void);
+#endif
+
+#endif
Index: /issm/trunk-jpl/src/c/shared/shared.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/shared.h	(revision 11934)
+++ /issm/trunk-jpl/src/c/shared/shared.h	(revision 11935)
@@ -19,4 +19,5 @@
 #include "Bamg/shared.h"
 #include "Matlab/matlabshared.h"
+#include "Wrapper/wrappershared.h"
 
 #endif
