Index: /issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.cpp	(revision 25506)
@@ -74,4 +74,8 @@
 /*}}}*/
 void Cfdragcoeffabsgrad::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
+void Cfdragcoeffabsgrad::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
 	_error_("not implemented yet!"); 
 } 
Index: /issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Cfdragcoeffabsgrad.h	(revision 25506)
@@ -35,4 +35,5 @@
 		int Id(void);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
 		
Index: /issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.cpp	(revision 25506)
@@ -78,4 +78,8 @@
 } 
 /*}}}*/
+void Cfsurfacelogvel::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
 int Cfsurfacelogvel::ObjectEnum(void){/*{{{*/
 	return CfsurfacelogvelEnum;
Index: /issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Cfsurfacelogvel.h	(revision 25506)
@@ -35,4 +35,5 @@
 		int Id(void);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
 		
Index: /issm/trunk-jpl/src/c/classes/Cfsurfacesquare.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Cfsurfacesquare.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Cfsurfacesquare.cpp	(revision 25506)
@@ -83,4 +83,8 @@
 /*}}}*/
 void Cfsurfacesquare::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
+void Cfsurfacesquare::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
 	_error_("not implemented yet!"); 
 } 
Index: /issm/trunk-jpl/src/c/classes/Cfsurfacesquare.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Cfsurfacesquare.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Cfsurfacesquare.h	(revision 25506)
@@ -40,4 +40,5 @@
 		int Id(void);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
 		
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp	(revision 25506)
@@ -85,4 +85,19 @@
 }
 /*}}}*/
+void    SpcDynamic::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = SpcDynamicEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->nodeid);
+	marshallhandle->call(this->dof);
+	marshallhandle->call(this->value);
+	marshallhandle->call(this->analysis_type);
+	marshallhandle->call(this->isset);
+	marshallhandle->call(this->penalty);
+
+}
+/*}}}*/
 int     SpcDynamic::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h	(revision 25506)
@@ -35,4 +35,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp	(revision 25506)
@@ -83,4 +83,18 @@
 	MARSHALLING(analysis_type);
 	MARSHALLING(penalty);
+
+}
+/*}}}*/
+void    SpcStatic::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = SpcStaticEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->nodeid);
+	marshallhandle->call(this->dof);
+	marshallhandle->call(this->value);
+	marshallhandle->call(this->analysis_type);
+	marshallhandle->call(this->penalty);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.h	(revision 25506)
@@ -33,5 +33,6 @@
 		void  Echo();
 		int   Id(); 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp	(revision 25506)
@@ -100,4 +100,24 @@
 }
 /*}}}*/
+void    SpcTransient::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = SpcTransientEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->nodeid);
+	marshallhandle->call(this->dof);
+	marshallhandle->call(this->analysis_type);
+	marshallhandle->call(this->penalty);
+	marshallhandle->call(this->nsteps);
+	if(nsteps){
+		marshallhandle->call(this->values,nsteps);
+		marshallhandle->call(this->times,nsteps);
+	}
+	else{
+		this->values=NULL;
+		this->times=NULL;
+	}
+}/*}}}*/
 int     SpcTransient::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h	(revision 25506)
@@ -36,4 +36,5 @@
 		int     Id(); 
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Contour.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Contour.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Contour.h	(revision 25506)
@@ -83,4 +83,8 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		int ObjectEnum(void){/*{{{*/
 			return ContourEnum;
Index: /issm/trunk-jpl/src/c/classes/DependentObject.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/DependentObject.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/DependentObject.h	(revision 25506)
@@ -34,5 +34,6 @@
 		int   Id(); 
 		int   ObjectEnum();
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){_error_("not implemented yet!"); };
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){_error_("not implemented yet!"); };
+		void  Marshall2(MarshallHandle* marshallhandle){_error_("not implemented yet!"); };
 
 		/*DependentObject methods: */
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 25506)
@@ -2254,4 +2254,21 @@
 	MARSHALLING(element_type);
 	MARSHALLING_DYNAMIC(element_type_list,int,numanalyses);
+}
+/*}}}*/
+void       Element::MarshallElement2(MarshallHandle* marshallhandle,int numanalyses){/*{{{*/
+
+	_assert_(this);
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->nodes = NULL;
+	}
+
+	int object_enum = ElementEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->sid);
+	marshallhandle->call(this->lid);
+	marshallhandle->call(this->element_type);
+	marshallhandle->call(this->element_type_list,numanalyses);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 25506)
@@ -148,4 +148,5 @@
 		void               MantlePlumeGeothermalFlux();
 		void               MarshallElement(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction,int numanalyses);
+		void               MarshallElement2(MarshallHandle* marshallhandle,int numanalyses);
 		void               MigrateGroundingLine(IssmDouble* sheet_ungrounding);
 		void               MismipFloatingiceMeltingRate();
@@ -291,4 +292,5 @@
 		virtual void       JacobianDeterminantTop(IssmDouble* Jdet,IssmDouble* xyz_list_base,Gauss* gauss)=0;
 		virtual void       Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction)=0;
+		virtual void       Marshall2(MarshallHandle* marshallhandle)=0;
 		virtual IssmDouble Masscon(IssmDouble* levelset)=0;
 		virtual IssmDouble MassFlux(IssmDouble* segment)=0;
Index: /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 25506)
@@ -124,4 +124,64 @@
 }
 /*}}}*/
+void ElementHook::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int i;
+	bool* hnodesi_null=NULL; /*intermediary needed*/
+	bool  hnodes_null=true; /*this could be NULL on empty constructor*/
+	bool  hneighbors_null=true; /*don't deal with hneighbors, unless explicitely asked to*/
+
+	_assert_(this);
+
+	/*preliminary, before marshall starts: */
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
+		if(this->hneighbors)hneighbors_null=false;
+		if(this->hnodes){
+			hnodes_null=false;
+			hnodesi_null=xNew<bool>(numanalyses);
+			for(i=0;i<numanalyses;i++){
+				if(this->hnodes[i])hnodesi_null[i]=false;
+				else hnodesi_null[i]=true;
+			}
+		}
+	}
+
+	/*ok, marshall operations: */
+	int object_enum = ElementHookEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->numanalyses);
+	marshallhandle->call(hneighbors_null);
+	marshallhandle->call(hnodes_null);
+	marshallhandle->call(hnodesi_null,numanalyses);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+
+		if (!hnodes_null)this->hnodes = new Hook*[numanalyses];
+		else this->hnodes=NULL;
+		this->hvertices   = new Hook();
+		this->hmaterial   = new Hook();
+		if(!hneighbors_null)this->hneighbors  = new Hook();
+		else this->hneighbors=NULL;
+
+		/*Initialize hnodes: */
+		if (this->hnodes){
+			for(int i=0;i<this->numanalyses;i++){
+				if(!hnodesi_null[i])this->hnodes[i]=new Hook();
+				else this->hnodes[i]=NULL;
+			}
+		}
+	}
+
+	if (this->hnodes){ 
+		for (i=0;i<numanalyses;i++) if(this->hnodes[i])this->hnodes[i]->Marshall2(marshallhandle);
+	}
+	this->hvertices->Marshall2(marshallhandle);
+	this->hmaterial->Marshall2(marshallhandle);
+	if(this->hneighbors)this->hneighbors->Marshall2(marshallhandle);
+
+	/*Free ressources: */
+	if(hnodesi_null) xDelete<bool>(hnodesi_null);
+
+}
+/*}}}*/
 
 void ElementHook::DeepEcho(){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Elements/ElementHook.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/ElementHook.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/ElementHook.h	(revision 25506)
@@ -23,4 +23,5 @@
 		~ElementHook();
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		
 		void DeepEcho();
Index: /issm/trunk-jpl/src/c/classes/Elements/Elements.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Elements.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Elements.h	(revision 25506)
@@ -29,5 +29,4 @@
 		void   SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters);
 		void   ResetHooks();
-
 };
 
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 25506)
@@ -158,4 +158,20 @@
 }
 /*}}}*/
+void Penta::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = PentaEnum;
+   marshallhandle->call(object_enum);
+	marshallhandle->call(this->isonsurface);
+	marshallhandle->call(this->isonbase);
+
+	/*Call parent classes: */
+	ElementHook::Marshall2(marshallhandle);
+	Element::MarshallElement2(marshallhandle,this->numanalyses);
+	PentaRef::Marshall2(marshallhandle);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	verticalneighbors = (Penta**)this->hneighbors->deliverp();
+}/*}}}*/
 
 /*Other*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 25506)
@@ -41,4 +41,5 @@
 		Object *copy();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 25506)
@@ -30,4 +30,5 @@
 		void VerticalSegmentIndicesBase(int** pindices,int* pnumseg,int finiteelement);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
+		void Marshall2(MarshallHandle* marshallhandle){ /*do nothing */};
 		int  NumberofNodes(int finiteelement);
 		int  PressureInterpolation(int fe_stokes);
Index: /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 25506)
@@ -139,4 +139,25 @@
 }
 /*}}}*/
+void Seg::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = SegEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->iscollapsed);
+	marshallhandle->call(this->isonsurface);
+	marshallhandle->call(this->isonbase);
+	marshallhandle->call(this->collapsed_ids[0]);
+	marshallhandle->call(this->collapsed_ids[1]);
+
+	/*Call parent classes: */
+	ElementHook::Marshall2(marshallhandle);
+	Element::MarshallElement2(marshallhandle,this->numanalyses);
+	SegRef::Marshall2(marshallhandle);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+
+}
+/*}}}*/
 
 IssmDouble Seg::CharacteristicLength(void){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Seg.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 25506)
@@ -39,4 +39,5 @@
 		Object *copy();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/SegRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/SegRef.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/SegRef.h	(revision 25506)
@@ -25,4 +25,5 @@
 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
+		void Marshall2(MarshallHandle* marshallhandle){ /*do nothing */};
 		int  NumberofNodes(int finiteelement);
 };
Index: /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 25506)
@@ -128,4 +128,22 @@
 	Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
 	TetraRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+
