Index: /issm/trunk/src/c/Dofx/Dofx.cpp
===================================================================
--- /issm/trunk/src/c/Dofx/Dofx.cpp	(revision 2315)
+++ /issm/trunk/src/c/Dofx/Dofx.cpp	(revision 2316)
@@ -13,5 +13,5 @@
 #include "../EnumDefinitions/EnumDefinitions.h"
 
-int Dofx( Vec* ppartition, Vec* ptpartition,DataSet* elements,DataSet* nodes, DataSet* params) {
+int Dofx( DofVec** ppartition, DofVec** ptpartition,DataSet* elements,DataSet* nodes, DataSet* params) {
 
 	int noerr=1;
@@ -27,6 +27,10 @@
 
 	/*output: */
-	Vec partition=NULL;
-	Vec tpartition=NULL;
+	DofVec* partition=NULL;
+	DofVec* tpartition=NULL;
+
+	/*Initialize dofvecs: */
+	partition=new DofVec("partition");
+	tpartition=new DofVec("tpartition");
 
 	/*First, recover number of grids from parameters: */
@@ -48,9 +52,16 @@
 
 	/*Now that dofs have been distributed, create partitioning vector and its transpose: */
-	nodes->CreatePartitioningVector(&partition,numberofnodes,numberofdofspernode);
+	nodes->CreatePartitioningVector(&partition->vector,numberofnodes,numberofdofspernode);
 
 	/*Transpose partition into tpartition: */
-	VecTranspose(&tpartition,partition);
-	
+	VecTranspose(&tpartition->vector,partition->vector);
+
+	/*Now, setup numdof and numentries for dofvec: */
+	partition->numdofs=1;
+	VecGetSize(partition->vector,&partition->numentries);
+
+	tpartition->numdofs=1;
+	VecGetSize(tpartition->vector,&tpartition->numentries);
+
 	/*Assign output pointers: */
 	*ppartition=partition;
Index: /issm/trunk/src/c/Dofx/Dofx.h
===================================================================
--- /issm/trunk/src/c/Dofx/Dofx.h	(revision 2315)
+++ /issm/trunk/src/c/Dofx/Dofx.h	(revision 2316)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-int		Dofx( Vec* partition, Vec* ptpartition,DataSet* elements,DataSet* nodesin,DataSet* params);
+int		Dofx( DofVec** partition, DofVec** ptpartition,DataSet* elements,DataSet* nodesin,DataSet* params);
 
 #endif  /* _DOFX_H */
Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 2315)
+++ /issm/trunk/src/c/Makefile.am	(revision 2316)
@@ -171,5 +171,4 @@
 					./io/WriteDataToDisk.cpp\
 					./io/SerialFetchData.cpp\
-					./io/SerialWriteData.cpp\
 					./io/ParallelFetchData.cpp\
 					./io/ParallelFetchInteger.cpp\
@@ -469,5 +468,4 @@
 					./io/WriteDataToDisk.cpp\
 					./io/SerialFetchData.cpp\
-					./io/SerialWriteData.cpp\
 					./io/ParallelFetchData.cpp\
 					./io/ParallelFetchInteger.cpp\
Index: /issm/trunk/src/c/SpcNodesx/SpcNodesx.cpp
===================================================================
--- /issm/trunk/src/c/SpcNodesx/SpcNodesx.cpp	(revision 2315)
+++ /issm/trunk/src/c/SpcNodesx/SpcNodesx.cpp	(revision 2316)
@@ -13,11 +13,12 @@
 #include "../EnumDefinitions/EnumDefinitions.h"
 
-int SpcNodesx( Vec* pyg, DataSet* nodes,DataSet* constraints){
+void SpcNodesx( DofVec** pyg, DataSet* nodes,DataSet* constraints){
 
 	int i;
 	int numberofdofs;
+	int gsize;
 
 	/*output: */
-	Vec yg=NULL;
+	DofVec* yg=NULL;
 
 	/*First, recover number of dofs from nodes: */
@@ -25,15 +26,25 @@
 
 	if(numberofdofs){
+		
+		/*Allocate dofvec: */
+		yg=new DofVec("yg");
+		yg->numdofs=numberofdofs;
+
 		/*Allocate yg: */
-		yg=NewVec(numberofdofs);
+		yg->vector=NewVec(numberofdofs);
 
 		/*Now, go through constraints, and update the nodes and the constraint vector at the same time: */
-		constraints->SetupSpcs(nodes,yg);
+		constraints->SetupSpcs(nodes,yg->vector);
+
+		/*Specify numentries: */
+		VecGetSize(yg->vector,&gsize);
+		yg->numentries=(int)gsize/yg->numdofs;
+	}
+	else{
+		/*Allocate dofvec: */
+		yg=new DofVec("yg");
 	}
 
 	/*Assign output pointers: */
 	*pyg=yg;
-
-	return 1;
-	
 }
Index: /issm/trunk/src/c/SpcNodesx/SpcNodesx.h
===================================================================
--- /issm/trunk/src/c/SpcNodesx/SpcNodesx.h	(revision 2315)
+++ /issm/trunk/src/c/SpcNodesx/SpcNodesx.h	(revision 2316)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-int		SpcNodesx( Vec* yg, DataSet* nodesin,DataSet* constraints);
+void	SpcNodesx( DofVec** pyg, DataSet* nodesin,DataSet* constraints);
 
 #endif  /* _SPCNODESX_H */
Index: sm/trunk/src/c/io/SerialWriteData.cpp
===================================================================
--- /issm/trunk/src/c/io/SerialWriteData.cpp	(revision 2315)
+++ 	(revision )
@@ -1,155 +1,0 @@
-/*  \file * SerialWriteData.c
- *  \brief write data from the "x" code layer to the matlab workspace
- */
-
-#ifdef HAVE_CONFIG_H
-	#include "config.h"
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include "./io.h"
-#include "../DataSet/DataSet.h"
-#include "../toolkits/toolkits.h"
-#include "../include/macros.h"
-#include "../shared/shared.h"
-
-
-#ifdef _SERIAL_
-
-#undef __FUNCT__ 
-#define __FUNCT__ "SerialWriteData"
-
-
-void SerialWriteData(mxArray** pdataref,void* data,int M, int N,char* data_type,char* sub_data_type){
-
-	int n;
-
-	/*Dataset: */
-	DataSet* dataset=NULL;
-	char* marshalled_dataset=NULL;
-	int   marshalled_dataset_size;
-
-	/*Matrix: */
-	Mat        matrix=NULL;
-	MatType    type;
-	
-	/*Vector: */
-	Vec        vector=NULL;
-
-	/*Scalar: */
-	double* pscalar=NULL;
-	double  scalar;
-
-	/*Integer: */
-	int* pinteger=NULL;
-	int  integer;
-
-	/*String: */
-	char* string=NULL;
-
-	/*Matlab arrays: */
-	mxArray* dataref=NULL;
-	mxArray* tdataref=NULL;
-
-	/*Branch on the type of data:*/
-	if (strcmp(data_type,"DataSet")==0){
-	
-		if(data){
-			/* marshall the dataset: */
-			dataset=(DataSet*)data;
-
-			marshalled_dataset=dataset->Marshall();
-			marshalled_dataset_size=dataset->MarshallSize();
-			
-			dataref = mxCreateDoubleMatrix(0,0,mxREAL);
-			mxSetM(dataref,(mwSize)(marshalled_dataset_size/sizeof(double)));
-			mxSetN(dataref,(mwSize)1);
-			mxSetPr(dataref,(double*)marshalled_dataset);	
-		}
-		else{
-			/* return empty matrix: */
-			dataref=mxCreateDoubleMatrix(0,0,mxREAL);
-		}
-		*pdataref=dataref;
-	}
-	else if (strcmp(data_type,"Matrix")==0){
-
-		if(data){
-		
-			if (sub_data_type && strcmp(sub_data_type,"Mat")==0){
-				
-				/*data is a double* pointer. Copy into a matrix: */
-				tdataref = mxCreateDoubleMatrix(0,0,mxREAL);
-				mxSetM(tdataref,(mwSize)N);
-				mxSetN(tdataref,(mwSize)M);
-				mxSetPr(tdataref,(double*)data);
-
-				//transpose
-				mexCallMATLAB(1,&dataref,1,&tdataref, "'");
-			}
-			else{
-
-				/*cast  matrix type: */
-				matrix=(Mat)data;
-
-				/*call toolkit routine: */
-				PetscMatrixToMatlabMatrix(&dataref,matrix);
-			}
-
-		}
-		else{
-			dataref = mxCreateDoubleMatrix(0,0,mxREAL);
-		}
-		*pdataref=dataref;
-	}
-	else if (strcmp(data_type,"Vector")==0){
-		
-		if(data){
-
-			if (sub_data_type && strcmp(sub_data_type,"Vec")==0){
-				
-				/*data is a double* pointer. Copy into a vector: */
-				dataref = mxCreateDoubleMatrix(0,0,mxREAL);
-				mxSetM(dataref,(mwSize)M);
-				mxSetN(dataref,(mwSize)1);
-				mxSetPr(dataref,(double*)data);
-			}
-			else{
-
-		
-				/*cast  vector type: */
-				vector=(Vec)data;
-
-				/*call toolkit routine: */
-				PetscVectorToMatlabVector(&dataref,vector);
-			}
-		}
-		else{
-			dataref = mxCreateDoubleMatrix(0,0,mxREAL);
-		}
-		*pdataref=dataref;
-	}
-	else if (strcmp(data_type,"Scalar")==0){
-		/*Get scalar: */
-		pscalar=(double*)data;
-		scalar=*pscalar;
-		
-		*pdataref=mxCreateDoubleScalar(scalar);
-	}
-	else if (strcmp(data_type,"Integer")==0){
-		/*Integer is pointed to by data: */
-		pinteger=(int*)data;
-		integer=*pinteger;
-		*pdataref=mxCreateDoubleScalar((double)integer);
-	}
-	else if (strcmp(data_type,"String")==0){
-		/*String is pointed to by data: */
-		string=(char*)data;
-		*pdataref=mxCreateString(string);
-	}
-	else{
-		throw ErrorException(__FUNCT__,exprintf("%s%s%s","incorrect data type ",data_type," .Only \"Matrix\",\"DataSet\",\"String\",\"Scalar\", or \"Integer\"  are allowed."));
-	}
-}
-#endif //#ifdef _SERIAL_
Index: /issm/trunk/src/c/io/WriteData.cpp
===================================================================
--- /issm/trunk/src/c/io/WriteData.cpp	(revision 2315)
+++ /issm/trunk/src/c/io/WriteData.cpp	(revision 2316)
@@ -19,8 +19,165 @@
 
 #include <mex.h>
-void WriteData(mxArray** pdataref,void* data,int M,int N,char* data_type,char* sub_data_type){
+
+
+/*Several prototypes for WriteData, according to type: */
+
+/*DataSet: */
+void WriteData(mxArray** pdataref,DataSet* dataset){
+
+	mxArray* dataref=NULL;
+	char* marshalled_dataset=NULL;
+	int   marshalled_dataset_size;
+
+	/*Write a dataset: */
+	if(dataset){
+			/* marshall the dataset: */
+			marshalled_dataset=dataset->Marshall();
+			marshalled_dataset_size=dataset->MarshallSize();
+			
+			dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+			mxSetM(dataref,(mwSize)(marshalled_dataset_size/sizeof(double)));
+			mxSetN(dataref,(mwSize)1);
+			mxSetPr(dataref,(double*)marshalled_dataset);	
+	}
+	else{
+		/* return empty matrix: */
+		dataref=mxCreateDoubleMatrix(0,0,mxREAL);
+	}
+	*pdataref=dataref;
 	
-	SerialWriteData(pdataref,data,M,N,data_type,sub_data_type);
 }
+
+void WriteData(mxArray** pdataref,Mat matrix){
+		
+	mxArray* dataref=NULL;
+	
+	if(matrix){
+		
+		/*call toolkit routine: */
+		PetscMatrixToMatlabMatrix(&dataref,matrix);
+	}
+	else{
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+	}
+
+	*pdataref=dataref;
+}
+
+void WriteData(mxArray** pdataref,double* matrix, int M,int N){
+	
+	mxArray* dataref=NULL;
+	mxArray* tdataref=NULL;
+		
+	if(matrix){
+		
+		/*data is a double* pointer. Copy into a matrix: */
+		tdataref = mxCreateDoubleMatrix(0,0,mxREAL);
+		mxSetM(tdataref,(mwSize)N);
+		mxSetN(tdataref,(mwSize)M);
+		mxSetPr(tdataref,(double*)matrix);
+
+		//transpose
+		mexCallMATLAB(1,&dataref,1,&tdataref, "'");
+	}
+	else{
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+	}
+	*pdataref=dataref;
+}
+
+
+void WriteData(mxArray** pdataref,Vec vector){
+	
+	mxArray* dataref=NULL;
+	
+	if(vector){
+		
+		/*call toolkit routine: */
+		PetscVectorToMatlabVector(&dataref,vector);
+	}
+	else{
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+	}
+	*pdataref=dataref;
+
+}
+
+
+void WriteData(mxArray** pdataref,DofVec* dofvec){
+	
+	mxArray* mxvector=NULL;
+	mxArray* structdataref=NULL;
+	mxArray* dataref=NULL;
+
+	int nfields=4;
+	const	char*	fnames[nfields];
+	mwSize		onebyone[2] = {1,1};
+	mwSize		ndim=2;
+
+	fnames[0] = "name";
+	fnames[1] = "numdofs";
+	fnames[2] = "numentries";
+	fnames[3] = "vector";
+	
+	if(dofvec){
+		
+		/*call toolkit routine: */
+		if(dofvec->vector)PetscVectorToMatlabVector(&mxvector,dofvec->vector);
+		else mxvector=mxCreateDoubleMatrix(0,0,mxREAL);
+
+		/*use the mxvector to create a dofvec object: */
+		structdataref=mxCreateStructArray( ndim,onebyone,nfields,fnames);
+	
+		mxSetField( structdataref, 0, "name",mxCreateString(dofvec->name));
+		mxSetField( structdataref, 0, "numdofs",mxCreateDoubleScalar(dofvec->numdofs));
+		mxSetField( structdataref, 0, "numentries",mxCreateDoubleScalar(dofvec->numentries));
+		mxSetField( structdataref, 0, "vector",mxvector);
+
+
+		/*transform structure into dofvec class: */
+		mexCallMATLAB( 1, &dataref, 1, &structdataref, "dofvec");
+	}
+	else{
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+	}
+	*pdataref=dataref;
+}
+
+void WriteData(mxArray** pdataref,double* vector, int M){
+	
+	mxArray* dataref=NULL;
+
+	if(vector){
+
+		/*data is a double* pointer. Copy into a vector: */
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+		mxSetM(dataref,(mwSize)M);
+		mxSetN(dataref,(mwSize)1);
+		mxSetPr(dataref,vector);
+	}
+	else{
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+	}
+
+	*pdataref=dataref;
+}
+
+void WriteData(mxArray** pdataref,double scalar){
+
+	*pdataref=mxCreateDoubleScalar(scalar);
+}
+
+void WriteData(mxArray** pdataref,int integer){
+
+		*pdataref=mxCreateDoubleScalar((double)integer);
+
+}
+
+void WriteData(mxArray** pdataref,char* string){
+
+		*pdataref=mxCreateString(string);
+}
+
 #else
 void WriteData(int* pdummy,void* data,char* data_type){
Index: /issm/trunk/src/c/io/io.h
===================================================================
--- /issm/trunk/src/c/io/io.h	(revision 2315)
+++ /issm/trunk/src/c/io/io.h	(revision 2316)
@@ -7,4 +7,5 @@
 
 #include "../objects/NodeSets.h"
+#include "../objects/DofVec.h"
 #include "../DataSet/DataSet.h"
 #include "../include/types.h"
@@ -13,14 +14,24 @@
 
 void FetchData(void** pdata,int* pM,int* pN,ConstDataHandle data_handle,char* data_type,char* sub_data_type);
-void WriteData(DataHandle* pdata_handle,void* data,int M,int N,char* data_type,char* sub_data_type);
 void IoModelFetchData(void** pdata,int* pM,int* pN,ConstDataHandle model_handle,char* data_name,char* data_type,char* sub_data_type);
 
 /*Serial: */
 #ifdef _SERIAL_
-void SerialFetchData(void** pdata,int* pM,int* pN,ConstDataHandle data_handle,char* data_type,char* sub_data_type);
-void SerialWriteData(DataHandle* pdata_handle,void* data,int M,int N,char* data_type,char* sub_data_type);
-void FetchNodeSets(NodeSets** pnodesets,ConstDataHandle dataref);
+/*Write: */
+void WriteData(mxArray** pdataref,DataSet* dataset);
+void WriteData(mxArray** pdataref,Mat matrix);
+void WriteData(mxArray** pdataref,double* matrix, int M,int N);
+void WriteData(mxArray** pdataref,Vec vector);
+void WriteData(mxArray** pdataref,double* vector, int M);
+void WriteData(mxArray** pdataref,int integer);
+void WriteData(mxArray** pdataref,double scalar);
+void WriteData(mxArray** pdataref,char* string);
+void WriteData(mxArray** pdataref,DofVec* vector);
 void WriteNodeSets(DataHandle* pdataref,NodeSets* nodesets);
 void WriteParams(DataHandle* pdataref,DataSet* parameters);
+
+/*Fetch: */
+void SerialFetchData(void** pdata,int* pM,int* pN,ConstDataHandle data_handle,char* data_type,char* sub_data_type);
+void FetchNodeSets(NodeSets** pnodesets,ConstDataHandle dataref);
 #endif
 
@@ -33,4 +44,5 @@
 void ParallelFetchInteger(int* pdata,DataHandle data_handle);
 void WriteDataToDisk(void* data,int* pM,int* pN,char* datatype,FILE* fid);
+void WriteData(int* pdummy,void* data,char* data_type);
 #endif
 
Index: /issm/trunk/src/c/objects/DofVec.cpp
===================================================================
--- /issm/trunk/src/c/objects/DofVec.cpp	(revision 2315)
+++ /issm/trunk/src/c/objects/DofVec.cpp	(revision 2316)
@@ -15,4 +15,13 @@
 DofVec::DofVec(){
 	return;
+}
+		
+DofVec::DofVec(char* name){
+
+	strcpy(this->name,name);
+	this->numdofs=0;
+	this->numentries=0;
+	this->vector=NULL;
+
 }
 
Index: /issm/trunk/src/c/objects/DofVec.h
===================================================================
--- /issm/trunk/src/c/objects/DofVec.h	(revision 2315)
+++ /issm/trunk/src/c/objects/DofVec.h	(revision 2316)
@@ -13,6 +13,6 @@
 
 class DofVec: public Object{
-
-	private: 
+	
+	public:
 
 		char name[DOFVECNAMESIZE];
@@ -21,7 +21,7 @@
 		Vec vector; //vector itself.
 
-	public:
 
 		DofVec();
+		DofVec(char* name);
 		DofVec(int total_size,char* name); //default numdofs=1, numentries=total_size, default_value=0;
 		DofVec(int total_size,double default_value,char* name); //default numdofs=1, numentries=total_size
Index: /issm/trunk/src/c/objects/FemModel.cpp
===================================================================
--- /issm/trunk/src/c/objects/FemModel.cpp	(revision 2315)
+++ /issm/trunk/src/c/objects/FemModel.cpp	(revision 2316)
@@ -34,5 +34,5 @@
 
 FemModel::FemModel(DataSet* femmodel_elements,DataSet* femmodel_nodes,DataSet* femmodel_constraints,DataSet* femmodel_loads,
-		DataSet* femmodel_materials,DataSet* femmodel_parameters, Vec femmodel_partition,Vec femmodel_tpartition,Vec femmodel_yg,
+		DataSet* femmodel_materials,DataSet* femmodel_parameters, DofVec* femmodel_partition,DofVec* femmodel_tpartition,DofVec* femmodel_yg,
 		Mat femmodel_Rmg,Mat femmodel_Gmn,NodeSets* femmodel_nodesets,Vec femmodel_ys,Vec femmodel_ys0){
 
@@ -65,7 +65,7 @@
 	delete parameters;
 
-	VecFree(&partition);
-	VecFree(&tpartition);
-	VecFree(&yg);
+	delete partition;
+	delete tpartition;
+	delete yg;
 	MatFree(&Rmg);
 	delete nodesets;
@@ -116,9 +116,9 @@
 	
 	printf("   partition: \n");
-	VecView(partition,PETSC_VIEWER_STDOUT_WORLD);
+	partition->Echo();
 	printf("   tpartition: \n");
-	VecView(tpartition,PETSC_VIEWER_STDOUT_WORLD);
+	tpartition->Echo();
 	printf("   yg: \n");
-	VecView(yg,PETSC_VIEWER_STDOUT_WORLD);
+	yg->Echo();
 	printf("   Rmg: \n");
 	MatView(Rmg,PETSC_VIEWER_STDOUT_WORLD);
@@ -192,7 +192,7 @@
 DataSet*            FemModel::get_materials(void){return materials;}
 DataSet*            FemModel::get_parameters(void){return parameters;}
-Vec                 FemModel::get_partition(void){return partition;}
-Vec                 FemModel::get_tpartition(void){return tpartition;}
-Vec                 FemModel::get_yg(void){return yg;}
+DofVec*                 FemModel::get_partition(void){return partition;}
+DofVec*                 FemModel::get_tpartition(void){return tpartition;}
+DofVec*                 FemModel::get_yg(void){return yg;}
 Mat                 FemModel::get_Rmg(void){return Rmg;}
 NodeSets*           FemModel::get_nodesets(void){return nodesets;}
Index: /issm/trunk/src/c/objects/FemModel.h
===================================================================
--- /issm/trunk/src/c/objects/FemModel.h	(revision 2315)
+++ /issm/trunk/src/c/objects/FemModel.h	(revision 2316)
@@ -9,4 +9,5 @@
 #include "../DataSet/DataSet.h"
 #include "../parallel/parallel.h"
+#include "./DofVec.h"
 
 class DataSet;
@@ -26,7 +27,7 @@
 		DataSet*            parameters;
 
-		Vec                 partition;
-		Vec                 tpartition;
-		Vec                 yg;
+		DofVec*                 partition;
+		DofVec*                 tpartition;
+		DofVec*                 yg;
 		Mat                 Rmg;
 		NodeSets*           nodesets;
@@ -38,5 +39,5 @@
 		~FemModel();
 		FemModel(DataSet* elements,DataSet* nodes,DataSet* constraints,DataSet* loads,DataSet* materials,DataSet* parameters,
-			              Vec partition,Vec tpartition,Vec yg,Mat Rmg,Mat Gmn,NodeSets* nodesets,Vec ys,Vec ys0);
+			              DofVec* partition,DofVec* tpartition,DofVec* yg,Mat Rmg,Mat Gmn,NodeSets* nodesets,Vec ys,Vec ys0);
      
 		/*virtual resolves: */
@@ -59,7 +60,7 @@
 		DataSet* get_materials(void);
 		DataSet* get_parameters(void);
-		Vec      get_partition(void);
-		Vec      get_tpartition(void);
-		Vec      get_yg(void);
+		DofVec*      get_partition(void);
+		DofVec*      get_tpartition(void);
+		DofVec*      get_yg(void);
 		Mat      get_Rmg(void);
 		NodeSets* get_nodesets(void);
Index: /issm/trunk/src/c/objects/Model.cpp
===================================================================
--- /issm/trunk/src/c/objects/Model.cpp	(revision 2315)
+++ /issm/trunk/src/c/objects/Model.cpp	(revision 2316)
@@ -61,7 +61,7 @@
 	DataSet*            materials=NULL;
 	DataSet*            parameters=NULL;
-	Vec                 partition=NULL;
-	Vec                 tpartition=NULL;
-	Vec                 yg=NULL;
+	DofVec*                 partition=NULL;
+	DofVec*                 tpartition=NULL;
+	DofVec*                 yg=NULL;
 	Mat                 Rmg=NULL;
 	Mat                 Gmn=NULL;
@@ -100,5 +100,5 @@
 
 	_printf_("   reducing single point constraints vector:\n");
-	Reducevectorgtosx(&ys,&ys0, yg,nodesets);
+	Reducevectorgtosx(&ys,&ys0, yg->vector,nodesets);
 	
 	_printf_("   normalizing rigid body constraints matrix:\n");
@@ -109,5 +109,5 @@
 
 	_printf_("   process parameters:\n");
-	ProcessParamsx( parameters, partition);
+	ProcessParamsx( parameters, partition->vector);
 
 	_printf_("   free ressources:\n");
@@ -135,7 +135,7 @@
 	DataSet*            materials=NULL;
 	DataSet*            parameters=NULL;
-	Vec                 partition=NULL;
-	Vec                 tpartition=NULL;
-	Vec                 yg=NULL;
+	DofVec*                 partition=NULL;
+	DofVec*                 tpartition=NULL;
+	DofVec*                 yg=NULL;
 	Mat                 Rmg=NULL;
 	Mat                 Gmn=NULL;
@@ -178,5 +178,5 @@
 
 	_printf_("   reducing single point constraints vector:\n");
-	Reducevectorgtosx(&ys,&ys0, yg,nodesets);
+	Reducevectorgtosx(&ys,&ys0, yg->vector,nodesets);
 	
 	_printf_("   normalizing rigid body constraints matrix:\n");
@@ -187,5 +187,5 @@
 
 	_printf_("   process parameters:\n");
-	ProcessParamsx( parameters, partition);
+	ProcessParamsx( parameters, partition->vector);
 
 	_printf_("   free ressources:\n");
Index: /issm/trunk/src/c/parallel/ControlInitialization.cpp
===================================================================
--- /issm/trunk/src/c/parallel/ControlInitialization.cpp	(revision 2315)
+++ /issm/trunk/src/c/parallel/ControlInitialization.cpp	(revision 2316)
@@ -128,8 +128,8 @@
 	//update spcs
 	if(debug)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed...");
-	xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg,ug,dofset,3*numberofnodes);
+	xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg->vector,ug,dofset,3*numberofnodes);
 	
 	VecFree(&fem_ds->ys); VecFree(&fem_ds->ys0);
-	Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg,fem_ds->nodesets);
+	Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg->vector,fem_ds->nodesets);
 
 	//Compute Stokes velocities to speed up later runs
Index: /issm/trunk/src/c/parallel/ProcessResults.cpp
===================================================================
--- /issm/trunk/src/c/parallel/ProcessResults.cpp	(revision 2315)
+++ /issm/trunk/src/c/parallel/ProcessResults.cpp	(revision 2316)
@@ -127,10 +127,10 @@
 				if(ismacayealpattyn){
 					fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-					VecToMPISerial(&partition,fem_dh->partition);
+					VecToMPISerial(&partition,fem_dh->partition->vector);
 					fem_dh->parameters->FindParam((void*)&yts,"yts");
 				}
 				else{
 					fem_dhu->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-					VecToMPISerial(&partition,fem_dhu->partition);
+					VecToMPISerial(&partition,fem_dhu->partition->vector);
 					fem_dhu->parameters->FindParam((void*)&yts,"yts");
 				}
@@ -153,10 +153,10 @@
 					if(ismacayealpattyn){
 						fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-						VecToMPISerial(&partition,fem_dh->partition);
+						VecToMPISerial(&partition,fem_dh->partition->vector);
 						fem_dh->parameters->FindParam((void*)&yts,"yts");
 					}
 					else{
 						fem_dhu->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-						VecToMPISerial(&partition,fem_dhu->partition);
+						VecToMPISerial(&partition,fem_dhu->partition->vector);
 						fem_dhu->parameters->FindParam((void*)&yts,"yts");
 					}
@@ -176,5 +176,5 @@
 					/* 4 dofs on number of nodes. discard pressure: */
 					fem_ds->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-					VecToMPISerial(&partition,fem_ds->partition);
+					VecToMPISerial(&partition,fem_ds->partition->vector);
 					fem_ds->parameters->FindParam((void*)&yts,"yts");
 					vx=(double*)xmalloc(numberofnodes*sizeof(double));
@@ -221,14 +221,14 @@
 				if(ismacayealpattyn){
 					fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-					VecToMPISerial(&partition,fem_dh->partition);
+					VecToMPISerial(&partition,fem_dh->partition->vector);
 				}
 				else{
 					fem_dhu->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-					VecToMPISerial(&partition,fem_dhu->partition);
+					VecToMPISerial(&partition,fem_dhu->partition->vector);
 				}
 			}
 			else{
 				fem_ds->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-				VecToMPISerial(&partition,fem_ds->partition);
+				VecToMPISerial(&partition,fem_ds->partition->vector);
 			}
 
