Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 23648)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 23649)
@@ -1436,7 +1436,6 @@
 						option->value = scalar;
 						option->name  = optionname;
-						option->numel = 1;
-						option->ndims = 1;
-						option->size  = NULL;
+						option->size[0] = 1;
+						option->size[1] = 1;
 						options->AddOption(option);
 					  }
@@ -1467,7 +1466,6 @@
 					option->value = string;
 					option->name  = optionname;
-					option->numel = 1;
-					option->ndims = 1;
-					option->size  = NULL;
+					option->size[0] = 1;
+					option->size[1] = 1;
 					options->AddOption(option);
 
@@ -1503,7 +1501,6 @@
 							option->value = scalar;
 							option->name  = optionname;
-							option->numel = 1;
-							option->ndims = 1;
-							option->size  = NULL;
+							option->size[0] = 1;
+							option->size[1] = 1;
 							options->AddOption(option);
 						  }
@@ -1534,7 +1531,6 @@
 						option->value = string;
 						option->name  = optionname;
-						option->numel = 1;
-						option->ndims = 1;
-						option->size  = NULL;
+						option->size[0] = 1;
+						option->size[1] = 1;
 						options->AddOption(option);
 						  }
Index: /issm/trunk-jpl/src/c/classes/Options/GenericOption.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Options/GenericOption.h	(revision 23648)
+++ /issm/trunk-jpl/src/c/classes/Options/GenericOption.h	(revision 23649)
@@ -23,26 +23,16 @@
 
 	public:
-
 		char       *name;
 		OptionType  value;
-
-		int         numel;   //in case OptionType is an array
-		int         ndims;   //in case OptionType is a multi-dimensional array: */
-		int        *size;
+		int         size[2];
 
 		/*GenericOption constructors, destructors*/
 		GenericOption(){ /*{{{*/
-
-			name   = NULL;
-			numel  = 0;
-			ndims  = 0;
-			size   = NULL;
-
+			name = NULL;
+			size[0] = 0;
+			size[1] = 0;
 		} /*}}}*/
 		~GenericOption(){ /*{{{*/
-
-			if(name)   xDelete<char>(name);
-			if(size)   xDelete<int>(size);
-
+			if(name) xDelete<char>(name);
 		} /*}}}*/
 
@@ -52,28 +42,17 @@
 		};/*}}}*/
 		void DeepEcho(){ /*{{{*/
-
 			char  indent[81]="";
 			this->DeepEcho(indent);
-
 		} /*}}}*/
 		void DeepEcho(char* indent){ /*{{{*/
 
 			char  cstr[81];
-			bool  flag=true;
 
-			if(flag) _printf0_(indent << "         name: \"" << name << "\"\n");
-			if(flag) _printf0_(indent << "         numel: " << numel << "\n");
-			if(flag) _printf0_(indent << "         ndims: " << ndims << "\n");
-			if(size){
-				StringFromSize(cstr,size,ndims);
-				if(flag) _printf0_(indent << "          size: " << cstr << "\n");
-			}
-			else if(flag) _printf0_(indent << "          size: [empty]\n");
-			_printf_(indent << "         value: " << value << "\n");;
+			_printf_(indent << "          name: \"" << name << "\"\n");
+			_printf_(indent << "          size: " << size[0] <<"x"<<size[1]<< "\n");
+			_printf_(indent << "         value: " << value << "\n");
 		} /*}}}*/
 		void Echo(){ /*{{{*/
-
 			this->DeepEcho();
-
 		} /*}}}*/
 		int  Id(){/*{{{*/
@@ -91,13 +70,4 @@
 			return name;
 		};/*}}}*/
-		int   NDims(){/*{{{*/
-			return ndims;
-		};/*}}}*/
-		int   NumEl(){/*{{{*/
-			return numel;
-		};/*}}}*/
-		int*  Size(){/*{{{*/
-			return size;
-		};/*}}}*/
 };
 
@@ -107,6 +77,7 @@
 
 	/*Copy vector*/