+}
+/*}}}*/
+void Tetra::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = TetraEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->isonsurface);
+	marshallhandle->call(this->isonbase);
+
+	/*Call parent classes: */
+	ElementHook::Marshall2(marshallhandle);
+	Element::MarshallElement2(marshallhandle,this->numanalyses);
+	TetraRef::Marshall2(marshallhandle);
 
 	vertices = (Vertex**)this->hvertices->deliverp();
Index: /issm/trunk-jpl/src/c/classes/Elements/Tetra.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 25506)
@@ -37,4 +37,5 @@
 		Object *copy();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 25506)
@@ -26,4 +26,5 @@
 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
+		void Marshall2(MarshallHandle* marshallhandle){ /*do nothing */};
 		int  NumberofNodes(int finiteelement);
 		int  PressureInterpolation(int fe_stokes);
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 25506)
@@ -155,4 +155,23 @@
 	Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
 	TriaRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+
+}
+/*}}}*/
+void Tria::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = TriaEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->iscollapsed);
+	marshallhandle->call(this->isonsurface);
+	marshallhandle->call(this->isonbase);
+
+	/*Call parent classes: */
+	ElementHook::Marshall2(marshallhandle);
+	Element::MarshallElement2(marshallhandle,this->numanalyses);
+	TriaRef::Marshall2(marshallhandle);
 
 	vertices = (Vertex**)this->hvertices->deliverp();
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 25506)
@@ -40,4 +40,5 @@
 		Object *copy();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 25506)
@@ -29,4 +29,5 @@
 		void GetSegmentNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list_tria,Gauss* gauss, int index1,int index2,int finiteelement);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
+		void Marshall2(MarshallHandle* marshallhandle){ /*do nothing */};
 		void NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement);
 		int  NumberofNodes(int finiteelement);
Index: /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h	(revision 25506)
@@ -171,4 +171,8 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 		/*GenericExternalResult management: */
Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 25506)
@@ -250,14 +250,18 @@
 
 	/*Initialize: */
-	femmodel_size=0;
+	femmodel_size=this->Size();
+	_assert_(femmodel_size);
 
 	/*Create buffer to hold marshalled femmodel: */
-	this->Marshall(NULL,&femmodel_size,MARSHALLING_SIZE);
 	femmodel_buffer=xNew<char>(femmodel_size);
+
 	/*Keep track of initial position of femmodel_buffer: */
 	femmodel_buffer_ini=femmodel_buffer;
 
 	/*Marshall:*/
-	this->Marshall(&femmodel_buffer,NULL,MARSHALLING_WRITE);
+	//this->Marshall(&femmodel_buffer,NULL,MARSHALLING_WRITE);
+   WriteCheckpointFunctor* marshallhandle = new WriteCheckpointFunctor(&femmodel_buffer);
+   this->Marshall2(marshallhandle);
+	delete marshallhandle;
 
 	/*Reset position of buffer: */
@@ -273,5 +277,4 @@
 	xDelete<char>(femmodel_buffer);
 	xDelete<char>(restartfilename);
-
 }
 /*}}}*/
@@ -567,4 +570,85 @@
 }
 /*}}}*/
+void FemModel::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	/*Allocate new fields if necessary*/
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		delete this->materials;
+		delete this->parameters;
+		delete this->inputs;
+		if(this->constraints_list && this->nummodels){
+			for(int i=0;i<this->nummodels;i++) delete this->constraints_list[i];
+			xDelete<Constraints*>(constraints_list);
+		}
+		if(this->loads_list && this->nummodels){
+			for(int i=0;i<this->nummodels;i++) delete this->loads_list[i];
+			xDelete<Loads*>(loads_list);
+		}
+		if(this->nodes_list && this->nummodels){
+			for(int i=0;i<this->nummodels;i++) delete this->nodes_list[i];
+			xDelete<Nodes*>(nodes_list);
+		}
+		delete this->results;
+		delete this->vertices;
+		delete this->elements;
+		xDelete<int>(this->analysis_type_list);
+
+		this->materials   = new Materials();
+		this->parameters  = new Parameters();
+		this->inputs      = new Inputs();
+		this->results     = new Results();
+		this->vertices    = new Vertices();
+		this->elements    = new Elements();
+	}
+
+	int obj_enum = FemModelEnum;
+	marshallhandle->call(obj_enum);
+
+	marshallhandle->call(this->solution_type);
+	marshallhandle->call(this->analysis_counter);
+	marshallhandle->call(this->nummodels);
+	marshallhandle->call(this->analysis_type_list,nummodels);
+
+	this->materials->Marshall2(marshallhandle);
+	this->parameters->Marshall2(marshallhandle);
+	this->inputs->Marshall2(marshallhandle);
+	this->results->Marshall2(marshallhandle);
+	this->vertices->Marshall2(marshallhandle);
+	this->elements->Marshall2(marshallhandle);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->constraints_list = xNew<Constraints*>(this->nummodels);
+		for(int i=0;i<nummodels;i++) this->constraints_list[i] = new Constraints();
+		this->loads_list = xNew<Loads*>(this->nummodels);
+		for(int i=0;i<nummodels;i++) this->loads_list[i] = new Loads();
+		this->nodes_list = xNew<Nodes*>(this->nummodels);
+		for(int i=0;i<nummodels;i++) this->nodes_list[i] = new Nodes();
+	}
+
+	for(int i=0;i<nummodels;i++){
+		this->constraints_list[i]->Marshall2(marshallhandle);
+		this->loads_list[i]->Marshall2(marshallhandle);
+		this->nodes_list[i]->Marshall2(marshallhandle);
+	}
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		/*reset hooks for elements, loads and nodes:*/
+		this->elements->ResetHooks();
+		this->materials->ResetHooks();
+
+		/*do the post-processing of the datasets to get an FemModel that can actually run analyses:*/
+		for(int i=0;i<nummodels;i++){
+			this->loads_list[i]->ResetHooks();
+			int analysis_type=this->analysis_type_list[i];
+			SetCurrentConfiguration(analysis_type);
+			SpcNodesx(this->nodes_list[i],this->constraints_list[i],this->parameters);
+			NodesDofx(this->nodes_list[i],this->parameters);
+			ConfigureObjectsx(this->elements,this->loads_list[i],this->nodes_list[i],this->vertices,this->materials,this->parameters,this->inputs);
+		}
+
+		/*Reset current configuration*/
+		SetCurrentConfiguration(this->analysis_type_list[this->analysis_counter]);
+	}
+}
+/*}}}*/
 void FemModel::Restart(){ /*{{{*/
 
@@ -609,5 +693,8 @@
 
 	/*Create new FemModel by demarshalling the buffer: */
-	this->Marshall(&femmodel_buffer,NULL,MARSHALLING_LOAD);
+	//this->Marshall(&femmodel_buffer,NULL,MARSHALLING_LOAD);
+   LoadCheckpointFunctor* marshallhandle = new LoadCheckpointFunctor(&femmodel_buffer);
+   this->Marshall2(marshallhandle);
+	delete marshallhandle;
 
 	/*Reset position of buffer: */
@@ -677,8 +764,11 @@
 /*}}}*/
 int  FemModel::Size(){ /*{{{*/
-	int   femmodel_size;
-
-	this->Marshall(NULL,&femmodel_size,MARSHALLING_SIZE);
-
+
+	SizeCheckpointFunctor* marshallhandle = new SizeCheckpointFunctor();
+	this->Marshall2(marshallhandle);
+	int femmodel_size = marshallhandle->MarshalledSize();
+
+	/*Cleanup and return*/
+	delete marshallhandle;
 	return femmodel_size;
 }
Index: /issm/trunk-jpl/src/c/classes/FemModel.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/FemModel.h	(revision 25506)
@@ -82,4 +82,5 @@
 		void InitFromFids(char* rootpath, FILE* IOMODEL, FILE* toolkitsoptionsfid, int in_solution_type, bool trace, IssmPDouble* X=NULL);
 		void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		void Restart(void);
 		void RestartAD(int step);
Index: /issm/trunk-jpl/src/c/classes/Hook.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Hook.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Hook.cpp	(revision 25506)
@@ -137,4 +137,26 @@
 		MARSHALLING_DYNAMIC(offsets,int,num);
 		MARSHALLING_DYNAMIC(objects,Object*,num);
+	}
+
+}
+/*}}}*/
+void Hook::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD) reset();
+
+	int object_enum = HookEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->num);
+	if (num<=0){
+		/*Empty hook*/
+		this->ids     = NULL;
+		this->objects = NULL;
+		this->offsets = NULL;
+		this->num = 0;
+	}
+	else{
+		marshallhandle->call(this->ids,num);
+		marshallhandle->call(this->offsets,num);
+		marshallhandle->call(this->objects,num);
 	}
 
Index: /issm/trunk-jpl/src/c/classes/Hook.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Hook.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Hook.h	(revision 25506)
@@ -34,5 +34,6 @@
 		void       DeepEcho(void);
 		void       Echo(void);
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void       Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void       Marshall2(MarshallHandle* marshallhandle);
 		/*}}}*/
 		/*Hook management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/ArrayInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ArrayInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ArrayInput.cpp	(revision 25506)
@@ -95,4 +95,24 @@
 }
 /*}}}*/
+void ArrayInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = ArrayInputEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->numberofelements_local);
+	if(this->numberofelements_local){
+		marshallhandle->call(this->N,this->numberofelements_local);
+		for(int i=0;i<this->numberofelements_local;i++){
+			if(this->values[i]){
+				marshallhandle->call(this->values[i],this->N[i]);
+			}
+		}
+	}
+	else{
+		this->N      = NULL;
+		this->values = NULL;
+	}
+
+}
+/*}}}*/
 int  ArrayInput::ObjectEnum(void){/*{{{*/
 	return ArrayInputEnum;
Index: /issm/trunk-jpl/src/c/classes/Inputs/ArrayInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ArrayInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ArrayInput.h	(revision 25506)
@@ -24,4 +24,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 25506)
@@ -66,4 +66,17 @@
 }
 /*}}}*/
+void BoolInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = BoolInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->size);
+	if(this->size > 0){
+		marshallhandle->call(this->values,this->size);
+	}
+	else this->values = NULL;
+
+}
+/*}}}*/
 int  BoolInput::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 25506)
