Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.cpp	(revision 19254)
@@ -77,4 +77,18 @@
 }
 /*}}}*/
+void    SpcDynamic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(SpcDynamicEnum);
+
+	MARSHALLING(sid);
+	MARSHALLING(nodeid);
+	MARSHALLING(dof);
+	MARSHALLING(value);
+	MARSHALLING(analysis_type);
+	MARSHALLING(isset);
+	MARSHALLING(penalty);
+
+}
+/*}}}*/
 
 /*Constraint virtual functions definitions: */
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcDynamic.h	(revision 19254)
@@ -35,5 +35,5 @@
 		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);
 
 		/*Constraint virtual functions definitions*/
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcStatic.cpp	(revision 19254)
@@ -79,5 +79,5 @@
 }
 /*}}}*/
-void     SpcStatic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+void    SpcStatic::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
 	MARSHALLING_ENUM(SpcStaticEnum);
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.cpp	(revision 19254)
@@ -85,4 +85,25 @@
 }
 /*}}}*/
+void    SpcTransient::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(SpcStaticEnum);
+
+	MARSHALLING(sid);
+	MARSHALLING(nodeid);
+	MARSHALLING(dof);
+	MARSHALLING(analysis_type);
+	MARSHALLING(penalty);
+	MARSHALLING(nsteps);
+	if(nsteps){
+		MARSHALLING_DYNAMIC(values,IssmDouble,nsteps);
+		MARSHALLING_DYNAMIC(times,IssmDouble,nsteps);
+	}
+	else{
+		values=NULL;
+		times=NULL;
+	}
+
+}
+/*}}}*/
 
 /*Constraint virtual functions definitions:*/
Index: /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Constraints/SpcTransient.h	(revision 19254)
@@ -36,5 +36,5 @@
 		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);
 		/*}}}*/
 		/*Constraint virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 19254)
@@ -1528,5 +1528,8 @@
 	
 	_assert_(this);
-	if(marshall_direction==MARSHALLING_BACKWARD) inputs=new Inputs();
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		inputs=new Inputs();
+		nodes = NULL;
+	}
 
 	MARSHALLING_ENUM(ElementEnum);
@@ -1536,4 +1539,5 @@
 	MARSHALLING(element_type);
 	MARSHALLING_DYNAMIC(element_type_list,int,numanalyses);
+	inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 19254)
@@ -126,10 +126,10 @@
 	}
 	this->hvertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmaterial->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	if(this->hneighbors)this->hneighbors->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 
 	/*Free ressources: */
-	xDelete<bool>(hnodesi_null);
+	if(hnodesi_null) xDelete<bool>(hnodesi_null);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 19254)
@@ -120,4 +120,20 @@
 
 	return penta;
+
+}
+/*}}}*/
+void Penta::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(PentaEnum);
+
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
+	PentaRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+	verticalneighbors = (Penta**)this->hneighbors->deliverp();
 
 }
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 19254)
@@ -42,5 +42,5 @@
 		Object *copy();
 		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);
 		/*}}}*/
 		/*Penta routines:{{{*/
Index: /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 19254)
@@ -33,4 +33,5 @@
 		int  TensorInterpolation(int fe_stokes);
 		int  VelocityInterpolation(int fe_stokes);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
 };
 #endif
Index: /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 19254)
@@ -47,5 +47,77 @@
 /*}}}*/
 Object* Seg::copy(){/*{{{*/
-	_error_("not implemented yet");
+
+	int i;
+	Seg* seg=NULL;
+
+	seg=new Seg();
+
+	//deal with TriaRef mother class
+	int nanalyses = this->numanalyses;
+	if(nanalyses > 0){
+		seg->element_type_list=xNew<int>(nanalyses);
+		for(i=0;i<nanalyses;i++){
+			if (this->element_type_list[i]) seg->element_type_list[i]=this->element_type_list[i];
+			else seg->element_type_list[i] = 0;
+		}
+	}
+	else seg->element_type_list = NULL;
+	seg->element_type=this->element_type;
+	seg->numanalyses=nanalyses;
+
+	//deal with ElementHook mother class
+	if (this->hnodes){
+		seg->hnodes=xNew<Hook*>(seg->numanalyses);
+		for(i=0;i<seg->numanalyses;i++){
+			if (this->hnodes[i]) seg->hnodes[i] = (Hook*)(this->hnodes[i]->copy());
+			else seg->hnodes[i] = NULL;
+		}
+	}
+	else seg->hnodes = NULL;
+
+	seg->hvertices = (Hook*)this->hvertices->copy();
+	seg->hmaterial = (Hook*)this->hmaterial->copy();
+	seg->hmatpar   = (Hook*)this->hmatpar->copy();
+	seg->hneighbors = NULL;
+
+	/*deal with Element fields: */
+	seg->id  = this->id;
+	seg->sid = this->sid;
+	if(this->inputs) seg->inputs = (Inputs*)(this->inputs->Copy());
+	else seg->inputs=new Inputs();
+
+	/*point parameters: */
+	seg->parameters=this->parameters;
+
+	/*recover objects: */
+	if (this->nodes){
+		unsigned int num_nodes = 3;
+		seg->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
+		for(i=0;i<num_nodes;i++) if(this->nodes[i]) seg->nodes[i]=this->nodes[i]; else seg->nodes[i] = NULL;
+	}
+	else seg->nodes = NULL;
+
+	seg->vertices = (Vertex**)this->hvertices->deliverp();
+	seg->material = (Material*)this->hmaterial->delivers();
+	seg->matpar   = (Matpar*)this->hmatpar->delivers();
+
+	return seg;
+
+
+}
+/*}}}*/
+void Seg::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(SegEnum);
+
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
+	SegRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	vertices = (Vertex**)this->hvertices->deliverp();
+	material = (Material*)this->hmaterial->delivers();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Seg.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 19254)
@@ -38,5 +38,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 		/*}}}*/
 		/*Element virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Elements/SegRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/SegRef.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/SegRef.h	(revision 19254)
@@ -25,4 +25,5 @@
 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement);
 		int  NumberofNodes(int finiteelement);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
 };
 #endif
Index: /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 19254)
@@ -92,5 +92,5 @@
 
 	/*recover objects: */