-	IssmPDouble* outvalue=xNew<IssmPDouble>(this->NumEl());
-	for(int i=0;i<this->NumEl();i++) outvalue[i]=this->value[i];
+	int numel = this->size[0]*this->size[1];
+	IssmPDouble* outvalue=xNew<IssmPDouble>(numel);
+	for(int i=0;i<numel;i++) outvalue[i]=this->value[i];
 
 	/*Assign output pointer*/
@@ -117,6 +88,7 @@
 
 	/*Copy vector*/
-	IssmDouble* outvalue=xNew<IssmDouble>(this->NumEl());
-	for(int i=0;i<this->NumEl();i++) outvalue[i]=this->value[i];
+	int numel = this->size[0]*this->size[1];
+	IssmDouble* outvalue=xNew<IssmDouble>(numel);
+	for(int i=0;i<numel;i++) outvalue[i]=this->value[i];
 
 	/*Assign output pointer*/
@@ -135,8 +107,6 @@
 /*Special destructors when there is a pointer*/
 template <> inline GenericOption<char*>::~GenericOption(){ /*{{{*/
-
-	if(name)   xDelete<char>(name);
-	if(size)   xDelete<int>(size);
-	if(value)  xDelete<char>(value);
+	if(name)  xDelete<char>(name);
+	if(value) xDelete<char>(value);
 } 
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Options/Option.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Options/Option.h	(revision 23648)
+++ /issm/trunk-jpl/src/c/classes/Options/Option.h	(revision 23649)
@@ -25,13 +25,10 @@
 		virtual void  Echo()= 0;
 		int           Id(){_error_("Not implemented yet"); };
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
-		int           ObjectEnum(){return OptionEnum;              };
+		void          Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		int           ObjectEnum(){return OptionEnum;};
 
 
 		/*virtual functions: */
 		virtual char* Name()=0;
-		virtual int   NDims()=0;
-		virtual int   NumEl()=0;
-		virtual int*  Size()=0;
 
 };
Index: /issm/trunk-jpl/src/c/cores/transient_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/transient_core.cpp	(revision 23648)
+++ /issm/trunk-jpl/src/c/cores/transient_core.cpp	(revision 23649)
@@ -152,7 +152,6 @@
 		memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
 		odouble->value=+9999.;