@@ -23,4 +23,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 25506)
@@ -121,4 +121,11 @@
 
 	MARSHALLING_ENUM(ControlInputEnum);
+	_error_("Not implemented");
+}
+/*}}}*/
+void ControlInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = ControlInputEnum;
+   marshallhandle->call(object_enum);
 	_error_("Not implemented");
 }
Index: /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int    Id(); 
 		void   Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void   Marshall2(MarshallHandle* marshallhandle);
 		int    ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 25506)
@@ -95,4 +95,19 @@
 }
 /*}}}*/
+void DatasetInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = DatasetInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->numids);
+	marshallhandle->call(this->numberofelements_local);
+	marshallhandle->call(this->numberofvertices_local);
+	marshallhandle->call(this->ids,numids);
+	//if (marshallhandle->OperationNumber() == MARSHALLING_LOAD) inputs = new Inputs();
+	//inputs->Marshall2(marshallhandle);
+	_error_("not implemented");
+
+}
+/*}}}*/
 int  DatasetInput::ObjectEnum(void){/*{{{*/
 	return DatasetInputEnum;
Index: /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 25506)
@@ -35,4 +35,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		void    SetTriaInput(int interp_in,int numinds,int* rows,IssmDouble* values_in);
Index: /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 25506)
@@ -66,4 +66,17 @@
 }
 /*}}}*/
+void DoubleInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = DoubleInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->size);
+	if(this->size > 0){
+		marshallhandle->call(this->values,this->size);
+	}
+	else this->values = NULL;
+
+}
+/*}}}*/
 int  DoubleInput::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 25506)
@@ -23,4 +23,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/ElementInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ElementInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ElementInput.h	(revision 25506)
@@ -30,4 +30,5 @@
 		virtual int     Id()=0;
 		virtual void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction)=0;
+		virtual void    Marshall2(MarshallHandle* marshallhandle)=0;
 		virtual int     ObjectEnum()=0;
 		/*Other*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/Inputs.cpp	(revision 25506)
@@ -144,4 +144,69 @@
 }
 /*}}}*/
+void Inputs::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+
+	int num_inputs=0;
+	int index;
+
+	int object_enum = ArrayInputEnum;
+   marshallhandle->call(object_enum);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
+
+		/*Marshall num_inputs first*/
+		for(int i=0;i<NUMINPUTS;i++){
+			if(this->inputs[i]) num_inputs++;
+		}
+		marshallhandle->call(num_inputs);
+
+		/*Marshall Parameters one by one now*/
+		for(int i=0;i<NUMINPUTS;i++){
+			if(this->inputs[i]){
+				object_enum = this->inputs[i]->ObjectEnum();
+				marshallhandle->call(i);
+				marshallhandle->call(object_enum);
+				this->inputs[i]->Marshall2(marshallhandle);
+			}
+		}
+	}
+	else{
+
+		/*Get number of inputs marshalled*/
+		marshallhandle->call(num_inputs);
+
+		/*Recover input2eters one by one*/
+		for(int i=0;i<num_inputs;i++){
+
+			/*Recover enum of object first: */
+			marshallhandle->call(index);
+			marshallhandle->call(object_enum);
+
+			if(object_enum==BoolInputEnum){
+				BoolInput* boolinput2=new BoolInput();
+				boolinput2->Marshall2(marshallhandle);
+				this->inputs[index]=boolinput2;
+			}
+			else if(object_enum==IntInputEnum){
+				IntInput* intinput2=new IntInput();
+				intinput2->Marshall2(marshallhandle);
+				this->inputs[index]=intinput2;
+			}
+			else if(object_enum==TriaInputEnum){
+				TriaInput* triainput2=new TriaInput();
+				triainput2->Marshall2(marshallhandle);
+				this->inputs[index]=triainput2;
+			}
+			else if(object_enum==PentaInputEnum){
+				PentaInput* pentainput2=new PentaInput();
+				pentainput2->Marshall2(marshallhandle);
+				this->inputs[index]=pentainput2;
+			}
+			else{
+				_error_("input "<<EnumToStringx(object_enum)<<" not supported");
+			}
+		}
+	}
+}
+/*}}}*/
 
 void Inputs::AddInput(Input* newinput){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/Inputs.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/Inputs.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/Inputs.h	(revision 25506)
@@ -64,4 +64,5 @@
 		ControlInput*   GetControlInput(int enum_type);
 		void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 		int   GetInputObjectEnum(int enum_type);
 		void  GetInputValue(bool* pvalue,int enum_in,int index);
Index: /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 25506)
@@ -66,4 +66,17 @@
 }
 /*}}}*/
+void IntInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = IntInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->size);
+	if(this->size > 0){
+		marshallhandle->call(this->values,this->size);
+	}
+	else this->values = NULL;
+
+}
+/*}}}*/
 int  IntInput::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 25506)
@@ -23,4 +23,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 25506)
@@ -146,4 +146,26 @@
 }
 /*}}}*/
+void PentaInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = PentaInputEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->numberofelements_local);
+	marshallhandle->call(this->numberofvertices_local);
+	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->N);
+	this->isserved = false;
+	this->isserved_collapsed = 0;
+	if(this->M*this->N){
+		marshallhandle->call(this->values,this->M*this->N);
+	}
+	else this->values = NULL;
+
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		this->element_values = xNewZeroInit<IssmDouble>(PentaRef::NumberofNodes(this->interpolation));
+	}
+}
+/*}}}*/
 int  PentaInput::ObjectEnum(void){/*{{{*/
 	return PentaInputEnum;
Index: /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 25506)
@@ -22,4 +22,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 25506)
@@ -128,4 +128,26 @@
 }
 /*}}}*/
+void SegInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = SegInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->numberofelements_local);
+	marshallhandle->call(this->numberofvertices_local);
+	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->N);
+	this->isserved = false;
+	if(this->M*this->N){
+		marshallhandle->call(this->values,this->M*this->N);
+	}
+	else this->values = NULL;
+
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		this->element_values = xNewZeroInit<IssmDouble>(SegRef::NumberofNodes(this->interpolation));
+	}
+
+}
+/*}}}*/
 int  SegInput::ObjectEnum(void){/*{{{*/
 	return SegInputEnum;
Index: /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 25506)
@@ -20,4 +20,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 25506)
@@ -130,4 +130,21 @@
 	MARSHALLING_DYNAMIC(this->timesteps,IssmDouble,numtimesteps);
 	//inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	_error_("not implemented");
+}
+/*}}}*/
+void TransientInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	if (marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		_error_("not implmented");
+		//inputs = new Inputs();
+	}
+
+	int object_enum = TransientInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->numtimesteps);
+	marshallhandle->call(this->timesteps,numtimesteps);
+	//inputs->Marshall2(marshallhandle);
 	_error_("not implemented");
 }
Index: /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 25506)
@@ -44,4 +44,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 25506)
@@ -133,4 +133,27 @@
 }
 /*}}}*/
+void TriaInput::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = TriaInputEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->numberofelements_local);
+	marshallhandle->call(this->numberofvertices_local);
+	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->N);
+	this->isserved = false;
+	this->isserved_collapsed = 0;
+	if(this->M*this->N){
+		marshallhandle->call(this->values,this->M*this->N);
+	}
+	else this->values = NULL;
+
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		this->element_values = xNewZeroInit<IssmDouble>(TriaRef::NumberofNodes(this->interpolation));
+	}
+
+}
+/*}}}*/
 int  TriaInput::ObjectEnum(void){/*{{{*/
 	return TriaInputEnum;
Index: /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 25506)
@@ -23,4 +23,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Channel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Channel.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Channel.cpp	(revision 25506)
@@ -170,4 +170,30 @@
 	element  =(Element*)this->helement->delivers();
 
+}
+/*}}}*/
+void    Channel::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->S);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnodes      = new Hook();
+		this->hvertices   = new Hook();
+		this->helement    = new Hook();
+	}
+
+	this->hnodes->Marshall2(marshallhandle);
+	this->helement->Marshall2(marshallhandle);
+	this->hvertices->Marshall2(marshallhandle);
+
+	/*corresponding fields*/
+	nodes    =(Node**)this->hnodes->deliverp();
+	vertices =(Vertex**)this->hvertices->deliverp();
+	element  =(Element*)this->helement->delivers();
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Channel.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Channel.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Channel.h	(revision 25506)
@@ -49,5 +49,6 @@
 		void    Echo();
 		int     Id();
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Loads.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Loads.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Loads.cpp	(revision 25506)
@@ -82,4 +82,14 @@
 
 	DataSet::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+}