-	unsigned int num_nodes = 3;
+	unsigned int num_nodes = 4;
 	tetra->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
 	for(i=0;i<num_nodes;i++) if(this->nodes[i]) tetra->nodes[i]=this->nodes[i]; else tetra->nodes[i] = NULL;
@@ -101,4 +101,19 @@
 
 	return tetra;
+}
+/*}}}*/
+void Tetra::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(TetraEnum);
+
+	/*Call parent classes: */
+	ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	Element::Marshall(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();
+	matpar   = (Matpar*)this->hmatpar->delivers();
+
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Tetra.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 19254)
@@ -38,5 +38,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 		/*}}}*/
 		/*Element virtual functions definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 19254)
@@ -29,4 +29,5 @@
 		int  TensorInterpolation(int fe_stokes);
 		int  VelocityInterpolation(int fe_stokes);
+		void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*do nothing */};
 };
 #endif
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 19254)
@@ -107,5 +107,4 @@
 	else tria->nodes = NULL;
 	
-
 	tria->vertices = (Vertex**)this->hvertices->deliverp();
 	tria->material = (Material*)this->hmaterial->delivers();
@@ -130,5 +129,4 @@
 }
 /*}}}*/
-
 
 /*Other*/
Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 19254)
@@ -84,4 +84,5 @@
 	xDelete<char>(outbinfilename);
 	xDelete<char>(petscfilename);
+	xDelete<char>(restartfilename);
 	xDelete<char>(rootpath);
 
@@ -625,5 +626,4 @@
 	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;
@@ -662,5 +662,8 @@
 	restartfid=pfopen(restartfilename,"r",false);
 
-	if(restartfid==NULL)return; //could not find the file, so no restart possible.
+	if(restartfid==NULL){
+		xDelete<char>(restartfilename);
+		return; //could not find the file, so no restart possible.
+	}
 
 	/*Figure out size of buffer to be read: */
@@ -673,9 +676,12 @@
 
 	/*Read buffer from file: */
-	fread_return=fread(femmodel_buffer,femmodel_size,1,restartfid); if(fread_return!=1)_error_("error reading the buffer from marshalled file!");
+	fread_return=fread(femmodel_buffer,femmodel_size,sizeof(char),restartfid); if(fread_return!=1)_error_("error reading the buffer from marshalled file!");
 	femmodel_buffer_ini=femmodel_buffer; //keep track of the initial position, so as to free later.
 
 	/*Create new FemModel by demarshalling the buffer: */
 	this->Marshall(&femmodel_buffer,NULL,MARSHALLING_BACKWARD);
+
+	/*Reset position of buffer: */
+	femmodel_buffer=femmodel_buffer_ini;
 
 	/*Done, close file :*/
@@ -690,14 +696,17 @@
 void FemModel::Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
+	int       i;
+	int       analysis_type;
+
 	if(marshall_direction==MARSHALLING_BACKWARD){
-		delete profiler; profiler=new Profiler;
-		delete elements; elements=new Elements();
-		delete nodes; nodes=new Nodes();
-		delete vertices; vertices=new Vertices();
-		delete constraints; constraints=new Constraints();
+		delete profiler; profiler=new Profiler();
 		delete loads; loads=new Loads();
 		delete materials; materials=new Materials();
 		delete parameters; parameters=new Parameters();
+		delete constraints; constraints=new Constraints();
 		delete results; results=new Results();
+		delete nodes; nodes=new Nodes();
+		delete vertices; vertices=new Vertices();
+		delete elements; elements=new Elements();
 		xDelete<int>(analysis_type_list);
 	}
@@ -707,15 +716,33 @@
 	MARSHALLING(solution_type);
 	MARSHALLING(analysis_counter);