@@ -254,5 +254,5 @@
 			VecToMPISerial(&t_g_serial,t_g);
 			fem_t->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-			VecToMPISerial(&partition,fem_t->partition);
+			VecToMPISerial(&partition,fem_t->partition->vector);
 
 			temperature=(double*)xmalloc(numberofnodes*sizeof(double));
@@ -278,5 +278,5 @@
 			fem_t->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
 			fem_t->parameters->FindParam((void*)&yts,"yts");
-			VecToMPISerial(&partition,fem_t->partition);
+			VecToMPISerial(&partition,fem_t->partition->vector);
 
 			melting=(double*)xmalloc(numberofnodes*sizeof(double));
@@ -301,5 +301,5 @@
 			VecToMPISerial(&h_g_serial,h_g);
 			fem_p->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-			VecToMPISerial(&partition,fem_p->partition);
+			VecToMPISerial(&partition,fem_p->partition->vector);
 
 			thickness=(double*)xmalloc(numberofnodes*sizeof(double));
@@ -324,5 +324,5 @@
 			VecToMPISerial(&s_g_serial,s_g);
 			fem_p->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-			VecToMPISerial(&partition,fem_p->partition);
+			VecToMPISerial(&partition,fem_p->partition->vector);
 
 			surface=(double*)xmalloc(numberofnodes*sizeof(double));
