Index: /issm/trunk-jpl/src/c/bamg/BamgQuadtree.h
===================================================================
--- /issm/trunk-jpl/src/c/bamg/BamgQuadtree.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/bamg/BamgQuadtree.h	(revision 19198)
@@ -35,4 +35,5 @@
 					int     ObjectEnum() {_error_("not implemented yet"); };
 					Object *copy()       {_error_("not implemented yet"); };
+					void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 			};
 
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h	(revision 19198)
@@ -35,4 +35,5 @@
 		int     Id();
 		int     ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*Constraint virtual functions definitions*/
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.h	(revision 19198)
@@ -34,4 +34,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Constraint virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h	(revision 19198)
@@ -36,4 +36,5 @@
 		int     Id(); 
 		int     ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Constraint virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Contour.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Contour.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Contour.h	(revision 19198)
@@ -83,4 +83,9 @@
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
+
 };
 
Index: /issm/trunk-jpl/src/c/classes/DependentObject.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/DependentObject.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/DependentObject.h	(revision 19198)
@@ -32,4 +32,8 @@
 		int   ObjectEnum();
 		Object* copy(void);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 19198)
@@ -67,4 +67,5 @@
 		void               DeleteMaterials(void);
 		IssmDouble         Divergence(void);
+		void               Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		void               dViscositydBFS(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
 		void               dViscositydBHO(IssmDouble* pdmudB,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input);
Index: /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 19198)
@@ -126,4 +126,10 @@
 			return new GenericExternalResult<ResultType>(this->id,this->result_name,this->value,this->step,this->time);
 		} /*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
+
+
 
 		/*GenericExternalResult management: */
Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 19198)
@@ -609,4 +609,6 @@
 	FILE* restartfid=NULL;
 	char* restartfilename = NULL;
+	int   femmodel_size;
+	char* femmodel_buffer=NULL;
 
 	/*First, recover the name of the restart file: */
@@ -616,8 +618,19 @@
 	restartfid=pfopen(restartfilename,"wb");
 
+	/*Create buffer to hold marshalled femmodel: */
+	this->Marshall(NULL,&femmodel_size,MARSHALLING_FORWARD);
+	femmodel_buffer=xNew<char>(femmodel_size);
+
+	/*Marshall:*/
+	this->Marshall(&femmodel_buffer,&femmodel_size,MARSHALLING_FORWARD);
+
+	/*write buffer: */
+	fwrite(femmodel_buffer,femmodel_size,sizeof(IssmPDouble),restartfid);
+
 	/*Done, close file :*/
 	pfclose(restartfid,restartfilename);
 
 	/*Free ressources: */
+	xDelete<char>(femmodel_buffer);
 	xDelete<char>(restartfilename);
 
@@ -625,4 +638,37 @@
 /*}}}*/
 void FemModel::Restart(void){/*{{{*/
+}
+/*}}}*/
+void FemModel::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(FemModelEnum);
+
+	MARSHALLING(solution_type);
+	MARSHALLING(analysis_counter);
+	MARSHALLING_DYNAMIC(analysis_type_list,int,analysis_counter);
+
+	if(marshall_direction==MARSHALLING_BACKWARDS){
+		profiler=new Profiler;
+		elements=new Elements();
+		nodes=new Nodes();
+		vertices=new Vertices();
+		constraints=new Constraints();
+		loads=new Loads();
+		materials=new Materials();
+		parameters=new Parameters();
+		results=new Results();
+	}
+	
+	profiler->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	MARSHALLING(comm);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/FemModel.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/FemModel.h	(revision 19198)
@@ -61,4 +61,5 @@
 		void SetCurrentConfiguration(int configuration_type,int analysis_type);
 		void CheckPoint(void);
+		void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
 		void Restart(void);
 