-	MARSHALLING_DYNAMIC(analysis_type_list,int,analysis_counter);
+	MARSHALLING(nummodels);
+	MARSHALLING_DYNAMIC(analysis_type_list,int,nummodels);
 
 	profiler->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-	elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-	nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-	vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-	constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	loads->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	materials->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	parameters->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	constraints->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 	results->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	nodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	vertices->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	elements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		//reset hooks for elements, loads and nodes:
+		elements->ResetHooks();
+		loads->ResetHooks();
+		materials->ResetHooks();
+
+		//do the post-processing of the datasets to get an FemModel that can actually run analyses:
+		for(i=0;i<nummodels;i++){
+			analysis_type=analysis_type_list[i];
+			SetCurrentConfiguration(analysis_type);
+			if(i==0) VerticesDofx(vertices,parameters); //only call once, we only have one set of vertices
+			SpcNodesx(nodes,constraints,parameters,analysis_type);
+			NodesDofx(nodes,parameters,analysis_type);
+			ConfigureObjectsx(elements,loads,nodes,vertices,materials,parameters);
+		}
+	}
 
 }
Index: /issm/trunk-jpl/src/c/classes/Hook.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Hook.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Hook.cpp	(revision 19254)
@@ -126,6 +126,16 @@
 	MARSHALLING_ENUM(HookEnum);
 	MARSHALLING(num);
-	MARSHALLING_DYNAMIC(ids,int,num);
-	MARSHALLING_DYNAMIC(offsets,int,num);
+	if (num<=0){
+		/*Empty hook*/
+		this->ids     = NULL;
+		this->objects = NULL;
+		this->offsets = NULL;
+		this->num = 0;
+	}
+	else{
+		MARSHALLING_DYNAMIC(ids,int,num);
+		MARSHALLING_DYNAMIC(offsets,int,num);
+		MARSHALLING_DYNAMIC(objects,Object*,num);
+	}
 
 }
Index: /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.cpp	(revision 19254)
@@ -38,7 +38,7 @@
 }
 /*}}}*/