+/*}}}*/
+void  Loads::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = LoadsEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->numrifts);
+	marshallhandle->call(this->numpenalties);
+
+	DataSet::Marshall2(marshallhandle);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Loads.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Loads.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Loads.h	(revision 25506)
@@ -28,4 +28,5 @@
 		Loads* Copy();
 		void   Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void   Marshall2(MarshallHandle* marshallhandle);
 
 		/*numerics*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Moulin.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Moulin.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Moulin.cpp	(revision 25506)
@@ -126,4 +126,29 @@
 	this->hvertex->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	node   =(Node*)this->hnode->delivers();
+	vertex =(Vertex*)this->hvertex->delivers();
+	element=(Element*)this->helement->delivers();
+}
+/*}}}*/
+void    Moulin::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum = MoulinEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnode    = new Hook();
+		this->hvertex  = new Hook();
+		this->helement = new Hook();
+	}
+
+	this->hnode->Marshall2(marshallhandle);
+	this->hvertex->Marshall2(marshallhandle);
+	this->helement->Marshall2(marshallhandle);
 
 	/*corresponding fields*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Moulin.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Moulin.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Moulin.h	(revision 25506)
@@ -49,5 +49,6 @@
 		void  Echo();
 		int   Id(); 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Neumannflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Neumannflux.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Neumannflux.cpp	(revision 25506)
@@ -142,4 +142,30 @@
 	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	nodes    =(Node**)this->hnodes->deliverp();
+	vertices =(Vertex**)this->hvertices->deliverp();
+	element  =(Element*)this->helement->delivers();
+
+}
+/*}}}*/
+void    Neumannflux::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum=NeumannfluxEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnodes      = new Hook();
+		this->hvertices   = new Hook();
+		this->helement    = new Hook();
+	}
+
+	this->hnodes->Marshall2(marshallhandle);
+	this->helement->Marshall2(marshallhandle);
+	this->hvertices->Marshall2(marshallhandle);
 
 	/*corresponding fields*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Neumannflux.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Neumannflux.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Neumannflux.h	(revision 25506)
@@ -42,5 +42,6 @@
 		void    Echo();
 		int     Id();
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 25506)
@@ -220,4 +220,32 @@
 	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	nodes    =(Node**)this->hnodes->deliverp();
+	vertices =(Vertex**)this->hvertices->deliverp();
+	element  =(Element*)this->helement->delivers();
+
+}
+/*}}}*/
+void    Numericalflux::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum = NumericalfluxEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->flux_type);
+	marshallhandle->call(this->flux_degree);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnodes      = new Hook();
+		this->hvertices   = new Hook();
+		this->helement    = new Hook();
+	}
+
+	this->hnodes->Marshall2(marshallhandle);
+	this->helement->Marshall2(marshallhandle);
+	this->hvertices->Marshall2(marshallhandle);
 
 	/*corresponding fields*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 25506)
@@ -44,5 +44,6 @@
 		void    Echo();
 		int     Id();
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 25506)
@@ -144,4 +144,28 @@
 }
 /*}}}*/
+void    Pengrid::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum = PengridEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnode    = new Hook();
+		this->helement = new Hook();
+	}
+
+	this->hnode->Marshall2(marshallhandle);
+	this->helement->Marshall2(marshallhandle);
+
+	/*corresponding fields*/
+	node   =(Node*)this->hnode->delivers();
+	element=(Element*)this->helement->delivers();
+
+	marshallhandle->call(this->active);
+	marshallhandle->call(this->zigzag_counter);
+}/*}}}*/
 int     Pengrid::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 25506)
@@ -51,5 +51,6 @@
 		void  Echo();
 		int   Id(); 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp	(revision 25506)
@@ -100,4 +100,22 @@
 	nodes = (Node**)this->hnodes->deliverp();
 
+}
+/*}}}*/
+void    Penpair::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum = PenpairEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnodes = new Hook();
+	}
+	this->hnodes->Marshall2(marshallhandle);
+
+	/*corresponding fields*/
+	nodes = (Node**)this->hnodes->deliverp();
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Penpair.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 25506)
@@ -30,9 +30,10 @@
 		/*}}}*/
 		/*Object virtual functions definitions:{{{ */
-		Object* copy();
+		Object*  copy();
 		void     DeepEcho();
 		void     Echo();
 		int      Id(); 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void     Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void     Marshall2(MarshallHandle* marshallhandle);
 		int      ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 25506)
@@ -229,4 +229,45 @@
 }
 /*}}}*/
+void    Riftfront::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	int object_enum = RiftfrontEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->type);
+	marshallhandle->call(this->fill);
+	marshallhandle->call(this->friction);
+	marshallhandle->call(this->fractionincrement);
+	marshallhandle->call(this->shelf);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->hnodes     = new Hook();
+		this->hvertices  = new Hook();
+		this->helements  = new Hook();
+	}
+
+	this->hnodes->Marshall2(marshallhandle);
+	this->hvertices->Marshall2(marshallhandle);
+	this->helements->Marshall2(marshallhandle);
+
+	/*corresponding fields*/
+	nodes     =(Node**)this->hnodes->deliverp();
+	vertices  =(Vertex**)this->hvertices->deliverp();
+	elements  =(Element**)this->helements->deliverp();
+
+	marshallhandle->call(this->penalty_lock);
+	marshallhandle->call(this->active);
+	marshallhandle->call(this->frozen);
+	marshallhandle->call(this->state);
+	marshallhandle->call(this->counter);
+	marshallhandle->call(this->prestable);
+	marshallhandle->call(this->material_converged);
+	marshallhandle->call(this->normal[0]);
+	marshallhandle->call(this->normal[1]);
+	marshallhandle->call(this->length);
+	marshallhandle->call(this->fraction);
+}/*}}}*/
 int     Riftfront::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 25506)
@@ -61,4 +61,5 @@
 		int      Id(); 
 		void		Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void		Marshall2(MarshallHandle* marshallhandle);
 		int      ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Masscon.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Masscon.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Masscon.h	(revision 25506)
@@ -77,4 +77,8 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		int ObjectEnum(void){/*{{{*/
 			return MassconEnum;
Index: /issm/trunk-jpl/src/c/classes/Massconaxpby.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Massconaxpby.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Massconaxpby.h	(revision 25506)
@@ -88,4 +88,8 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		int ObjectEnum(void){/*{{{*/
 			return MassconaxpbyEnum;
Index: /issm/trunk-jpl/src/c/classes/Massfluxatgate.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 25506)
@@ -127,4 +127,19 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+
+			int object_enum = MassfluxatgateEnum;
+			marshallhandle->call(object_enum);
+
+			marshallhandle->call(this->definitionenum);
+			marshallhandle->call(this->name);
+			marshallhandle->call(this->numsegments);
+			marshallhandle->call(this->x1,this->numsegments);
+			marshallhandle->call(this->x2,this->numsegments);
+			marshallhandle->call(this->y1,this->numsegments);
+			marshallhandle->call(this->y2,this->numsegments);
+			marshallhandle->call(this->elements,this->numsegments);
+		} 
+		/*}}}*/
 		/*Definition virtual function resolutoin: */
 		int DefinitionEnum(){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Materials/Matestar.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matestar.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matestar.cpp	(revision 25506)
@@ -108,4 +108,17 @@
 	MARSHALLING(mid);
 	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->element=(Element*)this->helement->delivers();
+
+}
+/*}}}*/
+void      Matestar::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD)helement=new Hook(); 
+
+	int object_enum = MatestarEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->mid);
+	this->helement->Marshall2(marshallhandle);
 	this->element=(Element*)this->helement->delivers();
 
Index: /issm/trunk-jpl/src/c/classes/Materials/Matestar.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matestar.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matestar.h	(revision 25506)
@@ -41,5 +41,6 @@
 		void  Echo();
 		int   Id(); 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 25506)
@@ -172,4 +172,17 @@
 }
 /*}}}*/
+void      Matice::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD)helement=new Hook(); 
+
+	int object_enum = MaticeEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->mid);
+	marshallhandle->call(this->isdamaged);
+	marshallhandle->call(this->isenhanced);
+	this->helement->Marshall2(marshallhandle);
+	this->element=(Element*)this->helement->delivers();
+}/*}}}*/
 int       Matice::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Materials/Matice.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matice.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matice.h	(revision 25506)
@@ -45,5 +45,6 @@
 		void  Echo();
 		int   Id(); 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Materials/Matlitho.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matlitho.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matlitho.cpp	(revision 25506)
@@ -175,4 +175,35 @@
 }
 /*}}}*/
+void Matlitho::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = MatlithoEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->numlayers);
+	if(numlayers) { 
+		marshallhandle->call(this->radius,numlayers+1);
+		marshallhandle->call(this->viscosity,numlayers);
+		marshallhandle->call(this->lame_lambda,numlayers);
+		marshallhandle->call(this->lame_mu,numlayers);
+		marshallhandle->call(this->burgers_viscosity,numlayers);
+		marshallhandle->call(this->burgers_mu,numlayers);
+		marshallhandle->call(this->density,numlayers);
+		marshallhandle->call(this->isburgers,numlayers);
+		marshallhandle->call(this->issolid,numlayers);
+	}
+	else{
+		radius            = NULL;
+		viscosity         = NULL;
+		lame_lambda       = NULL;
+		lame_mu           = NULL;
+		burgers_viscosity = NULL;
+		burgers_mu        = NULL;
+		density           = NULL;
+		isburgers         = NULL;
+		issolid           = NULL;
+	}
+
+}
+/*}}}*/
 int  Matlitho::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Materials/Matlitho.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matlitho.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matlitho.h	(revision 25506)
@@ -37,5 +37,6 @@
 		void    Echo();
 		int     Id();
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Misfit.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Misfit.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Misfit.cpp	(revision 25506)
@@ -93,4 +93,8 @@
 } 
 /*}}}*/
+void Misfit::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
 int Misfit::ObjectEnum(void){/*{{{*/
 	return MisfitEnum;
Index: /issm/trunk-jpl/src/c/classes/Misfit.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Misfit.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Misfit.h	(revision 25506)
@@ -39,4 +39,5 @@
 		int Id(void);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
 		
Index: /issm/trunk-jpl/src/c/classes/Nodalvalue.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodalvalue.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Nodalvalue.cpp	(revision 25506)
@@ -67,4 +67,8 @@
 } 
 /*}}}*/
+void Nodalvalue::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
 int Nodalvalue::ObjectEnum(void){/*{{{*/
 	return NodalvalueEnum;
Index: /issm/trunk-jpl/src/c/classes/Nodalvalue.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodalvalue.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Nodalvalue.h	(revision 25506)
@@ -23,22 +23,23 @@
 		char*       name;
 		int         node;
-		
+
 		/*Nodalvalue constructors, destructors :*/
-Nodalvalue();
-Nodalvalue(char* in_name, int in_definitionenum, int in_model_enum, int in_node);
-~Nodalvalue();
+		Nodalvalue();
+		Nodalvalue(char* in_name, int in_definitionenum, int in_model_enum, int in_node);
+		~Nodalvalue();
 
-/*Object virtual function resolutoin: */
-Object* copy();
-void DeepEcho(void);
-void Echo(void);
-int Id(void);
-void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
-int ObjectEnum(void);
+		/*Object virtual function resolutoin: */
+		Object* copy();
+		void DeepEcho(void);
+		void Echo(void);
+		int Id(void);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
+		int ObjectEnum(void);
 
-/*Definition virtual function resolutoin: */
-int DefinitionEnum();
-char* Name();
-IssmDouble Response(FemModel* femmodel);
+		/*Definition virtual function resolutoin: */
+		int DefinitionEnum();
+		char* Name();
+		IssmDouble Response(FemModel* femmodel);
 };
 