@@ -347,5 +347,5 @@
 			VecToMPISerial(&b_g_serial,b_g);
 			fem_p->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-			VecToMPISerial(&partition,fem_p->partition);
+			VecToMPISerial(&partition,fem_p->partition->vector);
 
 			bed=(double*)xmalloc(numberofnodes*sizeof(double));
@@ -369,5 +369,5 @@
 			result->GetField(&param_g);
 			fem_dh->parameters->FindParam((void*)&numberofnodes,"numberofnodes");
-			VecToMPISerial(&partition,fem_dh->partition);
+			VecToMPISerial(&partition,fem_dh->partition->vector);
 
 			parameter=(double*)xmalloc(numberofnodes*sizeof(double));
Index: /issm/trunk/src/c/parallel/diagnostic_core.cpp
===================================================================
--- /issm/trunk/src/c/parallel/diagnostic_core.cpp	(revision 2315)
+++ /issm/trunk/src/c/parallel/diagnostic_core.cpp	(revision 2316)
@@ -116,7 +116,7 @@
 		if(debug)_printf_("%s\n"," update boundary conditions for macyeal pattyn using hutter results...");
 		if (ismacayealpattyn){
-			VecFree(&fem_dh->yg); VecFree(&fem_dh->ys);VecFree(&fem_dh->ys0);
-			VecDuplicatePatch(&fem_dh->yg,ug);
-			Reducevectorgtosx(&fem_dh->ys,&fem_dh->ys0, fem_dh->yg,fem_dh->nodesets);
+			xdelete((void**)&fem_dh->yg); VecFree(&fem_dh->ys);VecFree(&fem_dh->ys0);
+			VecDuplicatePatch(&fem_dh->yg->vector,ug);
+			Reducevectorgtosx(&fem_dh->ys,&fem_dh->ys0, fem_dh->yg->vector,fem_dh->nodesets);
 		}
 