Index: /issm/trunk-jpl/src/c/classes/IndependentObject.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/IndependentObject.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/IndependentObject.h	(revision 19198)
@@ -31,4 +31,5 @@
 		int   ObjectEnum();
 		Object* copy(void);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
 		/*}}}*/
 		/*IndependentObject methods: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 19198)
@@ -27,4 +27,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*BoolInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 19198)
@@ -35,4 +35,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*ControlInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 19198)
@@ -32,4 +32,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*DatasetInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 19198)
@@ -30,4 +30,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*DoubleInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 19198)
@@ -31,4 +31,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*IntInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 19198)
@@ -32,4 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*PentaInput management*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 19198)
@@ -32,4 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*SegInput management:*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 19198)
@@ -32,4 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*TetraInput management:*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*TransientInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 19198)
@@ -32,4 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*TriaInput management:*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Loads.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Loads.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Loads/Loads.cpp	(revision 19198)
@@ -15,7 +15,7 @@
 #include <algorithm>
 
+#include "../../shared/io/Comm/IssmComm.h"
 #include "./Loads.h"
 #include "./Load.h"
-#include "../../shared/shared.h"
 
 using namespace std;
Index: /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 19198)
@@ -45,4 +45,5 @@
 		int     Id();
 		int     ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 19198)
@@ -55,4 +55,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Penpair.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 19198)
@@ -36,4 +36,5 @@
 		int      Id(); 
 		int      ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 19198)
@@ -62,4 +62,5 @@
 		int      Id(); 
 		int      ObjectEnum();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Masscon.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Masscon.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Masscon.h	(revision 19198)
@@ -77,4 +77,8 @@
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Massconaxpby.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Massconaxpby.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Massconaxpby.h	(revision 19198)
@@ -88,4 +88,8 @@
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Massfluxatgate.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 19198)
@@ -121,4 +121,8 @@
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Materials/Matice.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matice.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matice.h	(revision 19198)
@@ -40,4 +40,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Update virtual funictions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Materials/Matpar.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 19198)
@@ -79,4 +79,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Misfit.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Misfit.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Misfit.h	(revision 19198)
@@ -104,4 +104,8 @@
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		char* Name(){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Node.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Node.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Node.h	(revision 19198)
@@ -50,4 +50,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*Node numerical routines*/
Index: /issm/trunk-jpl/src/c/classes/Nodes.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodes.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Nodes.cpp	(revision 19198)
@@ -11,6 +11,6 @@
 #endif
 
+#include "../shared/io/Comm/IssmComm.h"
 #include "./Nodes.h"
-#include "../shared/shared.h"
 #include "./Node.h"
 
Index: /issm/trunk-jpl/src/c/classes/Options/Option.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Options/Option.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Options/Option.h	(revision 19198)
@@ -26,4 +26,6 @@
 		int           ObjectEnum(){return OptionEnum;              };
 		Object       *copy(){_error_("Not implemented yet"); };
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+
 
 		/*virtual functions: */
Index: /issm/trunk-jpl/src/c/classes/Params/BoolParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/BoolParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/BoolParam.h	(revision 19198)
@@ -36,4 +36,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h	(revision 19198)
@@ -39,4 +39,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h	(revision 19198)
@@ -38,4 +38,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/FileParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/FileParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/FileParam.h	(revision 19198)
@@ -36,4 +36,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/GenericParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/GenericParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/GenericParam.h	(revision 19198)
@@ -52,4 +52,5 @@
                 // use the default copy constructor instead
                 Object* copy() { return new GenericParam<P>(*this); };
+				void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
                 /*}}}*/
                 /*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/IntMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntMatParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/IntMatParam.h	(revision 19198)
@@ -38,4 +38,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/IntParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/IntParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/IntVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntVecParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/IntVecParam.h	(revision 19198)
@@ -38,4 +38,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/MatrixParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/MatrixParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/MatrixParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h	(revision 19198)
@@ -38,4 +38,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/StringParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/StringParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/TransientParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientParam.h	(revision 19198)
@@ -38,4 +38,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/VectorParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/VectorParam.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Params/VectorParam.h	(revision 19198)
@@ -37,4 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Profiler.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Profiler.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Profiler.h	(revision 19198)
@@ -43,4 +43,5 @@
 		int     ObjectEnum();
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 		/*}}}*/
 		/*Profiler routines {{{*/