Index: /issm/trunk-jpl/src/c/classes/Node.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Node.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Node.cpp	(revision 25506)
@@ -68,5 +68,5 @@
 		this->svalues        = xNew<IssmDouble>(this->gsize);
 		this->gdoflist       = xNew<int>(this->gsize);
-		this->gdoflist_local = xNew<int>(this->gsize);
+		this->gdoflist_local = xNewZeroInit<int>(this->gsize);
 		this->fsize          = -1;
 		this->ssize          = -1;
@@ -277,4 +277,35 @@
 	MARSHALLING_DYNAMIC(fdoflist_local,int,fsize);
 	MARSHALLING_DYNAMIC(sdoflist_local,int,ssize);
+} /*}}}*/
+void Node::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = NodeEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->sid);
+	marshallhandle->call(this->lid);
+	marshallhandle->call(this->pid);
+	marshallhandle->call(this->indexingupdate);
+	marshallhandle->call(this->analysis_enum);
+
+	for(int k=0;k<3;k++) for(int l=0;l<3;l++) marshallhandle->call(this->coord_system[k][l]);
+
+	marshallhandle->call(this->gsize);
+	marshallhandle->call(this->fsize);
+	marshallhandle->call(this->ssize);
+	marshallhandle->call(this->clone);
+	marshallhandle->call(this->active);
+	marshallhandle->call(this->freeze);
+	marshallhandle->call(this->f_set,gsize);
+	marshallhandle->call(this->s_set,gsize);
+	marshallhandle->call(this->svalues,gsize);
+	marshallhandle->call(this->doftype,gsize);
+	marshallhandle->call(this->gdoflist,gsize);
+	marshallhandle->call(this->fdoflist,fsize);
+	marshallhandle->call(this->sdoflist,ssize);
+	marshallhandle->call(this->gdoflist_local,gsize);
+	marshallhandle->call(this->fdoflist_local,fsize);
+	marshallhandle->call(this->sdoflist_local,ssize);
 } /*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/Node.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Node.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Node.h	(revision 25506)
@@ -77,4 +77,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 
Index: /issm/trunk-jpl/src/c/classes/Nodes.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodes.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Nodes.cpp	(revision 25506)
@@ -134,4 +134,41 @@
 		if(this->common_recv[i]) MARSHALLING_DYNAMIC(this->common_recv_ids[i],int,this->common_recv[i]);
 		if(this->common_send[i]) MARSHALLING_DYNAMIC(this->common_send_ids[i],int,this->common_send[i]);
+	}
+}
+/*}}}*/
+void  Nodes::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = NodesEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(numberofnodes);
+	marshallhandle->call(numberofnodes_local);
+	marshallhandle->call(numberofmasters_local);
+
+	/*Check that restart is compatible!*/
+	int num_procs=IssmComm::GetSize();
+	int test = num_procs;
+	marshallhandle->call(test);
+	if(test!=num_procs) _error_("number of cores is not the same as before");
+
+	DataSet::Marshall2(marshallhandle);
+
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		this->common_recv_ids = xNew<int*>(num_procs);
+		this->common_send_ids = xNew<int*>(num_procs);
+		for(int i=0;i<num_procs;i++){
+			this->common_recv_ids[i] = NULL;
+			this->common_send_ids[i] = NULL;
+		}
+	}
+
+	/*Stop here if no nodes*/
+	if(this->Size()==0) return;
+
+	marshallhandle->call(this->common_recv,num_procs);
+	marshallhandle->call(this->common_send,num_procs);
+	for(int i=0;i<num_procs;i++){
+		if(this->common_recv[i]) marshallhandle->call(this->common_recv_ids[i],this->common_recv[i]);
+		if(this->common_send[i]) marshallhandle->call(this->common_send_ids[i],this->common_send[i]);
 	}
 }
Index: /issm/trunk-jpl/src/c/classes/Nodes.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodes.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Nodes.h	(revision 25506)
@@ -10,4 +10,5 @@
 class Nodes;
 class Materials;
+class MarshallHandle;
 
 /*!\brief Declaration of Nodes class.
@@ -36,4 +37,5 @@
 		Nodes* Copy();
 		void   Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void   Marshall2(MarshallHandle* marshallhandle);
 
 		/*numerics*/
Index: /issm/trunk-jpl/src/c/classes/Numberedcostfunction.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Numberedcostfunction.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Numberedcostfunction.cpp	(revision 25506)
@@ -90,4 +90,8 @@
 } 
 /*}}}*/
+void Numberedcostfunction::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
 int Numberedcostfunction::ObjectEnum(void){/*{{{*/
 	return NumberedcostfunctionEnum;
Index: /issm/trunk-jpl/src/c/classes/Numberedcostfunction.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Numberedcostfunction.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Numberedcostfunction.h	(revision 25506)
@@ -15,28 +15,29 @@
 class Numberedcostfunction: public Object, public Definition{
 
-public: 
+	public: 
 
-int   definitionenum;
-char* name;
-int   number_cost_functions;
-int*  cost_functions_list;
+		int   definitionenum;
+		char* name;
+		int   number_cost_functions;
+		int*  cost_functions_list;
 
-/*Numberedcostfunction constructors, destructors :*/
-Numberedcostfunction();
-Numberedcostfunction(char* in_name, int in_definitionenum,int number_cost_functions_in,int* cost_functions_list_in);
-~Numberedcostfunction();
+		/*Numberedcostfunction constructors, destructors :*/
+		Numberedcostfunction();
+		Numberedcostfunction(char* in_name, int in_definitionenum,int number_cost_functions_in,int* cost_functions_list_in);
+		~Numberedcostfunction();
 
-/*Object virtual function resolutoin: */
-Object*	copy();
-void		DeepEcho(void);
-void		Echo(void);
-int		Id(void);
-void		Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
-int		ObjectEnum(void);
+		/*Object virtual function resolutoin: */
+		Object*	copy();
+		void		DeepEcho(void);
+		void		Echo(void);
+		int		Id(void);
+		void		Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void		Marshall2(MarshallHandle* marshallhandle);
+		int		ObjectEnum(void);
 
-/*Definition virtual function resolutoin: */
-int		DefinitionEnum();
-char*		Name();
-IssmDouble Response(FemModel* femmodel);
+		/*Definition virtual function resolutoin: */
+		int		DefinitionEnum();
+		char*		Name();
+		IssmDouble Response(FemModel* femmodel);
 };
 
Index: /issm/trunk-jpl/src/c/classes/Options/Option.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Options/Option.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Options/Option.h	(revision 25506)
@@ -26,4 +26,5 @@
 		int           Id(){_error_("Not implemented yet"); };
 		void          Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void          Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int           ObjectEnum(){return OptionEnum;};
 
Index: /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 25506)
@@ -57,4 +57,12 @@
 }
 /*}}}*/
+void BoolParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = BoolParamEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->value);
+
+}/*}}}*/
 int BoolParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/BoolParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/BoolParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/BoolParam.h	(revision 25506)
@@ -36,4 +36,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/DataSetParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DataSetParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DataSetParam.cpp	(revision 25506)
@@ -62,4 +62,15 @@
 }
 /*}}}*/
+void DataSetParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD)value=new DataSet();
+
+	int object_enum=DataSetParamEnum;
+	marshallhandle->call(object_enum);
+	marshallhandle->call(this->enum_type);
+	value->Marshall2(marshallhandle);
+
+}
+/*}}}*/
 int DataSetParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DataSetParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp	(revision 25506)
@@ -138,4 +138,26 @@
 }
 /*}}}*/
+void DoubleMatArrayParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = DoubleMatArrayParamEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->M);
+	if(M){
+		marshallhandle->call(this->mdim_array,M);
+		marshallhandle->call(this->ndim_array,M);
+		if(marshallhandle->OperationNumber()==MARSHALLING_LOAD && M) array=xNew<IssmDouble*>(M);
+		for(int i=0;i<M;i++){
+			marshallhandle->call(this->array[i],mdim_array[i]*ndim_array[i]);
+		}
+	}
+	else{
+		array=NULL;
+		mdim_array=NULL;
+		ndim_array=NULL;
+	}
+}
+/*}}}*/
 int DoubleMatArrayParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.h	(revision 25506)
@@ -39,4 +39,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.cpp	(revision 25506)
@@ -83,4 +83,15 @@
 }
 /*}}}*/
+void DoubleMatParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = DoubleMatParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->N);
+	marshallhandle->call(this->value,M*N);
+}
+/*}}}*/
 
 /*DoubleMatParam virtual functions definitions: */
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatParam.h	(revision 25506)
@@ -39,4 +39,5 @@
 		Param* copy();
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleParam.cpp	(revision 25506)
@@ -55,4 +55,13 @@
 }
 /*}}}*/
+void DoubleParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = DoubleParamEnum;
+   marshallhandle->call(object_enum);
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->value);
+
+}
+/*}}}*/
 int  DoubleParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp	(revision 25506)
@@ -69,4 +69,15 @@
 }
 /*}}}*/
+void DoubleVecParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = DoubleVecParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->values,this->M);
+
+}
+/*}}}*/
 int DoubleVecParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 25506)
@@ -59,4 +59,18 @@
 }
 /*}}}*/
+void FileParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = FileParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->value);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		this->value=NULL; //meaningless file pointer!
+	}
+
+}
+/*}}}*/
 int  FileParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/FileParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/FileParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/FileParam.h	(revision 25506)
@@ -36,4 +36,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/GenericParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/GenericParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/GenericParam.h	(revision 25506)
@@ -56,4 +56,8 @@
 						 /*Nothing for now*/
 					 }
+					 void Marshall2(MarshallHandle* marshallhandle){
+						 _printf_("   WARNING: parameter "<<EnumToStringx(this->myEnumVal)<<" is a GenericParam and cannot be marshalled\n");
+						 /*Nothing for now*/
+					 }
                 int   ObjectEnum() {return GenericParamEnum;};
 