@@ -179,7 +179,7 @@
 
 			if(debug)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed...");
-			xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg,ug,dofset,3*numberofnodes);
+			xfree((void**)&dofset);dofset=dofsetgen(3,dof012,4,numberofnodes*4); VecMerge(fem_ds->yg->vector,ug,dofset,3*numberofnodes);
 			VecFree(&fem_ds->ys); VecFree(&fem_ds->ys0);
-			Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg,fem_ds->nodesets);
+			Reducevectorgtosx(&fem_ds->ys,&fem_ds->ys0, fem_ds->yg->vector,fem_ds->nodesets);
 
 			if(debug)_printf_("%s\n"," computing stokes velocities and pressure ...");
Index: /issm/trunk/src/c/shared/Alloc/alloc.cpp
===================================================================
--- /issm/trunk/src/c/shared/Alloc/alloc.cpp	(revision 2315)
+++ /issm/trunk/src/c/shared/Alloc/alloc.cpp	(revision 2316)
@@ -103,2 +103,12 @@
 	return value;
 }
+
+void xdelete( void* *pv) {
+
+	if (pv && *pv) {
+
+		delete *pv;
+
+		*pv=NULL;
+	}
+}
Index: /issm/trunk/src/c/shared/Alloc/alloc.h
===================================================================
--- /issm/trunk/src/c/shared/Alloc/alloc.h	(revision 2315)
+++ /issm/trunk/src/c/shared/Alloc/alloc.h	(revision 2316)
@@ -12,4 +12,5 @@
 void  xfree(void** pvptr);
 void* xrealloc ( void* pv, int size);