Index: /issm/trunk-jpl/src/c/classes/Segment.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Segment.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Segment.h	(revision 19198)
@@ -71,4 +71,8 @@
 		}
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 };
Index: /issm/trunk-jpl/src/c/classes/Vertex.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertex.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/Vertex.h	(revision 19198)
@@ -42,4 +42,6 @@
 		int   ObjectEnum();
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+
 		/*}}}*/
 		/*Vertex management:*/ 
Index: /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.h	(revision 19198)
@@ -27,4 +27,6 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+
 
 		/*Variogram functions*/
Index: /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.h	(revision 19198)
@@ -28,4 +28,5 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
 
 		/*Variogram functions*/
Index: /issm/trunk-jpl/src/c/classes/kriging/Observation.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/Observation.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/kriging/Observation.h	(revision 19198)
@@ -33,4 +33,6 @@
 		bool operator==(const Observation& ob) const;
 		Object *copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
+
 
 		/*Management*/
Index: /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.h	(revision 19198)
@@ -27,4 +27,6 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+
 
 		/*Variogram functions*/
Index: /issm/trunk-jpl/src/c/classes/kriging/Quadtree.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/Quadtree.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/kriging/Quadtree.h	(revision 19198)
@@ -31,4 +31,6 @@
 				int     ObjectEnum(){_error_("not implemented yet"); };
 				Object *copy();
+				void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
+
 
 				/*Methods*/
Index: /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.h	(revision 19198)
@@ -27,4 +27,6 @@
 		int   ObjectEnum(){_error_("Not implemented yet");};
 		Object* copy();
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+
 
 		/*Variogram functions*/
Index: /issm/trunk-jpl/src/c/datastructures/DataSet.cpp
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/DataSet.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/datastructures/DataSet.cpp	(revision 19198)
@@ -19,4 +19,5 @@
 #include "../datastructures/datastructures.h"
 #include "../shared/shared.h"
+#include "../classes/classes.h"
 
 using namespace std;
@@ -86,4 +87,64 @@
 
 /*Specific methods*/
+void DataSet::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+	
+	vector<Object*>::iterator obj;
+	int obj_enum;
+	int i;
+	
+	if(marshall_direction==MARSHALLING_FORWARD){
+		numsorted=objects.size();
+	}
+
+	MARSHALLING_ENUM(DataSetEnum);
+	MARSHALLING(enum_type);
+	MARSHALLING(sorted);
+	MARSHALLING(presorted);
+	MARSHALLING(numsorted);
+	MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
+	MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
+
+	/*Now branch according to direction of marshalling: */
+	if(marshall_direction==MARSHALLING_FORWARD){
+		/*Go through our objects, and marshall them into the buffer: */
+		for ( obj=this->objects.begin() ; obj < this->objects.end(); obj++ ){
+			(*obj)->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+		}
+	}
+	else{
+		/*This is the heart of the demashalling method. We have a buffer coming
+		 in, and we are supposed to create a dataset out of it. No such thing
+		 as class orientation for buffers, we need to key off the enum of each
+		 object stored in the buffer. */
+		for(i=0;i<this->numsorted;i++){
+
+			/*Recover enum of object first: */
+			MARSHALLING_ENUM(obj_enum); 
+
+			/*Reset the file pointer to point again to the beginning of the object: */
+			*pmarshalled_data-=sizeof(int);
+
+			/*Giant case statement to spin-up the right object, and demarshall into it the information 
+			 *stored in the buffer: */
+			switch(enum_type){
+				case NodeEnum:{
+					Node* node=NULL;
+					node=new Node();
+					node->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+					this->AddObject(node);}
+					break;
+				case VertexEnum:{
+					Vertex* vertex=NULL;
+					vertex=new Vertex();
+					vertex->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+					this->AddObject(vertex);}
+					break;
+				default:
+					_error_("could not recognize enum type: " << EnumToStringx(enum_type));
+			}
+		}
+	}
+}
+/*}}}*/
 int   DataSet::AddObject(Object* object){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/datastructures/DataSet.h
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/DataSet.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/datastructures/DataSet.h	(revision 19198)
@@ -33,4 +33,5 @@
 		DataSet(int enum_type);
 		~DataSet();
+		void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
 
 		/*management*/
Index: /issm/trunk-jpl/src/c/datastructures/Object.h
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/Object.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/datastructures/Object.h	(revision 19198)
@@ -21,4 +21,5 @@
 		virtual int   ObjectEnum()=0;
 		virtual Object* copy()=0;
+		virtual void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction)=0;
 
 };