Index: /issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp	(revision 25506)
@@ -77,4 +77,15 @@
 }
 /*}}}*/
+void IntMatParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = IntMatParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->N);
+	marshallhandle->call(this->value,M*N);
+}
+/*}}}*/
 int  IntMatParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/IntMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntMatParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/IntMatParam.h	(revision 25506)
@@ -38,4 +38,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 25506)
@@ -58,4 +58,12 @@
 }
 /*}}}*/
+void IntParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = IntParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->value);
+}/*}}}*/
 int  IntParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/IntParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/IntParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp	(revision 25506)
@@ -83,4 +83,20 @@
 }
 /*}}}*/
+void IntVecParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = IntVecParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->M);
+	if(M){ 
+		marshallhandle->call(this->values,M);
+	}
+	else{
+		this->values=NULL;
+	}
+
+}
+/*}}}*/
 int  IntVecParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/IntVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntVecParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/IntVecParam.h	(revision 25506)
@@ -38,4 +38,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/MatrixParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/MatrixParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/MatrixParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/Param.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/Param.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/Param.h	(revision 25506)
@@ -45,5 +45,6 @@
 		virtual void  GetParameterValue(DataSet** pdataset)=0;
 		virtual int   InstanceEnum()=0;
-		virtual void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction)=0;
+		virtual void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction)=0;
+		virtual void  Marshall2(MarshallHandle* marshallhandle)=0;
 		virtual int   ObjectEnum()=0;
 
Index: /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 25506)
@@ -239,4 +239,132 @@
 }
 /*}}}*/
+void Parameters::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+
+	int num_params=0;
+	int obj_enum= ParametersEnum;
+	marshallhandle->call(obj_enum);
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
+
+		/*Marshall num_params first*/
+		for(int i=0;i<NUMPARAMS;i++){
+			if(this->params[i]) num_params++;
+		}
+		marshallhandle->call(num_params);
+
+		/*Marshall Parameters one by one now*/
+		for(int i=0;i<NUMPARAMS;i++){
+			if(this->params[i]){
+				obj_enum = this->params[i]->ObjectEnum();
+				marshallhandle->call(obj_enum);
+				this->params[i]->Marshall2(marshallhandle);
+			}
+		}
+
+	}
+	else{
+
+		/*Get number of params marshalled*/
+		marshallhandle->call(num_params);
+
+		/*Recover parameters one by one*/
+		for(int i=0;i<num_params;i++){
+
+			/*Recover enum of object first: */
+			marshallhandle->call(obj_enum);
+
+			if(obj_enum==DoubleParamEnum){
+				DoubleParam* doubleparam=NULL;
+				doubleparam=new DoubleParam();
+				doubleparam->Marshall2(marshallhandle);
+				this->AddObject(doubleparam);
+			}
+			else if(obj_enum==IntParamEnum){
+				IntParam* intparam=NULL;
+				intparam=new IntParam();
+				intparam->Marshall2(marshallhandle);
+				this->AddObject(intparam);
+			}
+			else if(obj_enum==IntMatParamEnum){
+				IntMatParam* intmparam=NULL;
+				intmparam=new IntMatParam();
+				intmparam->Marshall2(marshallhandle);
+				this->AddObject(intmparam);
+			}
+			else if(obj_enum==IntVecParamEnum){
+				IntVecParam* intvparam=NULL;
+				intvparam=new IntVecParam();
+				intvparam->Marshall2(marshallhandle);
+				this->AddObject(intvparam);
+			}
+			else if(obj_enum==BoolParamEnum){
+				BoolParam* boolparam=NULL;
+				boolparam=new BoolParam();
+				boolparam->Marshall2(marshallhandle);
+				this->AddObject(boolparam);
+			}
+			else if(obj_enum==DataSetParamEnum){
+				DataSetParam* dsparam=NULL;
+				dsparam=new DataSetParam();
+				dsparam->Marshall2(marshallhandle);
+				this->AddObject(dsparam);
+			}
+			else if(obj_enum==DoubleMatArrayParamEnum){
+				DoubleMatArrayParam* dmaparam=NULL;
+				dmaparam=new DoubleMatArrayParam();
+				dmaparam->Marshall2(marshallhandle);
+				this->AddObject(dmaparam);
+			}
+			else if(obj_enum==DoubleMatParamEnum){
+				DoubleMatParam* dmparam=NULL;
+				dmparam=new DoubleMatParam();
+				dmparam->Marshall2(marshallhandle);
+				this->AddObject(dmparam);
+			}
+			else if(obj_enum==DoubleVecParamEnum){
+				DoubleVecParam* dvparam=NULL;
+				dvparam=new DoubleVecParam();
+				dvparam->Marshall2(marshallhandle);
+				this->AddObject(dvparam);
+			}
+			else if(obj_enum==FileParamEnum){
+				FileParam* fileparam=NULL;
+				fileparam=new FileParam();
+				fileparam->Marshall2(marshallhandle);
+				delete fileparam;
+				/* FIXME: No need to add this object, the pointer is not valid
+					The FemModel should reset all FileParams in the restart function */
+			}
+			else if(obj_enum==StringParamEnum){
+				StringParam* sparam=NULL;
+				sparam=new StringParam();
+				sparam->Marshall2(marshallhandle);
+				this->AddObject(sparam);
+			}
+			else if(obj_enum==StringArrayParamEnum){
+				StringArrayParam* saparam=NULL;
+				saparam=new StringArrayParam();
+				saparam->Marshall2(marshallhandle);
+				this->AddObject(saparam);
+			}
+			else if(obj_enum==TransientParamEnum){
+				TransientParam* transparam=NULL;
+				transparam=new TransientParam();
+				transparam->Marshall2(marshallhandle);
+				this->AddObject(transparam);
+			}
+			else if(obj_enum==TransientArrayParamEnum){
+				TransientArrayParam* transarrayparam=NULL;
+				transarrayparam=new TransientArrayParam();
+				transarrayparam->Marshall2(marshallhandle);
+				this->AddObject(transarrayparam);
+			}
+			else if(obj_enum==GenericParamEnum){
+				/*Skip for now (we don't want to Marhsall Comms)*/
+			}
+		}
+	}
+}
+/*}}}*/
 
 /*Object management*/
Index: /issm/trunk-jpl/src/c/classes/Params/Parameters.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/Parameters.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/Parameters.h	(revision 25506)
@@ -36,4 +36,5 @@
 		bool  Exist(int enum_type);
 		void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 
 		void  FindParam(bool* pinteger,int enum_type);
Index: /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp	(revision 25506)
@@ -99,4 +99,37 @@
 }
 /*}}}*/
+void StringArrayParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int* sizes=NULL;
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
+		if(this->numstrings)sizes=xNew<int>(this->numstrings);
+		for(int i=0;i<numstrings;i++)sizes[i]=strlen(this->value[i])+1;
+	}	
+
+	int object_enum = StringArrayParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->numstrings);
+
+	if(this->numstrings){
+		marshallhandle->call(sizes,this->numstrings);
+		if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+			this->value=xNew<char*>(this->numstrings);
+		}
+		for(int i=0;i<numstrings;i++){
+			marshallhandle->call(this->value[i],sizes[i]);
+		}
+	}
+	else{
+		value=NULL;
+	}
+
+	//cleanup sizes array
+	if(sizes) xDelete<int>(sizes);
+
+}
+/*}}}*/
 int StringArrayParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 25506)
@@ -63,4 +63,19 @@
 }
 /*}}}*/
+void StringParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int size = 0;
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber() == MARSHALLING_SIZE){
+		size=strlen(value)+1;
+	}
+
+	int object_enum = StringParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(size);
+	marshallhandle->call(this->value,size);
+}
+/*}}}*/
 int StringParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/StringParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/StringParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.cpp	(revision 25506)
@@ -89,4 +89,21 @@
 
 }/*}}}*/
+void TransientArrayParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = TransientArrayParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->M);
+	marshallhandle->call(this->N);
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		values    = xNew<IssmDouble>(M*N);
+		timesteps = xNew<IssmDouble>(N);
+	}
+	marshallhandle->call(this->values,M*N);
+	marshallhandle->call(this->timesteps,N);
+
+}/*}}}*/
 int  TransientArrayParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientArrayParam.h	(revision 25506)
@@ -40,4 +40,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp	(revision 25506)
@@ -84,4 +84,21 @@
 }
 /*}}}*/
+void TransientParam::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = TransientParamEnum;
+   marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->interpolation);
+	marshallhandle->call(this->N);
+	if(marshallhandle->OperationNumber()==MARSHALLING_LOAD){
+		values=xNew<IssmDouble>(N);
+		timesteps=xNew<IssmDouble>(N);
+	}
+	marshallhandle->call(this->values,N);
+	marshallhandle->call(this->timesteps,N);
+
+}
+/*}}}*/
 int  TransientParam::ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Params/TransientParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientParam.h	(revision 25506)
@@ -39,4 +39,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/VectorParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/VectorParam.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/VectorParam.cpp	(revision 25506)
@@ -58,5 +58,5 @@
 }
 /*}}}*/
-int    VectorParam::Id(void){ return -1; }/*{{{*/
+int  VectorParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
 int VectorParam::ObjectEnum(void){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/VectorParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/VectorParam.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Params/VectorParam.h	(revision 25506)
@@ -37,4 +37,5 @@
 		int   Id(); 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int   ObjectEnum();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Profiler.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Profiler.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Profiler.cpp	(revision 25506)
@@ -80,4 +80,21 @@
 
 } /*}}}*/