-		odouble->numel=1;
-		odouble->ndims=1;
-		odouble->size=NULL;
+		odouble->size[0]=1;
+		odouble->size[1]=1;
 		options->AddOption(odouble);
 		InterpFromMeshToMesh2dx(&icebase_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
@@ -169,7 +168,6 @@
 		memcpy(odouble2->name,name2,(strlen(name2)+1)*sizeof(char));
 		odouble2->value=+1.;
-		odouble2->numel=1;
-		odouble2->ndims=1;
-		odouble2->size=NULL;
+		odouble2->size[0]=1;
+		odouble2->size[1]=1;
 		options2->AddOption(odouble2);
 		InterpFromMeshToMesh2dx(&icemask_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
@@ -294,7 +292,6 @@
 			memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
 			odouble->value=+9999.;
-			odouble->numel=1;
-			odouble->ndims=1;
-			odouble->size=NULL;
+			odouble->size[0]=1;
+			odouble->size[1]=1;
 			options->AddOption(odouble);
 			InterpFromMeshToMesh2dx(&icebase_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
@@ -310,7 +307,6 @@
 			memcpy(odouble2->name,name2,(strlen(name2)+1)*sizeof(char));
 			odouble2->value=+1.;
-			odouble2->numel=1;
-			odouble2->ndims=1;
-			odouble2->size=NULL;
+			odouble2->size[0]=1;
+			odouble2->size[1]=1;
 			options2->AddOption(odouble2);
 			InterpFromMeshToMesh2dx(&icemask_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
Index: /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp	(revision 23648)
+++ /issm/trunk-jpl/src/wrappers/matlab/io/FetchMatlabData.cpp	(revision 23649)
@@ -13,6 +13,5 @@
 
 /*Primitive data types*/
-/*FUNCTION FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/
-void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){
+void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){/*{{{*/
 
 	double*  outmatrix=NULL;
@@ -56,56 +55,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/
-void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
-
-	int     outmatrix_numel,outmatrix_ndims;
-	double *outmatrix       = NULL;
-	int    *outmatrix_size  = NULL;
-
-	if(mxIsEmpty(dataref) ){
-		/*Nothing to pick up. Just initialize matrix pointer to NULL: */
-		outmatrix_numel = 0;
-		outmatrix_ndims = 0;
-		outmatrix_size  = NULL;
-		outmatrix       = NULL;
-	}
-	else if( mxIsClass(dataref,"double") || 
-				mxIsClass(dataref,"single") || 
-				mxIsClass(dataref,"int16") || 
-				mxIsClass(dataref,"int8") || 
-				mxIsClass(dataref,"uint8")){
-
-		/*Check dataref is not pointing to NaN: */
-		if (mxIsNaN(*(mxGetPr(dataref))) && (mxGetNumberOfElements(dataref)==1)){
-			outmatrix_numel = 0;
-			outmatrix_ndims = 0;
-			outmatrix_size  = NULL;
-			outmatrix       = NULL;
-		}
-		else{
-			if(!mxIsClass(dataref,"double") && !mxIsClass(dataref,"single")){
-				_printf_("Warning: converting matlab data from '" << mxGetClassName(dataref) << "' to 'double'\n");
-			}
-			/*Convert matlab n-dim array to double* matrix: */
-			_error_("not supported");
-			//MatlabNArrayToNArray(&outmatrix,&outmatrix_numel,&outmatrix_ndims,&outmatrix_size,dataref);
-		}
-	}
-	else{
-		/*This is an error: we don't have the correct input!: */
-		_error_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
-	}
-
-	/*Assign output pointers:*/
-	*pmatrix=outmatrix;
-	if (pnumel)*pnumel=outmatrix_numel;
-	if (pndims)*pndims=outmatrix_ndims;
-	if (psize )*psize =outmatrix_size;
-	else xDelete<int>(outmatrix_size);
-
-}
-/*}}}*/
-/*FUNCTION FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/
-void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){
+void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){/*{{{*/
 
 	int     i,outmatrix_rows,outmatrix_cols;
@@ -154,6 +102,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{*/
-void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){
+void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){/*{{{*/
 
 	int     i,outmatrix_rows,outmatrix_cols;
@@ -196,73 +143,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/
-void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
-
-	int      i;
-	int      outmatrix_numel,outmatrix_ndims;
-	int*     outmatrix_size=NULL;
-	double*  doublematrix=NULL;
-	bool*    outmatrix=NULL;
-
-	if(mxIsEmpty(dataref) ){
-		/*Nothing to pick up. Just initialize matrix pointer to NULL: */
-		outmatrix_numel=0;
-		outmatrix_ndims=0;
-		outmatrix_size =NULL;
-		outmatrix=NULL;
-	}
-	else if (mxIsClass(dataref,"logical") ){
-
-		/*Check dataref is not pointing to NaN: */
-		if ( mxIsNaN(*((bool*)mxGetData(dataref))) && (mxGetNumberOfElements(dataref)==1) ){
-			outmatrix_numel=0;
-			outmatrix_ndims=0;
-			outmatrix_size =NULL;
-			outmatrix=NULL;
-		}
-		else{
-
-			/*Convert matlab n-dim array to bool* matrix: */
-			_error_("not supported");
-			//MatlabNArrayToNArray(&outmatrix,&outmatrix_numel,&outmatrix_ndims,&outmatrix_size,dataref);
-		}
-	}
-	else if (mxIsClass(dataref,"double") ){
-
-		/*Check dataref is not pointing to NaN: */
-		if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetNumberOfElements(dataref)==1) ){
-			outmatrix_numel=0;
-			outmatrix_ndims=0;
-			outmatrix_size =NULL;
-			outmatrix=NULL;
-		}
-		else{
-
-			/*Convert matlab n-dim array to double* matrix: */
-			_error_("not supported");
-			//MatlabNArrayToNArray(&doublematrix,&outmatrix_numel,&outmatrix_ndims,&outmatrix_size,dataref);
-
-			/*Convert double matrix into bool matrix: */
-			outmatrix=xNew<bool>(outmatrix_numel);
-			for(i=0;i<outmatrix_numel;i++)outmatrix[i]=(bool)doublematrix[i];
-			xDelete<double>(doublematrix);
-		}
-	}
-	else{
-		/*This is an error: we don't have the correct input!: */
-		_error_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
-	}
-
-	/*Assign output pointers:*/
-	*pmatrix=outmatrix;
-	if (pnumel)*pnumel=outmatrix_numel;
-	if (pndims)*pndims=outmatrix_ndims;
-	if (psize )*psize =outmatrix_size;
-	else xDelete<int>(outmatrix_size);
-
-}
-/*}}}*/
-/*FUNCTION FetchData(double** pvector,int* pM,const mxArray* dataref){{{*/
-void FetchData(double** pvector,int* pM,const mxArray* dataref){
+void FetchData(double** pvector,int* pM,const mxArray* dataref){/*{{{*/
 
 	double* outvector=NULL;
@@ -285,6 +164,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{*/
-void FetchData(int** pvector,int* pM,const mxArray* dataref){
+void FetchData(int** pvector,int* pM,const mxArray* dataref){/*{{{*/
 
 	int    i;
@@ -317,6 +195,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{*/
-void FetchData(bool** pvector,int* pM,const mxArray* dataref){
+void FetchData(bool** pvector,int* pM,const mxArray* dataref){/*{{{*/
 
 	int    i;
@@ -349,6 +226,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{*/
-void FetchData(float** pvector,int* pM,const mxArray* dataref){
+void FetchData(float** pvector,int* pM,const mxArray* dataref){/*{{{*/
 
 	int    i;
@@ -381,6 +257,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{*/
-void FetchData(char** pstring,const mxArray* dataref){
+void FetchData(char** pstring,const mxArray* dataref){/*{{{*/
 
 	char* outstring=NULL;
@@ -402,40 +277,5 @@
 	*pstring=outstring;
 }/*}}}*/
-/*FUNCTION FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{*/
-void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
-
-	int      outmatrix_numel,outmatrix_ndims;
-	int*     outmatrix_size=NULL;
-	char*    outmatrix=NULL;
-
-	if(mxIsEmpty(dataref) ){
-		/*Nothing to pick up. Just initialize matrix pointer to NULL: */
-		outmatrix_numel=0;
-		outmatrix_ndims=0;
-		outmatrix_size =NULL;
-		outmatrix=NULL;
-	}
-	else if (mxIsClass(dataref,"char") ){
-
-		/*Convert matlab n-dim array to char* matrix: */
-		_error_("not supported");
-		//MatlabNArrayToNArray(&outmatrix,&outmatrix_numel,&outmatrix_ndims,&outmatrix_size,dataref);
-	}
-	else{
-		/*This is an error: we don't have the correct input!: */
-		_error_("Input parameter of class " << mxGetClassName(dataref) << " not supported yet");
-	}
-
-	/*Assign output pointers:*/
-	*pmatrix=outmatrix;
-	if (pnumel)*pnumel=outmatrix_numel;
-	if (pndims)*pndims=outmatrix_ndims;
-	if (psize )*psize =outmatrix_size;
-	else xDelete<int>(outmatrix_size);
-
-}
-/*}}}*/
-/*FUNCTION FetchData(double* pscalar,const mxArray* dataref){{{*/
-void FetchData(double* pscalar,const mxArray* dataref){
+void FetchData(double* pscalar,const mxArray* dataref){/*{{{*/
 
 	double scalar;
@@ -453,6 +293,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{*/
-void FetchData(int* pinteger,const mxArray* dataref){
+void FetchData(int* pinteger,const mxArray* dataref){/*{{{*/
 
 	int integer;
@@ -470,6 +309,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{*/
-void FetchData(bool* pboolean,const mxArray* dataref){
+void FetchData(bool* pboolean,const mxArray* dataref){/*{{{*/
 
 	bool* mxbool_ptr=NULL;
@@ -489,6 +327,5 @@
 
 /*ISSM objects*/
-/*FUNCTION FetchData(BamgGeom** pbamggeom,const mxArray* dataref){{{*/
-void FetchData(BamgGeom** pbamggeom,const mxArray* dataref){
+void FetchData(BamgGeom** pbamggeom,const mxArray* dataref){/*{{{*/
 
 	/*Initialize output*/
@@ -508,6 +345,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){{{*/
-void FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){
+void FetchData(BamgMesh** pbamgmesh,const mxArray* dataref){/*{{{*/
 
 	/*Initialize output*/
@@ -528,6 +364,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(BamgOpts** pbamgopts,const mxArray* dataref){{{*/
-void FetchData(BamgOpts** pbamgopts,const mxArray* dataref){
+void FetchData(BamgOpts** pbamgopts,const mxArray* dataref){/*{{{*/
 
 	/*Initialize output*/
@@ -570,6 +405,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(Options** poptions,const mxArray** pdataref){{{*/
-void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref){
+void FetchData(Options** poptions,int istart, int nrhs,const mxArray** pdataref){/*{{{*/
 
 	char   *name   = NULL;
@@ -595,6 +429,5 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(Contours** pcontours,const mxArray* dataref){{{*/
-void FetchData(Contours** pcontours,const mxArray* dataref){
+void FetchData(Contours** pcontours,const mxArray* dataref){/*{{{*/
 
 	int             numcontours,index,test1,test2;
@@ -674,112 +507,58 @@
 
 /*Toolkit*/
-/*FUNCTION MatlabMatrixToDoubleMatrix {{{*/
-int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){
-
-	int        i,j,count,rows,cols;
-
-	/*output: */
-	double* matrix=NULL;
-
-	/*matlab indices: */
-	mwIndex*    ir=NULL;
-	mwIndex*    jc=NULL;
-
-	/*Ok, first check if we are dealing with a sparse or full matrix: */
-	if (mxIsSparse(mxmatrix)){
+int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix){/*{{{*/
+
+	/*Get Matrix size*/
+	int rows=mxGetM(mxmatrix);
+	int cols=mxGetN(mxmatrix);
+
+	/*Return of Matrix is empty*/
+	if(rows*cols == 0){
+		*pmatrix      = NULL;
+		*pmatrix_rows = rows;
+		*pmatrix_cols = cols;
+		return 1;
+	}
+
+   /*Initialize output*/
+   double* matrix=xNewZeroInit<double>(rows*cols);
+
+	/*First check if we are dealing with a sparse matrix: */
+	if(mxIsSparse(mxmatrix)){
 
 		/*Dealing with sparse matrix: recover size first: */
 		double* pmxmatrix=(double*)mxGetPr(mxmatrix);
-		rows=mxGetM(mxmatrix);
-		cols=mxGetN(mxmatrix);
-
-		if(rows*cols){
-			matrix=xNewZeroInit<double>(rows*cols);
-
-			/*Now, get ir,jc and pr: */
-			ir=mxGetIr(mxmatrix);
-			jc=mxGetJc(mxmatrix);
-
-			/*Now, start inserting data into double* matrix: */
-			count=0;
-			for(i=0;i<cols;i++){
-				for(j=0;j<(jc[i+1]-jc[i]);j++){
-					matrix[rows*ir[count]+i]=pmxmatrix[count];
-					count++;
-				}
-			}
-		}
-
-	}
+
+      /*Now, get ir,jc and pr: */
+      mwIndex* ir=mxGetIr(mxmatrix);
+      mwIndex* jc=mxGetJc(mxmatrix);
+
+      /*Now, start inserting data into double* matrix: */
+      int count=0;
+      for(int i=0;i<cols;i++){
+         for(int j=0;j<(jc[i+1]-jc[i]);j++){
+            matrix[rows*ir[count]+i]=pmxmatrix[count];
+            count++;
+         }
+      }
+   }
 	else if(mxIsClass(mxmatrix,"double")){
-		/*Dealing with dense matrix: recover pointer and size: */
 		double* pmxmatrix=(double*)mxGetPr(mxmatrix);
-		rows=mxGetM(mxmatrix);
-		cols=mxGetN(mxmatrix);
-
-		/*Create serial matrix: */
-		if(rows*cols){
-			matrix=xNewZeroInit<double>(rows*cols);
-
-			for(i=0;i<rows;i++){
-				for(j=0;j<cols;j++){
-					matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
-				}
-			}
-		}
+      for(int i=0;i<rows;i++) for(int j=0;j<cols;j++) matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
 	}
 	else if(mxIsClass(mxmatrix,"single")){
-		/*Dealing with dense matrix: recover pointer and size: */
 		float *pmxmatrix=(float*)mxGetPr(mxmatrix);
-		rows=mxGetM(mxmatrix);
-		cols=mxGetN(mxmatrix);
-
-		/*Create serial matrix: */
-		if(rows*cols){
-			matrix=xNewZeroInit<double>(rows*cols);
-
-			for(i=0;i<rows;i++){
-				for(j=0;j<cols;j++){
-					matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
-				}
-			}
-		}
+      for(int i=0;i<rows;i++) for(int j=0;j<cols;j++) matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
 	}
 	else if(mxIsClass(mxmatrix,"int16")){
-		/*Dealing with dense matrix: recover pointer and size: */
 		short int *pmxmatrix=(short*)mxGetPr(mxmatrix);
-		rows=mxGetM(mxmatrix);
-		cols=mxGetN(mxmatrix);
-
-		/*Create serial matrix: */
-		if(rows*cols){
-			matrix=xNewZeroInit<double>(rows*cols);
-
-			for(i=0;i<rows;i++){
-				for(j=0;j<cols;j++){
-					matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
-				}
-			}
-		}
+      for(int i=0;i<rows;i++) for(int j=0;j<cols;j++) matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
 	}
 	else if(mxIsClass(mxmatrix,"uint8")){
-		/*Dealing with dense matrix: recover pointer and size: */
-		char *pmxmatrix=(char*)mxGetPr(mxmatrix);
-		rows=mxGetM(mxmatrix);
-		cols=mxGetN(mxmatrix);
-
-		/*Create serial matrix: */
-		if(rows*cols){
-			matrix=xNewZeroInit<double>(rows*cols);
-
-			for(i=0;i<rows;i++){
-				for(j=0;j<cols;j++){
-					matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
-				}
-			}
-		}
-	}
-	else{
-		_error_("Matlab matrix type Not implemented yet");
+      char *pmxmatrix=(char*)mxGetPr(mxmatrix);
+      for(int i=0;i<rows;i++) for(int j=0;j<cols;j++) matrix[cols*i+j]=(double)pmxmatrix[rows*j+i];
+	}
+	else{
+		_error_("Matlab matrix type "<<mxGetClassName(mxmatrix)<<" Not implemented yet");
 	}
 
@@ -791,6 +570,5 @@
 	return 1;
 }/*}}}*/
-/*FUNCTION mxGetAssignedField{{{*/
-mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number,const char* field){
+mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number,const char* field){/*{{{*/
 
 	/*Output*/
@@ -825,91 +603,79 @@
 }/*}}}*/
 
-GenericOption<double>* OptionDoubleParse( char* name, const mxArray* prhs[]){ /*{{{*/
-
-	GenericOption<double> *odouble = NULL;
-
-	/*check and parse the name  */
-	odouble=new GenericOption<double>();
-	odouble->name =xNew<char>(strlen(name)+1);
-	memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
-	FetchData(&odouble->value,prhs[0]);
-	odouble->numel=1;
-	odouble->ndims=1;
-	odouble->size=NULL;
-
-	return(odouble);
+/*Options*/
+Option* OptionParse(char* name, const mxArray* prhs[]){ /*{{{*/
+
+	/*Initialize output*/
+	Option  *option = NULL;
+
+	/*parse the value according to the matlab data type  */
+	if (mxIsClass(prhs[0],"double")  && (mxGetNumberOfElements(prhs[0])==1)){
+		option=(Option*)OptionDoubleParse(name,prhs);
+	}
+	else if(mxIsClass(prhs[0],"double")  && (mxGetNumberOfElements(prhs[0])>1)){
+		option=(Option*)OptionDoubleArrayParse(name,prhs);
+	}
+	else if(mxIsClass(prhs[0],"char")){
+		option=(Option*)OptionCharParse(name,prhs);
+	}
+	else {
+		_error_("Second argument value of option \""<< name <<"\" is of unrecognized class \""<< mxGetClassName(prhs[0]) <<"\".");
+	}
+
+	return option;
 }/*}}}*/
-GenericOption<double*>* OptionDoubleArrayParse( char* name, const mxArray* prhs[]){ /*{{{*/
-
-	GenericOption<double*> *odouble = NULL;
-
-	/*check and parse the name  */
-	odouble=new GenericOption<double*>();
-	odouble->name =xNew<char>(strlen(name)+1);
-	memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
+GenericOption<double>*  OptionDoubleParse(char* name, const mxArray* prhs[]){ /*{{{*/
+
+	/*Initialize option*/
+	GenericOption<double>* option=new GenericOption<double>();
+
+	/*Copy name*/
+	option->name =xNew<char>(strlen(name)+1);
+	memcpy(option->name,name,(strlen(name)+1)*sizeof(char));
+
+	/*Fetch data and initialize size*/
+	FetchData(&option->value,prhs[0]);
+   option->size[0] = 1;
+	option->size[1] = 1;
+
+	return option;
+}/*}}}*/
+GenericOption<double*>* OptionDoubleArrayParse(char* name, const mxArray* prhs[]){ /*{{{*/
+
+	/*Initialize option*/
+	GenericOption<double*> * option=new GenericOption<double*>();
+
+	/*Copy name*/
+	option->name =xNew<char>(strlen(name)+1);
+	memcpy(option->name,name,(strlen(name)+1)*sizeof(char));
 
 	/*check and parse the value  */
 	if (!mxIsClass(prhs[0],"double")){
-		_error_("Value of option \"" << odouble->name  << "\" must be class \"double\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
-	}
-	FetchData(&odouble->value,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]);
-
-	return(odouble);
+		_error_("Value of option \"" << option->name  << "\" must be class \"double\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
+	}
+
+	/*Fetch data and initialize size*/
+   FetchData(&option->value,&option->size[0],&option->size[1],prhs[0]);
+
+	return option;
 }/*}}}*/
-GenericOption<bool*>* OptionLogicalParse( char* name, const mxArray* prhs[]){ /*{{{*/
-
-	GenericOption<bool*> *ological = NULL;
-
-	/*check and parse the name  */
-	ological=new GenericOption<bool*>();
-	ological->name =xNew<char>(strlen(name)+1);
-	memcpy(ological->name,name,(strlen(name)+1)*sizeof(char));
+GenericOption<char*>*   OptionCharParse(char* name, const mxArray* prhs[]){ /*{{{*/
+
+	/*Initialize option*/
+	GenericOption<char*>* option=new GenericOption<char*>();
+
+	/*Copy name*/
+	option->name =xNew<char>(strlen(name)+1);
+	memcpy(option->name,name,(strlen(name)+1)*sizeof(char));
 
 	/*check and parse the value  */
-	if (!mxIsClass(prhs[0],"logical")){
-		_error_("Value of option \"" << ological->name  << "\" must be class \"logical\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
-	}
-	FetchData(&ological->value,&ological->numel,&ological->ndims,&ological->size,prhs[0]);
-
-	return(ological);
-}/*}}}*/
-GenericOption<char*>* OptionCharParse( char* name, const mxArray* prhs[]){ /*{{{*/
-
-	/*check and parse the name  */
-	GenericOption<char*>* ochar=new GenericOption<char*>();
-	ochar->name =xNew<char>(strlen(name)+1);
-	memcpy(ochar->name,name,(strlen(name)+1)*sizeof(char));
-
-	/*check and parse the value  */
-	if (!mxIsClass(prhs[0],"char")){
-		_error_("Value of option \"" << ochar->name  << "\" must be class \"char\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
-	}
-	//FetchData(&ochar->value,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]);
-	FetchData(&ochar->value,prhs[0]);
-	ochar->numel = strlen(name);
-	ochar->ndims = 2;
-	ochar->size = xNew<int>(2);
-	ochar->size[0] = ochar->numel;
-	ochar->size[1] = 1;
-
-	return(ochar);
-}/*}}}*/
-Option* OptionParse(char* name, const mxArray* prhs[]){ /*{{{*/
-
-	Option  *option = NULL;
-	mxArray *lhs[1];
-
-	/*parse the value according to the matlab data type  */
-	if     (mxIsClass(prhs[0],"double")  && (mxGetNumberOfElements(prhs[0])==1))
-	 option=(Option*)OptionDoubleParse(name,prhs);
-	else if(mxIsClass(prhs[0],"double")  && (mxGetNumberOfElements(prhs[0])!=1))
-	 option=(Option*)OptionDoubleArrayParse(name,prhs);
-	else if(mxIsClass(prhs[0],"logical"))
-	 option=(Option*)OptionLogicalParse(name,prhs);
-	else if(mxIsClass(prhs[0],"char"))
-	 option=(Option*)OptionCharParse(name,prhs);
-	else {
-		_error_("Second argument value of option \""<< name <<"\" is of unrecognized class \""<< mxGetClassName(prhs[0]) <<"\".");
-	}
+	if(!mxIsClass(prhs[0],"char")){
+		_error_("Value of option \"" << option->name  << "\" must be class \"char\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
+	}
+
+	/*Fetch data and initialize size*/
+	FetchData(&option->value,prhs[0]);
+	option->size[0] = strlen(name);
+	option->size[1] = 1;
 
 	return(option);
Index: /issm/trunk-jpl/src/wrappers/matlab/io/matlabio.h
===================================================================
--- /issm/trunk-jpl/src/wrappers/matlab/io/matlabio.h	(revision 23648)
+++ /issm/trunk-jpl/src/wrappers/matlab/io/matlabio.h	(revision 23649)
@@ -36,8 +36,6 @@
 
 void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref);
-void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
 void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref);
 void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref);
-void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
 void FetchData(int** pvector,int* pM,const mxArray* dataref);
 void FetchData(float** pvector,int* pM,const mxArray* dataref);
@@ -45,5 +43,4 @@
 void FetchData(bool** pvector,int* pM,const mxArray* dataref);
 void FetchData(char** pstring,const mxArray* dataref);
-void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
 void FetchData(double* pscalar,const mxArray* dataref);
 void FetchData(int* pinteger,const mxArray* dataref);
@@ -57,8 +54,7 @@
 
 Option* OptionParse(char* name, const mxArray* prhs[]);
-GenericOption<double>*    OptionDoubleParse( char* name, const mxArray* prhs[]);
-GenericOption<double*>*   OptionDoubleArrayParse( char* name, const mxArray* prhs[]);
-GenericOption<bool*>*     OptionLogicalParse( char* name, const mxArray* prhs[]);
-GenericOption<char*>*     OptionCharParse( char* name, const mxArray* prhs[]);
+GenericOption<double>*  OptionDoubleParse(char* name, const mxArray* prhs[]);
+GenericOption<double*>* OptionDoubleArrayParse(char* name, const mxArray* prhs[]);
+GenericOption<char*>*   OptionCharParse(char* name, const mxArray* prhs[]);
 
 mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number, const char* field);