-int    BoolInput::Id(void){ return -1; }/*{{{*/
+int  BoolInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int BoolInput::ObjectEnum(void){/*{{{*/
+int  BoolInput::ObjectEnum(void){/*{{{*/
 
 	return BoolInputEnum;
@@ -49,4 +49,13 @@
 
 	return new BoolInput(this->enum_type,this->value);
+
+}
+/*}}}*/
+void BoolInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(BoolInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/BoolInput.h	(revision 19254)
@@ -27,5 +27,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 		/*}}}*/
 		/*BoolInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.cpp	(revision 19254)
@@ -71,7 +71,7 @@
 }
 /*}}}*/
-int    ControlInput::Id(void){ return -1; }/*{{{*/
-/*}}}*/
-int ControlInput::ObjectEnum(void){/*{{{*/
+int  ControlInput::Id(void){ return -1; }/*{{{*/
+/*}}}*/
+int  ControlInput::ObjectEnum(void){/*{{{*/
 
 	return ControlInputEnum;
@@ -96,4 +96,38 @@
 }
 /*}}}*/
+void ControlInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(ControlInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(control_id);
+
+	if (marshall_direction == MARSHALLING_BACKWARD){
+		switch(enum_type){
+			case TriaInputEnum:
+				values     =new TriaInput();
+				savedvalues=new TriaInput();
+				minvalues  =new TriaInput();
+				maxvalues  =new TriaInput();
+				gradient   =new TriaInput();
+				break;
+			case PentaInputEnum:
+				values     =new PentaInput();
+				savedvalues=new PentaInput();
+				minvalues  =new PentaInput();
+				maxvalues  =new PentaInput();
+				gradient   =new PentaInput();
+				break;
+			default:
+				_error_("Input of Enum " << EnumToStringx(enum_type) << " not supported yet by ControlInput");
+		}
+	}
+	if(values) this->values->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(savedvalues) this->savedvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(minvalues) this->minvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(maxvalues) this->maxvalues->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	if(gradient) this->gradient->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+}
+/*}}}*/
 
 /*ControlInput management*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/ControlInput.h	(revision 19254)
@@ -35,5 +35,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*ControlInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.cpp	(revision 19254)
@@ -71,4 +71,16 @@
 
 	return (Object*)output;
+}
+/*}}}*/
+void DatasetInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(DatasetInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(numids);
+	MARSHALLING_DYNAMIC(ids,int,numids)
+	if (marshall_direction == MARSHALLING_BACKWARD) inputs = new Inputs();
+	inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DatasetInput.h	(revision 19254)
@@ -32,5 +32,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*DatasetInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.cpp	(revision 19254)
@@ -52,4 +52,13 @@
 }
 /*}}}*/
+void DoubleInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(DoubleInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
+
+}
+/*}}}*/
 
 /*DoubleInput management*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/DoubleInput.h	(revision 19254)
@@ -30,5 +30,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*DoubleInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/IntInput.cpp	(revision 19254)
@@ -34,7 +34,7 @@
 }
 /*}}}*/
-int    IntInput::Id(void){ return -1; }/*{{{*/
+int  IntInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntInput::ObjectEnum(void){/*{{{*/
+int  IntInput::ObjectEnum(void){/*{{{*/
 
 	return IntInputEnum;
@@ -45,4 +45,13 @@
 
 	return new IntInput(this->enum_type,this->value);
+
+}
+/*}}}*/
+void IntInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(IntInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(value);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/IntInput.h	(revision 19254)
@@ -31,5 +31,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*IntInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.cpp	(revision 19254)
@@ -28,5 +28,5 @@
 	if (numnodes > 0){
 		this->values=xNew<IssmDouble>((unsigned int)numnodes);
-		for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
+		for(int i=0;i<numnodes;i++) values[i]=in_values[i];
 	}
 	else{
@@ -53,7 +53,7 @@
 }
 /*}}}*/
-int    PentaInput::Id(void){ return -1; }/*{{{*/
-/*}}}*/
-int PentaInput::ObjectEnum(void){/*{{{*/
+int  PentaInput::Id(void){ return -1; }/*{{{*/
+/*}}}*/
+int  PentaInput::ObjectEnum(void){/*{{{*/
 
 	return PentaInputEnum;
@@ -65,4 +65,18 @@
 	return new PentaInput(this->enum_type,this->values,this->interpolation_type);
 
+}
+/*}}}*/
+void PentaInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(PentaInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/PentaInput.h	(revision 19254)
@@ -32,5 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 
 		/*PentaInput management*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/SegInput.cpp	(revision 19254)
@@ -45,7 +45,7 @@
 }
 /*}}}*/
-int    SegInput::Id(void){ return -1; }/*{{{*/
+int  SegInput::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int SegInput::ObjectEnum(void){/*{{{*/
+int  SegInput::ObjectEnum(void){/*{{{*/
 
 	return SegInputEnum;
@@ -57,4 +57,18 @@
 	return new SegInput(this->enum_type,this->values,this->interpolation_type);
 
+}
+/*}}}*/
+void SegInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(SegInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/SegInput.h	(revision 19254)
@@ -32,5 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 
 		/*SegInput management:*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.cpp	(revision 19254)
@@ -28,5 +28,5 @@
 	if (numnodes > 0){
 		this->values=xNew<IssmDouble>((unsigned int)numnodes);
-		for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
+		for(int i=0;i<numnodes;i++) values[i]=in_values[i];
 	}
 	else{
@@ -53,7 +53,7 @@
 }
 /*}}}*/
-int    TetraInput::Id(void){ return -1; }/*{{{*/
-/*}}}*/
-int TetraInput::ObjectEnum(void){/*{{{*/
+int  TetraInput::Id(void){ return -1; }/*{{{*/
+/*}}}*/
+int  TetraInput::ObjectEnum(void){/*{{{*/
 
 	return TetraInputEnum;
@@ -65,4 +65,18 @@
 	return new TetraInput(this->enum_type,this->values,this->interpolation_type);
 
+}
+/*}}}*/
+void TetraInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(TetraInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TetraInput.h	(revision 19254)
@@ -32,5 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 
 		/*TetraInput management:*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp	(revision 19254)
@@ -102,4 +102,16 @@
 	return (Object*)output;
 
+}
+/*}}}*/
+void TransientInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	if (marshall_direction == MARSHALLING_BACKWARD) inputs = new Inputs();
+
+	MARSHALLING_ENUM(TransientInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(numtimesteps);
+	MARSHALLING_DYNAMIC(this->timesteps,IssmDouble,numtimesteps);
+	inputs->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h	(revision 19254)
@@ -37,5 +37,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*TransientInput management: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.cpp	(revision 19254)
@@ -28,5 +28,5 @@
 	if (numnodes > 0){
 		this->values=xNew<IssmDouble>((unsigned int)numnodes);
-		for(int i=0;i<this->NumberofNodes(this->interpolation_type);i++) values[i]=in_values[i];
+		for(int i=0;i<numnodes;i++) values[i]=in_values[i];
 	}
 	else{
@@ -64,4 +64,18 @@
 	return new TriaInput(this->enum_type,this->values,this->interpolation_type);
 
+}
+/*}}}*/
+void TriaInput::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(TriaInputEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation_type);
+
+	int numnodes = this->NumberofNodes(this->interpolation_type);
+	if(numnodes > 0){
+		MARSHALLING_DYNAMIC(this->values,IssmDouble,numnodes)
+	}
+	else this->values = NULL;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Inputs/TriaInput.h	(revision 19254)
@@ -32,5 +32,5 @@
 		int     ObjectEnum();
 		Object *copy();
-		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);
 
 		/*TriaInput management:*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.cpp	(revision 19254)
@@ -156,4 +156,31 @@
 
 	return numericalflux;
+}
+/*}}}*/
+void    Numericalflux::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(NumericalfluxEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+	MARSHALLING(flux_type);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnodes      = new Hook();
+		this->hvertices   = new Hook();
+		this->helement    = new Hook();
+	}
+
+	this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	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();
+
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Numericalflux.h	(revision 19254)
@@ -45,5 +45,5 @@
 		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);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 19254)
@@ -105,8 +105,37 @@
 
 	//let's not forget internals
-	pengrid->active=this->active=0;
-	pengrid->zigzag_counter=this->zigzag_counter=0;
+	pengrid->active=this->active;
+	pengrid->zigzag_counter=this->zigzag_counter;
 
 	return pengrid;
+
+}
+/*}}}*/
+void    Pengrid::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(PengridEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnode      = new Hook();
+		this->helement   = new Hook();
+		this->hmatpar    = new Hook();
+	}
+
+	this->hnode->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	node   =(Node*)this->hnode->delivers();
+	matpar =(Matpar*)this->hmatpar->delivers();
+	element=(Element*)this->helement->delivers();
+
+	MARSHALLING(active);
+	MARSHALLING(zigzag_counter);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Pengrid.h	(revision 19254)
@@ -55,5 +55,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Penpair.cpp	(revision 19254)
@@ -63,4 +63,23 @@
 
 	return penpair;
+
+}
+/*}}}*/
+void    Penpair::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(PenpairEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnodes = new Hook();
+	}
+	this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*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 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Penpair.h	(revision 19254)
@@ -36,5 +36,5 @@
 		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);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 19254)
@@ -150,4 +150,47 @@
 
 	return riftfront;
+
+}
+/*}}}*/
+void    Riftfront::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	_assert_(this);
+
+	/*ok, marshall operations: */
+	MARSHALLING_ENUM(RiftfrontEnum);
+	MARSHALLING(id);
+	MARSHALLING(analysis_type);
+	MARSHALLING(type);
+	MARSHALLING(fill);
+	MARSHALLING(friction);
+	MARSHALLING(fractionincrement);
+	MARSHALLING(shelf);
+
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		this->hnodes      = new Hook();
+		this->hmatpar     = new Hook();
+		this->helements   = new Hook();
+	}
+
+	this->hnodes->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->hmatpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+	this->helements->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+
+	/*corresponding fields*/
+	nodes     =(Node**)this->hnodes->deliverp();
+	matpar    =(Matpar*)this->hmatpar->delivers();
+	elements  =(Element**)this->helements->deliverp();
+
+	MARSHALLING(penalty_lock);
+	MARSHALLING(active);
+	MARSHALLING(frozen);
+	MARSHALLING(state);
+	MARSHALLING(counter);
+	MARSHALLING(prestable);
+	MARSHALLING(material_converged);
+	MARSHALLING(normal[0]);
+	MARSHALLING(normal[1]);
+	MARSHALLING(length);
+	MARSHALLING(fraction);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Loads/Riftfront.h	(revision 19254)
@@ -62,5 +62,5 @@
 		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);
 		/*}}}*/
 		/*Update virtual functions resolution: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 19254)
@@ -122,5 +122,5 @@
 }
 /*}}}*/
-void       Matice::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+void      Matice::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
 
 	if(marshall_direction==MARSHALLING_BACKWARD)helement=new Hook(); 
@@ -130,5 +130,5 @@
 	MARSHALLING(isdamaged);
 	this->helement->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-
+	this->element=(Element*)this->helement->delivers();
 
 }
Index: /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/BoolParam.cpp	(revision 19254)
@@ -63,4 +63,3 @@
 }
 /*}}}*/