+void xdelete( void* *pv) ;
 
 #endif
Index: /issm/trunk/src/m/classes/@dofvec/display.m
===================================================================
--- /issm/trunk/src/m/classes/@dofvec/display.m	(revision 2315)
+++ /issm/trunk/src/m/classes/@dofvec/display.m	(revision 2316)
@@ -6,9 +6,9 @@
 disp(sprintf('\n%s = \n',inputname(1)));
 disp(sprintf('   name:      ''%s''',dofvec.name));
-disp(sprintf('   numdof:     %i',dofvec.numdof));
+disp(sprintf('   numdofs:     %i',dofvec.numdofs));
 disp(sprintf('   numentries: %i',dofvec.numentries));
 disp(sprintf('%s\n','   vector = '));
 for i=1:dofvec.numentries,
-	for j=1:dofvec.numdof,
+	for j=1:dofvec.numdofs,
 		disp(sprintf('            %i|%i|%g',i,j,dofvec.vector(i)));
 	end
Index: /issm/trunk/src/m/classes/@dofvec/dofvec.m
===================================================================
--- /issm/trunk/src/m/classes/@dofvec/dofvec.m	(revision 2315)
+++ /issm/trunk/src/m/classes/@dofvec/dofvec.m	(revision 2316)
@@ -9,5 +9,5 @@
 	% if no input arguments, create a default object
 	object.name='';
-	object.numdof=1;
+	object.numdofs=1;
 	object.numentries=0;
 	object.vector=zeros(0,1);
@@ -17,4 +17,7 @@
 	if (isa(varargin{1},'dofvec'))
 		object = varargin{1};
+	elseif (isa(varargin{1},'struct'))
+		object = varargin{1};
+		object=class(object,'dofvec');
 	elseif ischar(varargin{1}),
 		object= dofvec;
Index: /issm/trunk/src/m/solutions/cielo/CreateFemModel.m
===================================================================
--- /issm/trunk/src/m/solutions/cielo/CreateFemModel.m	(revision 2315)
+++ /issm/trunk/src/m/solutions/cielo/CreateFemModel.m	(revision 2316)
@@ -24,5 +24,5 @@
 
 	displaystring(md.debug,'%s','   reducing single point constraints vector...');
-	[m.ys m.ys0]=Reducevectorgtos(m.yg,m.nodesets);
+	[m.ys m.ys0]=Reducevectorgtos(m.yg.vector,m.nodesets);
 	
 	displaystring(md.debug,'%s','   normalizing rigid body constraints matrix...');
@@ -33,5 +33,5 @@
 
 	displaystring(md.debug,'%s','   processing parameters...');
-	parameters= ProcessParams(parameters,m.part);
+	parameters= ProcessParams(parameters,m.part.vector);
 
 	displaystring(md.debug,'%s','   creating parameters in matlab workspace...');
Index: /issm/trunk/src/mex/ComputePressure/ComputePressure.cpp
===================================================================
--- /issm/trunk/src/mex/ComputePressure/ComputePressure.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ComputePressure/ComputePressure.cpp	(revision 2316)
@@ -45,5 +45,5 @@
 
 	/*write output datasets: */
-	WriteData(PRESSURE,p_g,0,0,"Vector",NULL);
+	WriteData(PRESSURE,p_g);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/ConfigureObjects/ConfigureObjects.cpp
===================================================================
--- /issm/trunk/src/mex/ConfigureObjects/ConfigureObjects.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ConfigureObjects/ConfigureObjects.cpp	(revision 2316)
@@ -34,7 +34,7 @@
 
 	/*write output datasets: */