+void Profiler::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	IssmPDouble* pointer = NULL;
+	bool*       bpointer = NULL;
+
+	int object_enum = ProfilerEnum;
+	marshallhandle->call(object_enum);
+	pointer = &this->time[0];
+	marshallhandle->call(pointer,MAXPROFSIZE);
+	pointer = &this->flops[0];
+	marshallhandle->call(pointer,MAXPROFSIZE);
+	pointer = &this->memory[0];
+	marshallhandle->call(pointer,MAXPROFSIZE);
+	bpointer = &this->running[0];
+	marshallhandle->call(bpointer,MAXPROFSIZE);
+
+} /*}}}*/
 int  Profiler::ObjectEnum(void){/*{{{*/
 	return ProfilerEnum;
Index: /issm/trunk-jpl/src/c/classes/Profiler.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Profiler.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Profiler.h	(revision 25506)
@@ -53,4 +53,5 @@
 		int     Id();
 		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void    Marshall2(MarshallHandle* marshallhandle);
 		int     ObjectEnum();
 
Index: /issm/trunk-jpl/src/c/classes/Radar.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Radar.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Radar.cpp	(revision 25506)
@@ -59,4 +59,8 @@
 /*}}}*/
 void Radar::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
+void Radar::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
 	_error_("not implemented yet!"); 
 } 
Index: /issm/trunk-jpl/src/c/classes/Radar.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Radar.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Radar.h	(revision 25506)
@@ -28,6 +28,7 @@
 		void DeepEcho(void);
 		void Echo(void);
-		int Id(void);
+		int  Id(void);
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 		int ObjectEnum(void);
 		
Index: /issm/trunk-jpl/src/c/classes/Regionaloutput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Regionaloutput.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Regionaloutput.cpp	(revision 25506)
@@ -64,4 +64,8 @@
 /*}}}*/
 void Regionaloutput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){/*{{{*/
+	_error_("not implemented yet!"); 
+} 
+/*}}}*/
+void Regionaloutput::Marshall2(MarshallHandle* marshallhandle){/*{{{*/
 	_error_("not implemented yet!"); 
 } 
Index: /issm/trunk-jpl/src/c/classes/Regionaloutput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Regionaloutput.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Regionaloutput.h	(revision 25506)
@@ -22,22 +22,23 @@
 	IssmDouble* mask;
 	int         M;
-	
-/*Regionalicevolume: constructors, destructors :*/
-Regionaloutput();
-Regionaloutput(char* in_name, int in_definitionenum, char* in_outputname, IssmDouble* maskin, int Min);
-~Regionaloutput();
 
-/*Object virtual function resolutoin: */
-Object* copy();
-void DeepEcho(void);
-void Echo(void);
-int Id(void);
-void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
-int ObjectEnum(void);
+	/*Regionalicevolume: constructors, destructors :*/
+	Regionaloutput();
+	Regionaloutput(char* in_name, int in_definitionenum, char* in_outputname, IssmDouble* maskin, int Min);
+	~Regionaloutput();
 
-/*Definition virtual function resolutoin: */
-int DefinitionEnum();
-char* Name();
-IssmDouble Response(FemModel* femmodel);
+	/*Object virtual function resolutoin: */
+	Object* copy();
+	void DeepEcho(void);
+	void Echo(void);
+	int Id(void);
+	void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+	void Marshall2(MarshallHandle* marshallhandle);
+	int ObjectEnum(void);
+
+	/*Definition virtual function resolutoin: */
+	int DefinitionEnum();
+	char* Name();
+	IssmDouble Response(FemModel* femmodel);
 };
 #endif  /* _REGIONALOUTPUT_H_ */
Index: /issm/trunk-jpl/src/c/classes/Segment.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Segment.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Segment.h	(revision 25506)
@@ -69,4 +69,8 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 		int ObjectEnum(void){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Vertex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertex.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Vertex.cpp	(revision 25506)
@@ -128,4 +128,23 @@
 	MARSHALLING(sigma);
 	MARSHALLING(connectivity);
+
+}
+/*}}}*/
+void Vertex::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = VertexEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->clone);
+	marshallhandle->call(this->domaintype);
+	marshallhandle->call(this->id);
+	marshallhandle->call(this->sid);
+	marshallhandle->call(this->pid);
+	marshallhandle->call(this->lid);
+	marshallhandle->call(this->x);
+	marshallhandle->call(this->y);
+	marshallhandle->call(this->z);
+	marshallhandle->call(this->sigma);
+	marshallhandle->call(this->connectivity);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Vertex.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertex.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Vertex.h	(revision 25506)
@@ -47,4 +47,5 @@
 		Object* copy();
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void Marshall2(MarshallHandle* marshallhandle);
 
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Vertices.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertices.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Vertices.cpp	(revision 25506)
@@ -133,4 +133,32 @@
 }
 /*}}}*/
+void Vertices::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	int object_enum = VerticesEnum;
+	marshallhandle->call(object_enum);
+
+	/*Check compatibility*/
+	int num_procs=IssmComm::GetSize();
+	int test = num_procs;
+	marshallhandle->call(test);
+	if(test!=num_procs) _error_("number of cores is not the same as before");
+
+	marshallhandle->call(this->numberofvertices);
+	marshallhandle->call(this->numberofvertices_local);
+	marshallhandle->call(this->numberofmasters_local);
+
+	marshallhandle->call(this->common_recv,num_procs);
+	marshallhandle->call(this->common_send,num_procs);
+	if(marshallhandle->OperationNumber() == MARSHALLING_LOAD){
+		this->common_recv_ids = xNew<int*>(num_procs);
+		this->common_send_ids = xNew<int*>(num_procs);
+	}
+	for(int i=0;i<num_procs;i++){
+		marshallhandle->call(this->common_recv_ids[i],this->common_recv[i]);
+		marshallhandle->call(this->common_send_ids[i],this->common_send[i]);
+	}
+	DataSet::Marshall2(marshallhandle);
+}
+/*}}}*/
 void Vertices::LatLonList(IssmDouble** plat,IssmDouble** plon){/*{{{*/
 
Index: /issm/trunk-jpl/src/c/classes/Vertices.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Vertices.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/Vertices.h	(revision 25506)
@@ -32,4 +32,5 @@
 		Vertices* Copy();
 		void      Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction);
+		void      Marshall2(MarshallHandle* marshallhandle);
 
 		/*numerics:*/
Index: /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.h	(revision 25506)
@@ -27,4 +27,5 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
Index: /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.h	(revision 25506)
@@ -28,4 +28,5 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
Index: /issm/trunk-jpl/src/c/classes/kriging/Observation.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/Observation.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/kriging/Observation.h	(revision 25506)
@@ -31,5 +31,6 @@
 		int     Id()        {_error_("Not implemented yet"); };
 		void    print() const;
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
+		void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
+		void    Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!");};
 		int     ObjectEnum(){_error_("Not implemented yet"); };
 
Index: /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.h	(revision 25506)
@@ -27,4 +27,5 @@
 		int   Id(){_error_("Not implemented yet");}; 
 		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
Index: /issm/trunk-jpl/src/c/classes/kriging/Quadtree.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/Quadtree.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/kriging/Quadtree.h	(revision 25506)
@@ -30,5 +30,6 @@
 				void    Echo();
 				int     Id()        {_error_("not implemented yet"); };
-				void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
+				void    Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!");};
+				void    Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!");};
 				int     ObjectEnum(){_error_("not implemented yet"); };
 
Index: /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.h	(revision 25506)
@@ -26,5 +26,6 @@
 		void  Echo();
 		int   Id(){_error_("Not implemented yet");}; 
-		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void  Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+		void  Marshall2(MarshallHandle* marshallhandle){ _error_("not implemented yet!"); };
 		int   ObjectEnum(){_error_("Not implemented yet");};
 
Index: /issm/trunk-jpl/src/c/datastructures/DataSet.cpp
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/DataSet.cpp	(revision 25505)
+++ /issm/trunk-jpl/src/c/datastructures/DataSet.cpp	(revision 25506)
@@ -242,5 +242,164 @@
 				GenericExternalResult<double>* result=new GenericExternalResult<double>();
 				result->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-				result->Echo();