-
 		
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleMatArrayParam.cpp	(revision 19254)
@@ -128,13 +128,17 @@
 	MARSHALLING(enum_type);
 	MARSHALLING(M);
-	MARSHALLING_DYNAMIC(mdim_array,int,M);
-	MARSHALLING_DYNAMIC(ndim_array,int,M);
-
-	if(marshall_direction==MARSHALLING_BACKWARD)if(M)array=xNew<IssmDouble*>(M);
-
-	for(int i=0;i<M;i++){
-		MARSHALLING_DYNAMIC(array[i],IssmDouble,mdim_array[i]*ndim_array[i]);
-	}
-		
+	if(M){
+		MARSHALLING_DYNAMIC(mdim_array,int,M);
+		MARSHALLING_DYNAMIC(ndim_array,int,M);
+		if(marshall_direction==MARSHALLING_BACKWARD && M) array=xNew<IssmDouble*>(M);
+		for(int i=0;i<M;i++){
+			MARSHALLING_DYNAMIC(array[i],IssmDouble,mdim_array[i]*ndim_array[i]);
+		}
+	}
+	else{
+		array=NULL;
+		mdim_array=NULL;
+		ndim_array=NULL;
+	}
 
 }
Index: /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/DoubleVecParam.cpp	(revision 19254)
@@ -25,6 +25,9 @@
 	M=in_M;
 