-	WriteData(ELEMENTS,elements,0,0,"DataSet",NULL);
-	WriteData(LOADS,loads,0,0,"DataSet",NULL);
-	WriteData(NODESOUT,nodes,0,0,"DataSet",NULL);
+	WriteData(ELEMENTS,elements);
+	WriteData(LOADS,loads);
+	WriteData(NODESOUT,nodes);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/ContourToMesh/ContourToMesh.cpp
===================================================================
--- /issm/trunk/src/mex/ContourToMesh/ContourToMesh.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ContourToMesh/ContourToMesh.cpp	(revision 2316)
@@ -101,12 +101,12 @@
 	/* output: */
 	if (strcmp(interptype,"node")==0){
-		WriteData(PLHS0,in_nod,0,0,"Vector",NULL);
+		WriteData(PLHS0,in_nod);
 	}
 	else if (strcmp(interptype,"element")==0){
-		WriteData(PLHS0,in_elem,0,0,"Vector",NULL);
+		WriteData(PLHS0,in_elem);
 	}
 	else if (strcmp(interptype,"element and node")==0){
-		WriteData(PLHS0,in_nod,0,0,"Vector",NULL);
-		WriteData(PLHS1,in_elem,0,0,"Vector",NULL);
+		WriteData(PLHS0,in_nod);
+		WriteData(PLHS1,in_elem);
 	}
 	else throw ErrorException(__FUNCT__," wrong interpolation type");
Index: /issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp
===================================================================
--- /issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ContourToNodes/ContourToNodes.cpp	(revision 2316)
@@ -90,5 +90,5 @@
 
 	/* output: */
-	WriteData(FLAGS,flags,0,0,"Vector",NULL);
+	WriteData(FLAGS,flags);
 
 	/*end module: */
Index: /issm/trunk/src/mex/ControlConstrain/ControlConstrain.cpp
===================================================================
--- /issm/trunk/src/mex/ControlConstrain/ControlConstrain.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ControlConstrain/ControlConstrain.cpp	(revision 2316)
@@ -33,5 +33,5 @@
 
 	/*write output : */
-	WriteData(PGOUT,p_g,gsize,1,"Vector","Vec");
+	WriteData(PGOUT,p_g,gsize);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/ControlOptimization/ControlOptimization.cpp
===================================================================
--- /issm/trunk/src/mex/ControlOptimization/ControlOptimization.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ControlOptimization/ControlOptimization.cpp	(revision 2316)
@@ -66,6 +66,6 @@
 
 	/*write output : */
-	WriteData(SEARCHSCALAR,&search_scalar,0,0,"Scalar",NULL);
-	WriteData(MISFIT,&J,0,0,"Scalar",NULL);
+	WriteData(SEARCHSCALAR,search_scalar);
+	WriteData(MISFIT,J);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Dof/Dof.cpp
===================================================================
--- /issm/trunk/src/mex/Dof/Dof.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Dof/Dof.cpp	(revision 2316)
@@ -16,6 +16,6 @@
 
 	/* output datasets: */
-	Vec partition=NULL;
-	Vec tpartition=NULL;
+	DofVec* partition=NULL;
+	DofVec* tpartition=NULL;
 
 	/*Boot module: */
@@ -34,11 +34,11 @@
 
 	/*partition and tpartition should be incremented by 1: */
-	VecShift(partition,1.0); //matlab indexing starts at 1.
-	VecShift(tpartition,1.0);
+	VecShift(partition->vector,1.0); //matlab indexing starts at 1.
+	VecShift(tpartition->vector,1.0);
 
 	/*write output datasets: */
-	WriteData(NODES,nodes,0,0,"DataSet",NULL);
-	WriteData(PARTITION,partition,0,0,"Vector",NULL);
-	WriteData(TPARTITION,tpartition,0,0,"Vector",NULL);
+	WriteData(NODES,nodes);
+	WriteData(PARTITION,partition);
+	WriteData(TPARTITION,tpartition);
 
 	/*Free ressources: */
@@ -46,6 +46,6 @@
 	delete elements;
 	delete params;
-	VecFree(&partition);
-	VecFree(&tpartition);
+	delete partition;
+	delete tpartition;
 
 	/*end module: */
Index: /issm/trunk/src/mex/Du/Du.cpp
===================================================================
--- /issm/trunk/src/mex/Du/Du.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Du/Du.cpp	(revision 2316)
@@ -45,5 +45,5 @@
 
 	/*write output : */
-	WriteData(DUG,du_g,0,0,"Vector",NULL);
+	WriteData(DUG,du_g);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/ElementConnectivity/ElementConnectivity.cpp
===================================================================
--- /issm/trunk/src/mex/ElementConnectivity/ElementConnectivity.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ElementConnectivity/ElementConnectivity.cpp	(revision 2316)
@@ -30,5 +30,5 @@
 
 	/*write output datasets: */
-	WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3,"Matrix","Mat");
+	WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/FieldDepthAverage/FieldDepthAverage.cpp
===================================================================
--- /issm/trunk/src/mex/FieldDepthAverage/FieldDepthAverage.cpp	(revision 2315)
+++ /issm/trunk/src/mex/FieldDepthAverage/FieldDepthAverage.cpp	(revision 2316)
@@ -36,5 +36,6 @@
 
 	/*write output : */
-	WriteData(FIELDOUT,field,0,0,"Vector",NULL);
+	WriteData(FIELDOUT,field);
+
 	/*Free ressources: */
 	delete elements;
Index: /issm/trunk/src/mex/FieldExtrude/FieldExtrude.cpp
===================================================================
--- /issm/trunk/src/mex/FieldExtrude/FieldExtrude.cpp	(revision 2315)
+++ /issm/trunk/src/mex/FieldExtrude/FieldExtrude.cpp	(revision 2316)
@@ -38,5 +38,6 @@
 
 	/*write output : */
-	WriteData(FIELDOUT,field,0,0,"Vector",NULL);
+	WriteData(FIELDOUT,field);
+
 	/*Free ressources: */
 	delete elements;
Index: /issm/trunk/src/mex/Gradj/Gradj.cpp
===================================================================
--- /issm/trunk/src/mex/Gradj/Gradj.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Gradj/Gradj.cpp	(revision 2316)
@@ -49,5 +49,5 @@
 
 	/*write output : */
-	WriteData(GRADG,grad_g,0,0,"Vector",NULL);
+	WriteData(GRADG,grad_g);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/HoleFiller/HoleFiller.cpp
===================================================================
--- /issm/trunk/src/mex/HoleFiller/HoleFiller.cpp	(revision 2315)
+++ /issm/trunk/src/mex/HoleFiller/HoleFiller.cpp	(revision 2316)
@@ -51,5 +51,5 @@
 
 	/* output: */
-	WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols,"Matrix","Mat");
+	WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
 
 	/*end module: */
Index: /issm/trunk/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 2315)
+++ /issm/trunk/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 2316)
@@ -64,5 +64,5 @@
 
 	/*Write data: */
-	WriteData(DATAMESH,data_mesh,0,0,"Vector",NULL);
+	WriteData(DATAMESH,data_mesh);
 
 	/*end module: */
Index: /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 2315)
+++ /issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 2316)
@@ -51,7 +51,7 @@
 
 	/*Write results: */
-	WriteData(XM,x_m,ncols+1,1,"Vector","Vec");
-	WriteData(YM,y_m,nlines+1,1,"Vector","Vec");
-	WriteData(GRIDDATA,griddata,nlines,ncols,"Matrix","Mat");
+	WriteData(XM,x_m,ncols+1);
+	WriteData(YM,y_m,nlines+1);
+	WriteData(GRIDDATA,griddata,nlines,ncols);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 2315)
+++ /issm/trunk/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 2316)
@@ -85,5 +85,5 @@
 
 	/*Write data: */