+				this->AddObject(result);
+			}
+			else _error_("could not recognize enum type: " << obj_enum << ": " << EnumToStringx(obj_enum) ); 
+		}
+	}
+}
+/*}}}*/
+void  DataSet::Marshall2(MarshallHandle* marshallhandle){ /*{{{*/
+
+	vector<Object*>::iterator obj;
+	int obj_size=0;
+	int obj_enum=0;
+	int i;
+
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
+		obj_size=objects.size();
+	}
+	else{
+		clear();
+	}
+
+	int object_enum = DataSetEnum;
+	marshallhandle->call(object_enum);
+
+	marshallhandle->call(this->enum_type);
+	marshallhandle->call(this->sorted);
+	marshallhandle->call(this->presorted);
+	marshallhandle->call(this->numsorted);
+
+	/*Now branch according to direction of marshalling: */
+	if(marshallhandle->OperationNumber()==MARSHALLING_WRITE || marshallhandle->OperationNumber()==MARSHALLING_SIZE){
+		if(!(this->sorted && numsorted>0 && this->id_offsets)){
+			this->sorted_ids=NULL;
+			this->id_offsets=NULL;
+		}
+		marshallhandle->call(this->sorted_ids,numsorted);
+		marshallhandle->call(this->id_offsets,numsorted);
+		marshallhandle->call(obj_size);
+
+		/*Go through our objects, and marshall them into the buffer: */
+		for( obj=this->objects.begin() ; obj < this->objects.end(); obj++ ){
+			obj_enum=(*obj)->ObjectEnum();
+			marshallhandle->call(obj_enum);
+			(*obj)->Marshall2(marshallhandle);
+		}
+	}
+	else{
+
+		marshallhandle->call(this->sorted_ids,numsorted);
+		marshallhandle->call(this->id_offsets,numsorted);
+		if (!(this->sorted && numsorted>0)){
+			sorted_ids=NULL;
+			id_offsets=NULL;
+		}
+		marshallhandle->call(obj_size);
+
+		/*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<obj_size;i++){
+
+			/*Recover enum of object first: */
+			marshallhandle->call(obj_enum); 
+
+			/*Giant case statement to spin-up the right object, and demarshall into it the information 
+			 *stored in the buffer: */
+			if(obj_enum==NodeEnum){
+				Node* node=NULL;
+				node=new Node();
+				node->Marshall2(marshallhandle);
+				this->AddObject(node);
+			}
+			else if(obj_enum==VertexEnum){
+				Vertex* vertex=NULL;
+				vertex=new Vertex();
+				vertex->Marshall2(marshallhandle);
+				this->AddObject(vertex);
+			}
+			else if(obj_enum==MaticeEnum){
+				Matice* matice=NULL;
+				matice=new Matice();
+				matice->Marshall2(marshallhandle);
+				this->AddObject(matice);
+			}
+			else if(obj_enum==MatestarEnum){
+				Matestar* matestar=NULL;
+				matestar=new Matestar();
+				matestar->Marshall2(marshallhandle);
+				this->AddObject(matestar);
+			}
+			else if(obj_enum==SpcStaticEnum){
+				SpcStatic* spcstatic=NULL;
+				spcstatic=new SpcStatic();
+				spcstatic->Marshall2(marshallhandle);
+				this->AddObject(spcstatic);
+			}
+			else if(obj_enum==SpcDynamicEnum){
+				SpcDynamic* spcdynamic=NULL;
+				spcdynamic=new SpcDynamic();
+				spcdynamic->Marshall2(marshallhandle);
+				this->AddObject(spcdynamic);
+			}
+			else if(obj_enum==SpcTransientEnum){
+				SpcTransient* spctransient=NULL;
+				spctransient=new SpcTransient();
+				spctransient->Marshall2(marshallhandle);
+				this->AddObject(spctransient);
+			}
+			else if(obj_enum==TriaEnum){
+				Tria* tria=NULL;
+				tria=new Tria();
+				tria->Marshall2(marshallhandle);
+				this->AddObject(tria);
+			}
+			else if(obj_enum==PentaEnum){
+				Penta* penta=NULL;
+				penta=new Penta();
+				penta->Marshall2(marshallhandle);
+				this->AddObject(penta);
+			}
+			else if(obj_enum==TetraEnum){
+				Tetra* tetra=NULL;
+				tetra=new Tetra();
+				tetra->Marshall2(marshallhandle);
+				this->AddObject(tetra);
+			}
+			else if(obj_enum==SegEnum){
+				Seg* seg=NULL;
+				seg=new Seg();
+				seg->Marshall2(marshallhandle);
+				this->AddObject(seg);
+			}
+			else if(obj_enum==RiftfrontEnum){
+				Riftfront* rift=NULL;
+				rift=new Riftfront();
+				rift->Marshall2(marshallhandle);
+				this->AddObject(rift);
+			}
+			else if(obj_enum==NumericalfluxEnum){
+				Numericalflux* numflux=NULL;
+				numflux=new Numericalflux();
+				numflux->Marshall2(marshallhandle);
+				this->AddObject(numflux);
+			}
+			else if(obj_enum==PengridEnum){
+				Pengrid* pengrid=NULL;
+				pengrid=new Pengrid();
+				pengrid->Marshall2(marshallhandle);
+				this->AddObject(pengrid);
+			}
+			else if(obj_enum==PenpairEnum){
+				Penpair* penpair=NULL;
+				penpair=new Penpair();
+				penpair->Marshall2(marshallhandle);
+				this->AddObject(penpair);
+			}
+			else if(obj_enum==DoubleExternalResultEnum){
+				GenericExternalResult<double>* result=new GenericExternalResult<double>();
+				result->Marshall2(marshallhandle);
 				this->AddObject(result);
 			}
@@ -334,4 +493,6 @@
 Object* DataSet::GetObjectByOffset(int offset){/*{{{*/
 
+	if(this->Size()<=offset) this->Echo();
+
 	/*Check index in debugging mode*/
 	_assert_(this!=NULL);
Index: /issm/trunk-jpl/src/c/datastructures/DataSet.h
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/DataSet.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/datastructures/DataSet.h	(revision 25506)
@@ -7,4 +7,5 @@
 /*forward declarations */
 class Object;
+class MarshallHandle;
 
 /*! \brief Declaration of DataSet class
@@ -34,4 +35,5 @@
 		~DataSet();
 		void  Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction);
+		void  Marshall2(MarshallHandle* marshallhandle);
 
 		/*management*/
Index: /issm/trunk-jpl/src/c/datastructures/Object.h
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/Object.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/datastructures/Object.h	(revision 25506)
@@ -22,4 +22,5 @@
 		virtual Object* copy()=0;
 		virtual void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction)=0;
+		virtual void Marshall2(MarshallHandle* marshallhandle)=0;
 
 };
Index: /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h	(revision 25506)
@@ -6,9 +6,116 @@
 #define _MARSHALLING_H_
 
-enum marshall_directions{
+#include <string.h>
+#include "../../Exceptions/exceptions.h"
+#include "../../MemOps/MemOps.h"
+#include "../../Numerics/recast.h"
+
+/*Define Marshall operation Enums first*/
+enum MarshallOpEnum{
 	MARSHALLING_WRITE,
 	MARSHALLING_LOAD,
-	MARSHALLING_SIZE
+	MARSHALLING_SIZE,
 };
+
+/*Define virtual Marshall Handle*/
+class MarshallHandle{
+	public:
+		MarshallOpEnum operation_enum;
+		MarshallHandle(MarshallOpEnum op_in) : operation_enum(op_in){}
+		~MarshallHandle(){}
+		virtual void Echo(void)=0;
+		int OperationNumber(){return operation_enum;}
+		template<typename T> void call(T  & value);
+		template<typename T> void call(T* & value,int size);
+};
+
+/*Make sure to pass all fields by reference!*/
+class WriteCheckpointFunctor: public MarshallHandle{
+	public:
+		char** pmarshalled_data;
+		WriteCheckpointFunctor(char** pmarshalled_data_in) : MarshallHandle(MARSHALLING_WRITE),pmarshalled_data(pmarshalled_data_in){}
+		template<typename T> void call(T & value){
+			memcpy(*pmarshalled_data,&value,sizeof(T));
+			*pmarshalled_data+=sizeof(T);
+		}
+		void Echo(void){
+			printf("WriteCheckpointFunctor Echo:\n");
+			printf("   pmarshalled_data: %p\n",pmarshalled_data);
+		}
+		template<typename T> void call(T* & value,int size){
+			bool pointer_null = true;
+			if(value) pointer_null = false;
+			call(pointer_null);
+			if(value){
+				memcpy(*pmarshalled_data,value,size*sizeof(T));
+				*pmarshalled_data+=size*sizeof(T);
+			}
+		}
+};
+
+class LoadCheckpointFunctor: public MarshallHandle{
+	public:
+		char** pmarshalled_data;
+		LoadCheckpointFunctor(char** pmarshalled_data_in) : MarshallHandle(MARSHALLING_LOAD),pmarshalled_data(pmarshalled_data_in){}
+		void Echo(void){
+			printf("LoadCheckpointFunctor Echo:\n");
+			printf("   pmarshalled_data: %p\n",pmarshalled_data);
+		}
+		template<typename T> void call(T & value){
+			memcpy(&value,*pmarshalled_data,sizeof(T));
+			*pmarshalled_data+=sizeof(T);
+		}
+		template<typename T> void call(T* & value,int size){
+			bool pointer_null;
+			call(pointer_null);
+			if(!pointer_null){
+				value=xNew<T>(size);
+				memcpy(value,*pmarshalled_data,size*sizeof(T));
+				*pmarshalled_data+=size*sizeof(T);
+			}
+			else{
+				value = NULL;
+			}
+		}
+};
+
+class SizeCheckpointFunctor: public MarshallHandle{
+	public:
+		int marshalled_data_size;
+		SizeCheckpointFunctor(void) : MarshallHandle(MARSHALLING_SIZE),marshalled_data_size(0){}
+		int MarshalledSize(void){return this->marshalled_data_size;};
+		void Echo(void){
+			printf("SizeCheckpointFunctor Echo:\n");
+			printf("   marshalled_data_size: %i\n",marshalled_data_size);
+		}
+		template<typename T> void call(T & value){
+			marshalled_data_size+=sizeof(T);
+		}
+		template<typename T> void call(T* & value,int size){
+			bool pointer_null = true;
+			if(value) pointer_null = false;
+			this->call(pointer_null);
+			if(!pointer_null){
+				marshalled_data_size+=size*sizeof(T);
+			}
+		}
+};
+
+template<typename T> void MarshallHandle::call(T & value){
+	switch(OperationNumber()){
+		case MARSHALLING_WRITE:{WriteCheckpointFunctor* temp = xDynamicCast<WriteCheckpointFunctor*>(this); temp->call(value); break;}
+		case MARSHALLING_LOAD: {LoadCheckpointFunctor*  temp = xDynamicCast<LoadCheckpointFunctor*>(this);  temp->call(value); break;}
+		case MARSHALLING_SIZE: {SizeCheckpointFunctor*  temp = xDynamicCast<SizeCheckpointFunctor*>(this);  temp->call(value); break;}
+		default: _error_("not supported yet");
+	}
+}
+template<typename T> void MarshallHandle::call(T* & value,int size){
+	switch(OperationNumber()){
+		case MARSHALLING_WRITE:{WriteCheckpointFunctor* temp = xDynamicCast<WriteCheckpointFunctor*>(this); temp->call(value,size); break;}
+		case MARSHALLING_LOAD: {LoadCheckpointFunctor*  temp = xDynamicCast<LoadCheckpointFunctor*>(this);  temp->call(value,size); break;}
+		case MARSHALLING_SIZE: {SizeCheckpointFunctor*  temp = xDynamicCast<SizeCheckpointFunctor*>(this);  temp->call(value,size); break;}
+		default: _error_("not supported yet");
+	}
+}
 
 #define MARSHALLING_ENUM(EN)\
Index: /issm/trunk-jpl/src/c/toolkits/issm/Bucket.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/Bucket.h	(revision 25505)
+++ /issm/trunk-jpl/src/c/toolkits/issm/Bucket.h	(revision 25506)
@@ -133,4 +133,8 @@
 		} 
 		/*}}}*/
+		void Marshall2(MarshallHandle* marshallhandle){/*{{{*/
+			_error_("not implemented yet!"); 
+		} 
+		/*}}}*/
 
 		/*specific routines of Bucket: */