-	values=xNew<IssmDouble>(M);
-	xMemCpy<IssmDouble>(values,in_values,M);
+	if(M){
+		values=xNew<IssmDouble>(M);
+		xMemCpy<IssmDouble>(values,in_values,M);
+	}
+	else values=NULL;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/FileParam.cpp	(revision 19254)
@@ -41,7 +41,7 @@
 }
 /*}}}*/
-int    FileParam::Id(void){ return -1; }/*{{{*/
+int  FileParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int FileParam::ObjectEnum(void){/*{{{*/
+int  FileParam::ObjectEnum(void){/*{{{*/
 
 	return FileParamEnum;
Index: /issm/trunk-jpl/src/c/classes/Params/GenericParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/GenericParam.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/GenericParam.h	(revision 19254)
@@ -52,5 +52,5 @@
                 // use the default copy constructor instead
                 Object* copy() { return new GenericParam<P>(*this); };
-				void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
+					 void Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ _error_("not implemented yet!"); };
                 /*}}}*/
                 /*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/IntMatParam.cpp	(revision 19254)
@@ -59,7 +59,7 @@
 }
 /*}}}*/
-int    IntMatParam::Id(void){ return -1; }/*{{{*/
+int  IntMatParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntMatParam::ObjectEnum(void){/*{{{*/
+int  IntMatParam::ObjectEnum(void){/*{{{*/
 
 	return IntMatParamEnum;
@@ -83,5 +83,4 @@
 }
 /*}}}*/
-
 
 /*IntMatParam virtual functions definitions: */
Index: /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/IntParam.cpp	(revision 19254)
@@ -41,7 +41,7 @@
 }
 /*}}}*/
-int    IntParam::Id(void){ return -1; }/*{{{*/
+int  IntParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntParam::ObjectEnum(void){/*{{{*/
+int  IntParam::ObjectEnum(void){/*{{{*/
 
 	return IntParamEnum;
Index: /issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/IntVecParam.cpp	(revision 19254)
@@ -71,7 +71,7 @@
 }
 /*}}}*/
-int    IntVecParam::Id(void){ return -1; }/*{{{*/
+int  IntVecParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
-int IntVecParam::ObjectEnum(void){/*{{{*/
+int  IntVecParam::ObjectEnum(void){/*{{{*/
 
 	return IntVecParamEnum;
@@ -91,5 +91,8 @@
 	MARSHALLING(enum_type);
 	MARSHALLING(M);
-	MARSHALLING_DYNAMIC(values,int,M);
+	if(M) { 
+		MARSHALLING_DYNAMIC(values,int,M);
+	}
+	else values=NULL;
 
 }
Index: /issm/trunk-jpl/src/c/classes/Params/MatrixParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/MatrixParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/MatrixParam.cpp	(revision 19254)
@@ -50,5 +50,5 @@
 }
 /*}}}*/
-int    MatrixParam::Id(void){ return -1; }/*{{{*/
+int  MatrixParam::Id(void){ return -1; }/*{{{*/
 /*}}}*/
 int MatrixParam::ObjectEnum(void){/*{{{*/
Index: /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/Parameters.cpp	(revision 19254)
@@ -465,5 +465,5 @@
 
 		param=xDynamicCast<Param*>(*object);
-		if(param->InstanceEnum()==enum_type){
+		if(param && param->InstanceEnum()==enum_type){
 			return (*object);
 		}
Index: /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/StringArrayParam.cpp	(revision 19254)
@@ -88,5 +88,5 @@
 		if(numstrings)sizes=xNew<int>(numstrings);
 		for(int i=0;i<numstrings;i++)sizes[i]=strlen(value[i])+1;
-	}
+	}	
 
 	MARSHALLING_ENUM(StringArrayParamEnum);
@@ -97,9 +97,11 @@
 	if(numstrings){
 		MARSHALLING_DYNAMIC(sizes,int,numstrings);
-		
 		if(marshall_direction==MARSHALLING_BACKWARD) value=xNew<char*>(numstrings);
-		
 		for(int i=0;i<numstrings;i++)MARSHALLING_DYNAMIC(value[i],char,sizes[i]);
 	}
+	else value=NULL;
+
+	//cleanup sizes array
+	if(sizes) xDelete<int>(sizes);
 
 }
Index: /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/StringParam.cpp	(revision 19254)
@@ -67,5 +67,4 @@
 	MARSHALLING_DYNAMIC(value,char,size);
 
-
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientParam.cpp	(revision 19254)
@@ -74,4 +74,20 @@
 }
 /*}}}*/