Index: /issm/trunk-jpl/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/modules/MeshProfileIntersectionx/MeshProfileIntersectionx.cpp	(revision 19198)
@@ -252,5 +252,4 @@
 				
 				/*ok, segments[0] is common to one of our vertices: */
-				//if (el==318 && contouri==9){ _printf_("ok1" << "\n"); }
 				coord1=0;
 				if(edge1==IntersectEnum){coord2=alpha1;}
Index: /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 19198)
@@ -8,4 +8,7 @@
 
 enum definitions{
+	/*General: {{{*/
+	FemModelEnum,
+	/*}}}*/
 	/*Model fields {{{*/
 	AutodiffIsautodiffEnum, 
@@ -455,4 +458,5 @@
 	/*}}}*/
 	/*Datasets {{{*/
+	DataSetEnum,
 	ConstraintsEnum,
 	LoadsEnum,
Index: /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 19198)
@@ -17,4 +17,5 @@
 	switch(en){
 
+		case FemModelEnum : return "FemModel";
 		case AutodiffIsautodiffEnum : return "AutodiffIsautodiff";
 		case AutodiffNumDependentsEnum : return "AutodiffNumDependents";
@@ -454,4 +455,5 @@
 		case FSvelocityEnum : return "FSvelocity";
 		case FSpressureEnum : return "FSpressure";
+		case DataSetEnum : return "DataSet";
 		case ConstraintsEnum : return "Constraints";
 		case LoadsEnum : return "Loads";
Index: /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 19197)
+++ /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 19198)
@@ -17,5 +17,6 @@
 
    if(stage==1){
-	      if (strcmp(name,"AutodiffIsautodiff")==0) return AutodiffIsautodiffEnum;
+	      if (strcmp(name,"FemModel")==0) return FemModelEnum;
+	      else if (strcmp(name,"AutodiffIsautodiff")==0) return AutodiffIsautodiffEnum;
 	      else if (strcmp(name,"AutodiffNumDependents")==0) return AutodiffNumDependentsEnum;
 	      else if (strcmp(name,"AutodiffNumDependentObjects")==0) return AutodiffNumDependentObjectsEnum;
@@ -136,9 +137,9 @@
 	      else if (strcmp(name,"HydrologydcEplPorosity")==0) return HydrologydcEplPorosityEnum;
 	      else if (strcmp(name,"HydrologydcEplInitialThickness")==0) return HydrologydcEplInitialThicknessEnum;
-	      else if (strcmp(name,"HydrologydcEplColapseThickness")==0) return HydrologydcEplColapseThicknessEnum;
          else stage=2;
    }
    if(stage==2){
-	      if (strcmp(name,"HydrologydcEplMaxThickness")==0) return HydrologydcEplMaxThicknessEnum;
+	      if (strcmp(name,"HydrologydcEplColapseThickness")==0) return HydrologydcEplColapseThicknessEnum;
+	      else if (strcmp(name,"HydrologydcEplMaxThickness")==0) return HydrologydcEplMaxThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplThickness")==0) return HydrologydcEplThicknessEnum;
 	      else if (strcmp(name,"HydrologydcEplThicknessOld")==0) return HydrologydcEplThicknessOldEnum;
@@ -259,9 +260,9 @@
 	      else if (strcmp(name,"MeshLowerelements")==0) return MeshLowerelementsEnum;
 	      else if (strcmp(name,"MeshNumberofelements2d")==0) return MeshNumberofelements2dEnum;
-	      else if (strcmp(name,"MeshNumberofelements")==0) return MeshNumberofelementsEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"MeshNumberoflayers")==0) return MeshNumberoflayersEnum;
+	      if (strcmp(name,"MeshNumberofelements")==0) return MeshNumberofelementsEnum;
+	      else if (strcmp(name,"MeshNumberoflayers")==0) return MeshNumberoflayersEnum;
 	      else if (strcmp(name,"MeshNumberofvertices2d")==0) return MeshNumberofvertices2dEnum;
 	      else if (strcmp(name,"MeshNumberofvertices")==0) return MeshNumberofverticesEnum;