-	WriteData(DATAPRIME,data_prime,0,0,"Vector",NULL);
+	WriteData(DATAPRIME,data_prime);
 
 	/*end module: */
Index: /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
===================================================================
--- /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 2315)
+++ /issm/trunk/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 2316)
@@ -90,5 +90,5 @@
 
 	/*Write data: */
-	WriteData(DATAPRIME,data_prime,0,0,"Vector",NULL);
+	WriteData(DATAPRIME,data_prime);
 
 	/*end module: */
Index: /issm/trunk/src/mex/MassFlux/MassFlux.cpp
===================================================================
--- /issm/trunk/src/mex/MassFlux/MassFlux.cpp	(revision 2315)
+++ /issm/trunk/src/mex/MassFlux/MassFlux.cpp	(revision 2316)
@@ -45,5 +45,5 @@
 
 	/*write output datasets: */
-	WriteData(RESPONSE,&mass_flux,0,0,"Scalar",NULL);
+	WriteData(RESPONSE,mass_flux);
 	
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp
===================================================================
--- /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp	(revision 2316)
@@ -35,5 +35,5 @@
 
 	/*write output datasets: */
-	WriteData(UG,ug,0,0,"Vector",NULL);
+	WriteData(UG,ug);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/MeshPartition/MeshPartition.cpp
===================================================================
--- /issm/trunk/src/mex/MeshPartition/MeshPartition.cpp	(revision 2315)
+++ /issm/trunk/src/mex/MeshPartition/MeshPartition.cpp	(revision 2316)
@@ -90,6 +90,6 @@
 
 	/*Write data:*/
-	WriteData(ELEMENTPARTITIONING,element_partitioning,numberofelements,1,"Matrix","Mat");
-	WriteData(NODEPARTITIONING,node_partitioning,numberofgrids,1,"Matrix","Mat");
+	WriteData(ELEMENTPARTITIONING,element_partitioning,numberofelements);
+	WriteData(NODEPARTITIONING,node_partitioning,numberofgrids);
 	
 	/*Free ressources:*/
Index: /issm/trunk/src/mex/Misfit/Misfit.cpp
===================================================================
--- /issm/trunk/src/mex/Misfit/Misfit.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Misfit/Misfit.cpp	(revision 2316)
@@ -44,5 +44,5 @@
 
 	/*write output : */
-	WriteData(MISFIT,&J,0,0,"Scalar",NULL);
+	WriteData(MISFIT,J);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/ModelProcessor/ModelProcessor.cpp
===================================================================
--- /issm/trunk/src/mex/ModelProcessor/ModelProcessor.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ModelProcessor/ModelProcessor.cpp	(revision 2316)
@@ -35,10 +35,10 @@
 	
 	/*Write output data: */
-	WriteData(ELEMENTS,elements,0,0,"DataSet",NULL);
-	WriteData(NODES,nodes,0,0,"DataSet",NULL);
-	WriteData(CONSTRAINTS,constraints,0,0,"DataSet",NULL);
-	WriteData(LOADS,loads,0,0,"DataSet",NULL);
-	WriteData(MATERIALS,materials,0,0,"DataSet",NULL);
-	WriteData(PARAMETERS,parameters,0,0,"DataSet",NULL);
+	WriteData(ELEMENTS,elements);
+	WriteData(NODES,nodes);
+	WriteData(CONSTRAINTS,constraints);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
+	WriteData(PARAMETERS,parameters);
 	
 
Index: /issm/trunk/src/mex/MpcNodes/MpcNodes.cpp
===================================================================
--- /issm/trunk/src/mex/MpcNodes/MpcNodes.cpp	(revision 2315)
+++ /issm/trunk/src/mex/MpcNodes/MpcNodes.cpp	(revision 2316)
@@ -32,6 +32,6 @@
 	
 	/*write output datasets: */
-	WriteData(RMG,Rmg,0,0,"Matrix",NULL);
-	WriteData(NODES,nodes,0,0,"DataSet",NULL);
+	WriteData(RMG,Rmg);
+	WriteData(NODES,nodes);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/NodeConnectivity/NodeConnectivity.cpp
===================================================================
--- /issm/trunk/src/mex/NodeConnectivity/NodeConnectivity.cpp	(revision 2315)
+++ /issm/trunk/src/mex/NodeConnectivity/NodeConnectivity.cpp	(revision 2316)
@@ -29,5 +29,5 @@
 
 	/*write output datasets: */
-	WriteData(CONNECTIVITY,connectivity,nods,width,"Matrix","Mat");
+	WriteData(CONNECTIVITY,connectivity,nods,width);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/NormalizeConstraints/NormalizeConstraints.cpp
===================================================================
--- /issm/trunk/src/mex/NormalizeConstraints/NormalizeConstraints.cpp	(revision 2315)
+++ /issm/trunk/src/mex/NormalizeConstraints/NormalizeConstraints.cpp	(revision 2316)
@@ -31,5 +31,5 @@
 
 	/*write output datasets: */
-	WriteData(GMN,Gmn,0,0,"Matrix",NULL);
+	WriteData(GMN,Gmn);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Orth/Orth.cpp
===================================================================
--- /issm/trunk/src/mex/Orth/Orth.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Orth/Orth.cpp	(revision 2316)
@@ -31,5 +31,5 @@
 
 	/*write output datasets: */
-	WriteData(NEWGRADJ,newgradj,0,0,"Vector",NULL);
+	WriteData(NEWGRADJ,newgradj);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/OutputRifts/OutputRifts.cpp
===================================================================
--- /issm/trunk/src/mex/OutputRifts/OutputRifts.cpp	(revision 2315)
+++ /issm/trunk/src/mex/OutputRifts/OutputRifts.cpp	(revision 2316)
@@ -32,5 +32,5 @@
 
 	/*write output : */
-	WriteData(RIFTPROPERTIES,riftproperties,0,0,"Vector",NULL);
+	WriteData(RIFTPROPERTIES,riftproperties);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/PenaltyConstraints/PenaltyConstraints.cpp
===================================================================
--- /issm/trunk/src/mex/PenaltyConstraints/PenaltyConstraints.cpp	(revision 2315)
+++ /issm/trunk/src/mex/PenaltyConstraints/PenaltyConstraints.cpp	(revision 2316)
@@ -47,7 +47,7 @@
 
 	/*write output datasets: */
-	WriteData(LOADS,loads,0,0,"DataSet",NULL); 
-	WriteData(CONVERGED,(void*)&converged,0,0,"Integer",NULL); 
-	WriteData(NUMUNSTABLECONSTRAINTS,(void*)&num_unstable_constraints,0,0,"Integer",NULL); 
+	WriteData(LOADS,loads);
+	WriteData(CONVERGED,converged);
+	WriteData(NUMUNSTABLECONSTRAINTS,num_unstable_constraints);
 	
 	
Index: /issm/trunk/src/mex/PenaltySystemMatrices/PenaltySystemMatrices.cpp
===================================================================
--- /issm/trunk/src/mex/PenaltySystemMatrices/PenaltySystemMatrices.cpp	(revision 2315)
+++ /issm/trunk/src/mex/PenaltySystemMatrices/PenaltySystemMatrices.cpp	(revision 2316)
@@ -52,7 +52,7 @@
 
 	/*write output datasets: */