+void TransientParam::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
+
+	MARSHALLING_ENUM(TransientParamEnum);
+
+	MARSHALLING(enum_type);
+	MARSHALLING(interpolation);
+	MARSHALLING(N);
+	if(marshall_direction==MARSHALLING_BACKWARD){
+		values=xNew<IssmDouble>(N);
+		timesteps=xNew<IssmDouble>(N);
+	}
+	MARSHALLING_ARRAY(values,IssmDouble,N);
+	MARSHALLING_ARRAY(timesteps,IssmDouble,N);
+
+}
+/*}}}*/
 
 /*TransientParam virtual functions definitions: */
Index: /issm/trunk-jpl/src/c/classes/Params/TransientParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Params/TransientParam.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/classes/Params/TransientParam.h	(revision 19254)
@@ -39,5 +39,5 @@
 		int   ObjectEnum();
 		Object* copy();
-		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);
 		/*}}}*/
 		/*Param vritual function definitions: {{{*/
Index: /issm/trunk-jpl/src/c/datastructures/DataSet.cpp
===================================================================
--- /issm/trunk-jpl/src/c/datastructures/DataSet.cpp	(revision 19253)
+++ /issm/trunk-jpl/src/c/datastructures/DataSet.cpp	(revision 19254)
@@ -90,9 +90,13 @@
 	
 	vector<Object*>::iterator obj;
-	int obj_enum;
+	int obj_size=0;
+	int obj_enum=0;
 	int i;
 
 	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
-		numsorted=objects.size();
+		obj_size=objects.size();
+	}
+	else{
+		clear();
 	}
 
@@ -102,33 +106,48 @@
 	MARSHALLING(presorted);
 	MARSHALLING(numsorted);