@@ -382,9 +383,9 @@
 	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
 	      else if (strcmp(name,"SurfaceforcingsBNeg")==0) return SurfaceforcingsBNegEnum;
-	      else if (strcmp(name,"SMBhenning")==0) return SMBhenningEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"SMBcomponents")==0) return SMBcomponentsEnum;
+	      if (strcmp(name,"SMBhenning")==0) return SMBhenningEnum;
+	      else if (strcmp(name,"SMBcomponents")==0) return SMBcomponentsEnum;
 	      else if (strcmp(name,"SurfaceforcingsAccumulation")==0) return SurfaceforcingsAccumulationEnum;
 	      else if (strcmp(name,"SurfaceforcingsEvaporation")==0) return SurfaceforcingsEvaporationEnum;
@@ -463,4 +464,5 @@
 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+	      else if (strcmp(name,"DataSet")==0) return DataSetEnum;
 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
 	      else if (strcmp(name,"Loads")==0) return LoadsEnum;
@@ -504,10 +506,10 @@
 	      else if (strcmp(name,"NumericalfluxType")==0) return NumericalfluxTypeEnum;
 	      else if (strcmp(name,"Param")==0) return ParamEnum;
-	      else if (strcmp(name,"Pengrid")==0) return PengridEnum;
-	      else if (strcmp(name,"Penpair")==0) return PenpairEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"Profiler")==0) return ProfilerEnum;
+	      if (strcmp(name,"Pengrid")==0) return PengridEnum;
+	      else if (strcmp(name,"Penpair")==0) return PenpairEnum;
+	      else if (strcmp(name,"Profiler")==0) return ProfilerEnum;
 	      else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum;
 	      else if (strcmp(name,"Masscon")==0) return MassconEnum;
@@ -627,10 +629,10 @@
 	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
 	      else if (strcmp(name,"StressMaxPrincipal")==0) return StressMaxPrincipalEnum;
-	      else if (strcmp(name,"DeviatoricStress")==0) return DeviatoricStressEnum;
-	      else if (strcmp(name,"DeviatoricStressxx")==0) return DeviatoricStressxxEnum;
          else stage=6;
    }
    if(stage==6){
-	      if (strcmp(name,"DeviatoricStressxy")==0) return DeviatoricStressxyEnum;
+	      if (strcmp(name,"DeviatoricStress")==0) return DeviatoricStressEnum;
+	      else if (strcmp(name,"DeviatoricStressxx")==0) return DeviatoricStressxxEnum;
+	      else if (strcmp(name,"DeviatoricStressxy")==0) return DeviatoricStressxyEnum;
 	      else if (strcmp(name,"DeviatoricStressxz")==0) return DeviatoricStressxzEnum;
 	      else if (strcmp(name,"DeviatoricStressyy")==0) return DeviatoricStressyyEnum;
@@ -750,10 +752,10 @@
 	      else if (strcmp(name,"Outputdefinition67")==0) return Outputdefinition67Enum;
 	      else if (strcmp(name,"Outputdefinition68")==0) return Outputdefinition68Enum;
-	      else if (strcmp(name,"Outputdefinition69")==0) return Outputdefinition69Enum;
-	      else if (strcmp(name,"Outputdefinition70")==0) return Outputdefinition70Enum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"Outputdefinition71")==0) return Outputdefinition71Enum;
+	      if (strcmp(name,"Outputdefinition69")==0) return Outputdefinition69Enum;
+	      else if (strcmp(name,"Outputdefinition70")==0) return Outputdefinition70Enum;
+	      else if (strcmp(name,"Outputdefinition71")==0) return Outputdefinition71Enum;
 	      else if (strcmp(name,"Outputdefinition72")==0) return Outputdefinition72Enum;
 	      else if (strcmp(name,"Outputdefinition73")==0) return Outputdefinition73Enum;