-	WriteData(KGG,Kgg,0,0,"Matrix",NULL); 
-	WriteData(PG,pg,0,0,"Vector",NULL); 
-	WriteData(KMAX,&kmax,0,0,"Scalar",NULL); 
+	WriteData(KGG,Kgg);
+	WriteData(PG,pg);
+	WriteData(KMAX,kmax);
 	
 	/*Free ressources: */
Index: /issm/trunk/src/mex/ProcessParams/ProcessParams.cpp
===================================================================
--- /issm/trunk/src/mex/ProcessParams/ProcessParams.cpp	(revision 2315)
+++ /issm/trunk/src/mex/ProcessParams/ProcessParams.cpp	(revision 2316)
@@ -31,5 +31,5 @@
 
 	/*write output datasets: */
-	WriteData(PARAMETERSOUT,parameters,0,0,"DataSet",NULL);
+	WriteData(PARAMETERSOUT,parameters);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp
===================================================================
--- /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Reduceloadfromgtof/Reduceloadfromgtof.cpp	(revision 2316)
@@ -37,5 +37,5 @@
 
 	/*write output datasets: */
-	WriteData(PF,pf,0,0,"Vector",NULL);
+	WriteData(PF,pf);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Reducematrixfromgtof/Reducematrixfromgtof.cpp
===================================================================
--- /issm/trunk/src/mex/Reducematrixfromgtof/Reducematrixfromgtof.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Reducematrixfromgtof/Reducematrixfromgtof.cpp	(revision 2316)
@@ -34,6 +34,6 @@
 
 	/*write output datasets: */
-	WriteData(KFF,Kff,0,0,"Matrix",NULL);
-	WriteData(KFS,Kfs,0,0,"Matrix",NULL);
+	WriteData(KFF,Kff);
+	WriteData(KFS,Kfs);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Reducevectorgtof/Reducevectorgtof.cpp
===================================================================
--- /issm/trunk/src/mex/Reducevectorgtof/Reducevectorgtof.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Reducevectorgtof/Reducevectorgtof.cpp	(revision 2316)
@@ -31,5 +31,5 @@
 
 	/*write output datasets: */
-	WriteData(UF,uf,0,0,"Vector",NULL);
+	WriteData(UF,uf);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp
===================================================================
--- /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Reducevectorgtos/Reducevectorgtos.cpp	(revision 2316)
@@ -32,6 +32,6 @@
 
 	/*write output datasets: */
-	WriteData(YS,ys,0,0,"Vector",NULL);
-	WriteData(YS0,ys0,0,0,"Vector",NULL);
+	WriteData(YS,ys);
+	WriteData(YS0,ys0);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/Solver/Solver.cpp
===================================================================
--- /issm/trunk/src/mex/Solver/Solver.cpp	(revision 2315)
+++ /issm/trunk/src/mex/Solver/Solver.cpp	(revision 2316)
@@ -35,5 +35,5 @@
 
 	/*write output datasets: */
-	WriteData(UF,uf,0,0,"Vector",NULL);
+	WriteData(UF,uf);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp
===================================================================
--- /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp	(revision 2315)
+++ /issm/trunk/src/mex/SpcNodes/SpcNodes.cpp	(revision 2316)
@@ -16,5 +16,5 @@
 
 	/* output datasets: */
-	Vec         yg=NULL;
+	DofVec*         yg=NULL;
 
 	/*Boot module: */
@@ -32,11 +32,11 @@
 
 	/*write output datasets: */
-	WriteData(NODES,nodes,0,0,"DataSet",NULL);
-	WriteData(YG,yg,0,0,"Vector",NULL);
+	WriteData(NODES,nodes);
+	WriteData(YG,yg);
 
 	/*Free ressources: */
 	delete nodes;
 	delete constraints;
-	VecFree(&yg);
+	delete yg;
 
 	/*end module: */
Index: /issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp
===================================================================
--- /issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp	(revision 2315)
+++ /issm/trunk/src/mex/SystemMatrices/SystemMatrices.cpp	(revision 2316)
@@ -53,6 +53,6 @@
 
 	/*write output datasets: */
-	WriteData(KGG,Kgg,0,0,"Matrix",NULL); 
-	WriteData(PG,pg,0,0,"Vector",NULL); 
+	WriteData(KGG,Kgg);
+	WriteData(PG,pg);
 	
 	
Index: /issm/trunk/src/mex/UpdateFromInputs/UpdateFromInputs.cpp
===================================================================
--- /issm/trunk/src/mex/UpdateFromInputs/UpdateFromInputs.cpp	(revision 2315)
+++ /issm/trunk/src/mex/UpdateFromInputs/UpdateFromInputs.cpp	(revision 2316)
@@ -37,8 +37,8 @@
 
 	/*write output datasets: */
-	WriteData(ELEMENTS,elements,0,0,"DataSet",NULL);
-	WriteData(NODES,nodes,0,0,"DataSet",NULL);
-	WriteData(LOADS,loads,0,0,"DataSet",NULL);
-	WriteData(MATERIALS,materials,0,0,"DataSet",NULL);
+	WriteData(ELEMENTS,elements);
+	WriteData(NODES,nodes);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/UpdateGeometry/UpdateGeometry.cpp
===================================================================
--- /issm/trunk/src/mex/UpdateGeometry/UpdateGeometry.cpp	(revision 2315)
+++ /issm/trunk/src/mex/UpdateGeometry/UpdateGeometry.cpp	(revision 2316)
@@ -44,7 +44,7 @@
 
 	/*write output data: */
-	WriteData(OUTTHICKNESS,outthickness,0,0,"Vector",NULL);
-	WriteData(OUTBED,outbed,0,0,"Vector",NULL);
-	WriteData(OUTSURFACE,outsurface,0,0,"Vector",NULL);
+	WriteData(OUTTHICKNESS,outthickness);
+	WriteData(OUTBED,outbed);
+	WriteData(OUTSURFACE,outsurface);
 
 	/*Free ressources: */
Index: /issm/trunk/src/mex/UpdateNodePositions/UpdateNodePositions.cpp
===================================================================
--- /issm/trunk/src/mex/UpdateNodePositions/UpdateNodePositions.cpp	(revision 2315)
+++ /issm/trunk/src/mex/UpdateNodePositions/UpdateNodePositions.cpp	(revision 2316)
@@ -36,5 +36,5 @@
 
 	/*write output datasets: */
-	WriteData(NODESOUT,nodes,0,0,"DataSet",NULL);
+	WriteData(NODESOUT,nodes);
 
 	/*Free ressources: */
Index: /issm/trunk/startup.m
===================================================================
--- /issm/trunk/startup.m	(revision 2315)
+++ /issm/trunk/startup.m	(revision 2316)
@@ -43,4 +43,5 @@
 addpath(genpath_ice([ISSM_DIR '/src/m']));
 addpath(genpath_ice([ISSM_DIR '/src/pro']));
+addpath(genpath_ice([ISSM_DIR '/externalpackages/subplotSpacing']));
 
 %Check on any warning messages that might indicate that the paths were not correct. 
Index: /issm/trunk/test/Verification/test01_IceShelfIceFrontM2d/testpresolve.m
===================================================================
--- /issm/trunk/test/Verification/test01_IceShelfIceFrontM2d/testpresolve.m	(revision 2315)
+++ /issm/trunk/test/Verification/test01_IceShelfIceFrontM2d/testpresolve.m	(revision 2316)
@@ -2,2 +2,3 @@
 	load Velocities; md.vx=0.5*vx; md.vy=0.5*vy;
 end
+md.debug=1;