-	MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
-	MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
 
 	/*Now branch according to direction of marshalling: */
 	if(marshall_direction==MARSHALLING_FORWARD || marshall_direction==MARSHALLING_SIZE){
+		if(!(this->sorted && numsorted>0 && this->id_offsets)){
+			sorted_ids=NULL;
+			id_offsets=NULL;
+		  }
+		MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
+		MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
+		MARSHALLING(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();
+			MARSHALLING(obj_enum);
 			(*obj)->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 		}
 	}
 	else{
+
+		MARSHALLING_DYNAMIC(sorted_ids,int,numsorted);
+		MARSHALLING_DYNAMIC(id_offsets,int,numsorted);
+		if (!(this->sorted && numsorted>0)){
+		 sorted_ids=NULL;
+		 id_offsets=NULL;
+		}
+		MARSHALLING(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<this->numsorted;i++){
+		for(i=0;i<obj_size;i++){
 
 			/*Recover enum of object first: */
-			MARSHALLING_ENUM(obj_enum); 
-			/*Reset the file pointer to point again to the beginning of the object: */
-			*pmarshalled_data-=sizeof(int);
+			MARSHALLING(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->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
-					this->AddObject(node);
+				Node* node=NULL;
+				node=new Node();
+				node->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(node);
 			}
 			else if(obj_enum==VertexEnum){
@@ -137,5 +156,4 @@
 				vertex->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 				this->AddObject(vertex);
-				break;
 			}
 			else if(obj_enum==DoubleParamEnum){
@@ -144,5 +162,4 @@
 				doubleparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 				this->AddObject(doubleparam);
-				break;
 			}
 			else if(obj_enum==IntParamEnum){
@@ -151,7 +168,204 @@
 				intparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
 				this->AddObject(intparam);
-				break;
-			}
-			else _error_("could not recognize enum type: " << obj_enum); 
+			}
+			else if(obj_enum==IntMatParamEnum){
+				IntMatParam* intmparam=NULL;
+				intmparam=new IntMatParam();
+				intmparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intmparam);
+			}
+			else if(obj_enum==IntVecParamEnum){
+				IntVecParam* intvparam=NULL;
+				intvparam=new IntVecParam();
+				intvparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intvparam);
+			}
+			else if(obj_enum==BoolParamEnum){
+				BoolParam* boolparam=NULL;
+				boolparam=new BoolParam();
+				boolparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(boolparam);
+			}
+			else if(obj_enum==DataSetParamEnum){
+				DataSetParam* dsparam=NULL;
+				dsparam=new DataSetParam();
+				dsparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dsparam);
+			}
+			else if(obj_enum==DoubleMatArrayParamEnum){
+				DoubleMatArrayParam* dmaparam=NULL;
+				dmaparam=new DoubleMatArrayParam();
+				dmaparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dmaparam);
+			}
+			else if(obj_enum==DoubleMatParamEnum){
+				DoubleMatParam* dmparam=NULL;
+				dmparam=new DoubleMatParam();
+				dmparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dmparam);
+			}
+			else if(obj_enum==DoubleVecParamEnum){
+				DoubleVecParam* dvparam=NULL;
+				dvparam=new DoubleVecParam();
+				dvparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(dvparam);
+			}
+			else if(obj_enum==FileParamEnum){
+				FileParam* fileparam=NULL;
+				fileparam=new FileParam();
+				fileparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(fileparam);
+			}
+			else if(obj_enum==StringParamEnum){
+				StringParam* sparam=NULL;
+				sparam=new StringParam();
+				sparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(sparam);
+			}
+			else if(obj_enum==StringArrayParamEnum){
+				StringArrayParam* saparam=NULL;
+				saparam=new StringArrayParam();
+				saparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(saparam);
+			}
+			else if(obj_enum==TransientParamEnum){
+				TransientParam* transparam=NULL;
+				transparam=new TransientParam();
+				transparam->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(transparam);
+			}
+			else if(obj_enum==MaticeEnum){
+				Matice* matice=NULL;
+				matice=new Matice();
+				matice->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(matice);
+			}
+			else if(obj_enum==MatparEnum){
+				Matpar* matpar=NULL;
+				matpar=new Matpar();
+				matpar->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(matpar);
+			}
+			else if(obj_enum==SpcStaticEnum){
+				SpcStatic* spcstatic=NULL;
+				spcstatic=new SpcStatic();
+				spcstatic->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(spcstatic);
+			}
+			else if(obj_enum==SpcDynamicEnum){
+				SpcDynamic* spcdynamic=NULL;
+				spcdynamic=new SpcDynamic();
+				spcdynamic->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(spcdynamic);
+			}
+			else if(obj_enum==SpcTransientEnum){
+				SpcTransient* spctransient=NULL;
+				spctransient=new SpcTransient();
+				spctransient->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(spctransient);
+			}
+			else if(obj_enum==TriaEnum){
+				Tria* tria=NULL;
+				tria=new Tria();
+				tria->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(tria);
+			}
+			else if(obj_enum==PentaEnum){
+				Penta* penta=NULL;
+				penta=new Penta();
+				penta->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(penta);
+			}
+			else if(obj_enum==TetraEnum){
+				Tetra* tetra=NULL;
+				tetra=new Tetra();
+				tetra->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(tetra);
+			}
+			else if(obj_enum==SegEnum){
+				Seg* seg=NULL;
+				seg=new Seg();
+				seg->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(seg);
+			}
+			else if(obj_enum==BoolInputEnum){
+				BoolInput* boolinput=NULL;
+				boolinput=new BoolInput();
+				boolinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(boolinput);
+			}
+			else if(obj_enum==DoubleInputEnum){
+				DoubleInput* doubleinput=NULL;
+				doubleinput=new DoubleInput();
+				doubleinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(doubleinput);
+			}
+			else if(obj_enum==IntInputEnum){
+				IntInput* intinput=NULL;
+				intinput=new IntInput();
+				intinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(intinput);
+			}
+			else if(obj_enum==ControlInputEnum){
+				ControlInput* cinput=NULL;
+				cinput=new ControlInput();
+				cinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(cinput);
+			}
+			else if(obj_enum==TransientInputEnum){
+				TransientInput* transinput=NULL;
+				transinput=new TransientInput();
+				transinput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(transinput);
+			}
+			else if(obj_enum==TriaInputEnum){
+				TriaInput* triainput=NULL;
+				triainput=new TriaInput();
+				triainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(triainput);
+			}
+			else if(obj_enum==PentaInputEnum){
+				PentaInput* pentainput=NULL;
+				pentainput=new PentaInput();
+				pentainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(pentainput);
+			}
+			else if(obj_enum==TetraInputEnum){
+				TetraInput* tetrainput=NULL;
+				tetrainput=new TetraInput();
+				tetrainput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(tetrainput);
+			}
+			else if(obj_enum==SegInputEnum){
+				SegInput* seginput=NULL;
+				seginput=new SegInput();
+				seginput->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(seginput);
+			}
+			else if(obj_enum==RiftfrontEnum){
+				Riftfront* rift=NULL;
+				rift=new Riftfront();
+				rift->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(rift);
+			}
+			else if(obj_enum==NumericalfluxEnum){
+				Numericalflux* numflux=NULL;
+				numflux=new Numericalflux();
+				numflux->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(numflux);
+			}
+			else if(obj_enum==PengridEnum){
+				Pengrid* pengrid=NULL;
+				pengrid=new Pengrid();
+				pengrid->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(pengrid);
+			}
+			else if(obj_enum==PenpairEnum){
+				Penpair* penpair=NULL;
+				penpair=new Penpair();
+				penpair->Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
+				this->AddObject(penpair);
+			}
+			else _error_("could not recognize enum type: " << obj_enum << ": " << EnumToStringx(obj_enum) ); 
 		}
 	}
Index: /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h	(revision 19253)
+++ /issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h	(revision 19254)
@@ -13,7 +13,7 @@
 
 #define MARSHALLING_ENUM(EN)\
-	int enum_type=EN;\
+	int type_enum=EN;\
 	if(marshall_direction==MARSHALLING_FORWARD){\
-		memcpy(*pmarshalled_data,&enum_type,sizeof(int));\
+		memcpy(*pmarshalled_data,&type_enum,sizeof(int));\
 		*pmarshalled_data+=sizeof(int);\
 	}\