@@ -873,10 +875,10 @@
 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
-	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
-	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
          else stage=8;
    }
    if(stage==8){
-	      if (strcmp(name,"XY")==0) return XYEnum;
+	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+	      else if (strcmp(name,"XY")==0) return XYEnum;
 	      else if (strcmp(name,"XYZ")==0) return XYZEnum;
 	      else if (strcmp(name,"Dense")==0) return DenseEnum;
Index: /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h	(revision 19198)
+++ /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h	(revision 19198)
@@ -0,0 +1,66 @@
+/*\file Marshalling.h
+ *\brief: macros to help automate the marshalling, demarshalling, and marshalling size routines. 
+ */
+
+#ifndef _MARSHALLING_H_
+#define _MARSHALLING_H_
+
+enum marshall_directions{
+	MARSHALLING_FORWARD,
+	MARSHALLING_BACKWARDS
+};
+
+#define MARSHALLING_ENUM(EN) \
+	int enum_type=EN; \
+	if(marshall_direction==MARSHALLING_FORWARD){\
+		if(pmarshalled_data){\
+			memcpy(*pmarshalled_data,&enum_type,sizeof(int));\
+			*pmarshalled_data+=sizeof(int);\
+		}\
+		*pmarshalled_data_size+=sizeof(int);\
+	}
+
+#define MARSHALLING(FIELD) \
+\
+	if(marshall_direction==MARSHALLING_FORWARD){\
+		if(pmarshalled_data){\
+			memcpy(*pmarshalled_data,&FIELD,sizeof(FIELD));\
+			*pmarshalled_data+=sizeof(FIELD);\
+		}\
+		*pmarshalled_data_size+=sizeof(FIELD);\
+	}\
+	else{\
+		memcpy(&FIELD,*pmarshalled_data,sizeof(FIELD));\
+		*pmarshalled_data+=sizeof(FIELD);\
+	}
+
+#define MARSHALLING_ARRAY(FIELD,TYPE,SIZE) \
+\
+	if(marshall_direction==MARSHALLING_FORWARD){\
+		if(pmarshalled_data){\
+			memcpy(*pmarshalled_data,FIELD,SIZE*sizeof(TYPE));\
+			*pmarshalled_data+=SIZE*sizeof(TYPE);\
+		}\
+		*pmarshalled_data_size+=SIZE*sizeof(TYPE);\
+	}\
+	else{\
+		memcpy(FIELD,*pmarshalled_data,SIZE*sizeof(TYPE));\
+		*pmarshalled_data+=SIZE*sizeof(TYPE);\
+	}
+
+#define MARSHALLING_DYNAMIC(FIELD,TYPE,SIZE) \
+\
+	if(marshall_direction==MARSHALLING_FORWARD){\
+		if(pmarshalled_data){\
+			memcpy(*pmarshalled_data,FIELD,SIZE*sizeof(TYPE));\
+			*pmarshalled_data+=SIZE*sizeof(TYPE);\
+		}\
+		*pmarshalled_data_size+=SIZE*sizeof(TYPE);\
+	}\
+	else{\
+		FIELD=xNew<TYPE>(SIZE);\
+		memcpy(FIELD,*pmarshalled_data,SIZE*sizeof(TYPE));\
+		*pmarshalled_data+=SIZE*sizeof(TYPE);\
+	}
+
+#endif	
Index: /issm/trunk-jpl/src/c/shared/io/io.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/io/io.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/shared/io/io.h	(revision 19198)
@@ -12,7 +12,8 @@
 #endif 
 
+#include "./Comm/IssmComm.h"
 #include "./Disk/diskio.h"
 #include "./Print/Print.h"
-#include "./Comm/IssmComm.h"
+#include "./Marshalling/Marshalling.h"
 
 #endif	/* _IO_H_ */
Index: /issm/trunk-jpl/src/c/toolkits/issm/Bucket.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/Bucket.h	(revision 19197)
+++ /issm/trunk-jpl/src/c/toolkits/issm/Bucket.h	(revision 19198)
@@ -9,5 +9,5 @@
 /*{{{*/
 #include "../../datastructures/datastructures.h"
-#include "../../shared/shared.h"
+#include "../../shared/io/Comm/IssmComm.h"
 #include "../toolkitsenums.h"
 /*}}}*/
@@ -129,4 +129,8 @@
 			else _error_("No Copy of Bucket because its type is invalid."); };
 		/*}}}*/
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 		/*specific routines of Bucket: */
Index: /issm/trunk-jpl/src/m/dev/devpath.m
===================================================================
--- /issm/trunk-jpl/src/m/dev/devpath.m	(revision 19197)
+++ /issm/trunk-jpl/src/m/dev/devpath.m	(revision 19198)
@@ -18,5 +18,5 @@
 %ISSM path
 addpath([ISSM_DIR '/src/m/os/']); %load recursivepath
