Index: issm/trunk-jpl/src/m/classes/autodiff.js
===================================================================
--- issm/trunk-jpl/src/m/classes/autodiff.js	(revision 19787)
+++ issm/trunk-jpl/src/m/classes/autodiff.js	(revision 19791)
@@ -31,4 +31,7 @@
 
 	}// }}}
+	this.classname= function(){// {{{
+		return "autodiff";
+	}// }}}
 		this.checkconsistency = function(md,solution,analyses){ //{{{
 
@@ -57,4 +60,153 @@
 			}
 		} // }}}
+		this.marshall=function(md,fid) { //{{{
+
+			WriteData(fid,'object',this,'fieldname','isautodiff','format','Boolean');
+			WriteData(fid,'object',this,'fieldname','driver','format','String');
+
+			//early return
+			if (!this.isautodiff){
+				WriteData(fid,'data',false,'enum',AutodiffMassFluxSegmentsPresentEnum(),'format','Boolean');
+				WriteData(fid,'data',false,'enum',AutodiffKeepEnum(),'format','Boolean');
+				return;
+			}
+
+			//buffer sizes {{{
+			WriteData(fid,'object',this,'fieldname','obufsize','format','Double');
+			WriteData(fid,'object',this,'fieldname','lbufsize','format','Double');
+			WriteData(fid,'object',this,'fieldname','cbufsize','format','Double');
+			WriteData(fid,'object',this,'fieldname','tbufsize','format','Double');
+			WriteData(fid,'object',this,'fieldname','gcTriggerRatio','format','Double');
+			WriteData(fid,'object',this,'fieldname','gcTriggerMaxSize','format','Double');
+			//}}}
+			//process dependent variables {{{
+			num_dependent_objects=this.dependents.length;
+			WriteData(fid,'data',num_dependent_objects,'enum',AutodiffNumDependentObjectsEnum(),'format','Integer');
+
+			if(num_dependent_objects){
+				var names=[];
+				types=NewArrayFill(num_dependent_objects,0);
+				indices=NewArrayFill(num_dependent_objects,0);
+
+				for (var i=0;i<num_dependent_objects;i++){
+					dep=this.dependents[i];
+
+					names.push(dep.name);
+					types[i]=dep.typetoscalar();
+					indices[i]=dep.index;
+				}
+				WriteData(fid,'data',names,'enum',AutodiffDependentObjectNamesEnum(),'format','StringArray');
+				WriteData(fid,'data',types,'enum',AutodiffDependentObjectTypesEnum(),'format','IntMat','mattype',3);
+				WriteData(fid,'data',indices,'enum',AutodiffDependentObjectIndicesEnum(),'format','IntMat','mattype',3);
+			}
+			//}}}
+			//process independent variables {{{
+			num_independent_objects=this.independents.length;
+			WriteData(fid,'data',num_independent_objects,'enum',AutodiffNumIndependentObjectsEnum(),'format','Integer');
+
+			if(num_independent_objects){
+				names=NewArrayFill(num_independent_objects,0);
+				types=NewArrayFill(num_independent_objects,0);
+
+				for (var i=0;i<num_independent_objects;i++){
+					indep=this.independents[i];
+
+					names[i]=StringToEnum(indep.name);
+					types[i]=indep.typetoscalar();
+				}
+				WriteData(fid,'data',names,'enum',AutodiffIndependentObjectNamesEnum(),'format','IntMat','mattype',3);
+				WriteData(fid,'data',types,'enum',AutodiffIndependentObjectTypesEnum(),'format','IntMat','mattype',3);
+			}
+			//}}}
+			//if driver is fos_forward, build index:  {{{
+			if (this.driver == 'fos_forward'){
+				var index=0;
+
+				for (var i=0;i<num_independent_objects;i++){
+					indep=this.independents[i];
+					if (!(isNaN(indep.fos_forward_index))){
+						index=index+indep.fos_forward_index;
+						break;
+					}
+					else{
+						if (indep.type=='scalar') index=index+1;
+						else index=index+indep.nods;
+					}
+				}
+				index=index-1; //get c-index numbering going
+				WriteData(fid,'data',index,'enum',AutodiffFosForwardIndexEnum(),'format','Integer');
+			}
+			//}}}
+			//if driver is fos_reverse, build index:  {{{
+			if (this.driver  == 'fos_reverse'){
+				var index=0;
+
+				for (var i=0;i<num_dependent_objects;i++){
+					dep=this.dependents[i];
+					if (!(isNaN(dep.fos_reverse_index))){
+						index=index+dep.fos_reverse_index;
+						break;
+					}
+					else{
+						if (dep.type =='scalar') index=index+1;
+						else index=index+dep.nods;
+					}
+				}
+				index=index-1; //get c-index numbering going
+				WriteData(fid,'data',index,'enum',AutodiffFosReverseIndexEnum(),'format','Integer');
+			}
+			//}}}
+			//if driver is fov_forward, build indices:  {{{
+			if (this.driver == 'fov_forward'){
+				var indices=0;
+
+				for (var i=0;i<num_independent_objects;i++){
+					indep=this.independents[i];
+					if (!indep.fos_forward_index.length){
+						indices=indices+indep.fov_forward_indices;
+						break;
+					}
+					else{
+						if (indep.type =='scalar') indices=indices+1;
+						else indices=indices+indep.nods;
+					}
+				}
+				indices=indices-1; //get c-indices numbering going
+				WriteData(fid,'data',indices,'enum',AutodiffFovForwardIndicesEnum(),'format','IntMat','mattype',3);
+			}
+			//}}}
+			//deal with mass fluxes:  {{{
+			mass_flux_segments=[];
+			for (var i=0;i<num_dependent_objects;i++){
+				dep=this.dependents[i];
+				if (dep.name =='MassFlux'){
+					mass_flux_segments.push(dep.segments);
+				}
+			}
+			if (mass_flux_segments.length){
+				WriteData(fid,'data',mass_flux_segments,'enum',MassFluxSegmentsEnum(),'format','MatArray');
+				flag=true;
+			}
+			else flag=false;
+			WriteData(fid,'data',flag,'enum',AutodiffMassFluxSegmentsPresentEnum(),'format','Boolean');
+			//}}}
+			//deal with trace keep on: {{{
+			keep=false;
+
+			//From ADOLC userdoc: 
+			// The optional integer argument keep of trace on determines whether the numerical values of all active variables are 
+			// recorded in a buffered temporary array or file called the taylor stack. This option takes effect if keep = 1 and 
+			// prepares the scene for an immediately following gradient evaluation by a call to a routine implementing the reverse 
+			// mode as described in the Section 4 and Section 5. 
+			//
+
+			if (this.driver.length<=3) keep=false; //there is no "_reverse" string within the driver string: 
+			else{
+				if (this.driver.splice(4) == '_reverse') keep=true;
+				else keep=false;
+			}
+			WriteData(fid,'data',keep,'enum',AutodiffKeepEnum(),'format','Boolean');
+			//}}}
+		}//}}}
 	//properties 
 	// {{{