-addpath([ISSM_DIR '/lib']);       %load mex
+addpath([ISSM_DIR '/build-fw/lib']);       %load mex
 addpath(recursivepath([ISSM_DIR '/src/m']));
 addpath(recursivepath([ISSM_DIR '/externalpackages/scotch']));
Index: /issm/trunk-jpl/src/m/dev/devpath.py
===================================================================
--- /issm/trunk-jpl/src/m/dev/devpath.py	(revision 19197)
+++ /issm/trunk-jpl/src/m/dev/devpath.py	(revision 19198)
@@ -22,5 +22,5 @@
 					sys.path.append(root)
 				
-sys.path.append(ISSM_DIR + '/lib')
+sys.path.append(ISSM_DIR + '/build-fw/lib')
 sys.path.append(ISSM_DIR + '/src/wrappers/python/.libs')
 # If using clusters, we need to have the path to the cluster settings directory
Index: /issm/trunk-jpl/src/m/enum/DataSetEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/DataSetEnum.m	(revision 19198)
+++ /issm/trunk-jpl/src/m/enum/DataSetEnum.m	(revision 19198)
@@ -0,0 +1,11 @@
+function macro=DataSetEnum()
+%DATASETENUM - Enum of DataSet
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=DataSetEnum()
+
+macro=StringToEnum('DataSet');
Index: /issm/trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- /issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 19197)
+++ /issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 19198)
@@ -9,4 +9,5 @@
 """
 
+def FemModelEnum(): return StringToEnum("FemModel")[0]
 def AutodiffIsautodiffEnum(): return StringToEnum("AutodiffIsautodiff")[0]
 def AutodiffNumDependentsEnum(): return StringToEnum("AutodiffNumDependents")[0]
@@ -446,4 +447,5 @@
 def FSvelocityEnum(): return StringToEnum("FSvelocity")[0]
 def FSpressureEnum(): return StringToEnum("FSpressure")[0]
+def DataSetEnum(): return StringToEnum("DataSet")[0]
 def ConstraintsEnum(): return StringToEnum("Constraints")[0]
 def LoadsEnum(): return StringToEnum("Loads")[0]
Index: /issm/trunk-jpl/src/m/enum/FemModelEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/FemModelEnum.m	(revision 19198)
+++ /issm/trunk-jpl/src/m/enum/FemModelEnum.m	(revision 19198)
@@ -0,0 +1,11 @@
+function macro=FemModelEnum()
+%FEMMODELENUM - Enum of FemModel
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=FemModelEnum()
+
+macro=StringToEnum('FemModel');
Index: /issm/trunk-jpl/src/m/mesh/bamg.m
===================================================================
--- /issm/trunk-jpl/src/m/mesh/bamg.m	(revision 19197)
+++ /issm/trunk-jpl/src/m/mesh/bamg.m	(revision 19198)
@@ -235,5 +235,8 @@
 		if all(ischar(track)),
 			A=expread(track);
-			track=[A.x A.y];
+			track=[];
+			for i=1:length(A), 
+				track=[track; [A(i).x A(i).y]];
+			end
 		else
 			track=double(track); %for some reason, it is of class "single"
