Index: issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h
===================================================================
--- issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h	(revision 13515)
+++ issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h	(revision 13516)
@@ -31,4 +31,5 @@
 	AutodiffFosReverseIndexEnum,
 	AutodiffMassFluxSegmentsPresentEnum,
+	AutodiffKeepEnum,
 	BalancethicknessSpcthicknessEnum,
 	BalancethicknessStabilizationEnum,
Index: issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 13515)
+++ issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 13516)
@@ -212,5 +212,5 @@
 	int         numberofvertices;
 	int         dummy;
-	char*       driver=NULL;
+	bool        keep=false;
 
 
@@ -226,32 +226,9 @@
 		#ifdef _HAVE_ADOLC_
 
-		/*Start the trace:  {{{
-		 * to do so, figure out what kind of driver we are running. Then, according to ADOLC documentation, 
-		 * we'll need to activate keep. 
-		 *
-		 * 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. 
-		 *
-		 */
-		this->FetchData(&driver,AutodiffDriverEnum);
-		if (strlen(driver)<=3){
-			/*there is no "_reverse" string within the driver string: */
-			if(VerboseAutodiff())_pprintLine_("   trace activated with keep off");
-			trace_on(1);
-		}
-		else{
-			if (strncmp((const char*)(driver+3),"_reverse",8)==0){
-				if(VerboseAutodiff())_pprintLine_("   trace activated with keep on");
-				trace_on(1,1);
-			}
-			else{
-				if(VerboseAutodiff())_pprintLine_("   trace activated with keep off");
-				trace_on(1);
-			}
-		}
-		xDelete<char>(driver);
+		/*Start trace: {{{*/
+		this->FetchData(&keep,AutodiffKeepEnum);
+		if(keep)trace_on(1,1);
+		else    trace_on(1);
+
 		/*}}}*/
 		/*build dataset made of independent objects: {{{*/
Index: issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp
===================================================================
--- issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 13515)
+++ issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 13516)
@@ -36,4 +36,5 @@
 		case AutodiffFosReverseIndexEnum : return "AutodiffFosReverseIndex";
 		case AutodiffMassFluxSegmentsPresentEnum : return "AutodiffMassFluxSegmentsPresent";
+		case AutodiffKeepEnum : return "AutodiffKeep";
 		case BalancethicknessSpcthicknessEnum : return "BalancethicknessSpcthickness";
 		case BalancethicknessStabilizationEnum : return "BalancethicknessStabilization";
Index: issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp
===================================================================
--- issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp	(revision 13515)
+++ issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp	(revision 13516)
@@ -38,6 +38,9 @@
 	
 	if(autodiff_analysis){
+	
+		/*Copy some parameters from IoModel to parameters dataset: */
+		parameters->AddObject(iomodel->CopyConstantObject(AutodiffKeepEnum));
 
-		/*retrieve driver: */
+		/*retrieve driver: {{{*/
 		iomodel->Constant(&autodiff_driver,AutodiffDriverEnum);
 		parameters->AddObject(iomodel->CopyConstantObject(AutodiffDriverEnum));
@@ -55,5 +58,5 @@
 			xDelete<int>(indices);
 		}
-
+		/*}}}*/
 		/*Deal with dependents first: {{{*/
 		iomodel->Constant(&num_dependent_objects,AutodiffNumDependentObjectsEnum);
Index: issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp
===================================================================
--- issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 13515)
+++ issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 13516)
@@ -37,4 +37,5 @@
 	      else if (strcmp(name,"AutodiffFosReverseIndex")==0) return AutodiffFosReverseIndexEnum;
 	      else if (strcmp(name,"AutodiffMassFluxSegmentsPresent")==0) return AutodiffMassFluxSegmentsPresentEnum;
+	      else if (strcmp(name,"AutodiffKeep")==0) return AutodiffKeepEnum;
 	      else if (strcmp(name,"BalancethicknessSpcthickness")==0) return BalancethicknessSpcthicknessEnum;
 	      else if (strcmp(name,"BalancethicknessStabilization")==0) return BalancethicknessStabilizationEnum;
@@ -137,9 +138,9 @@
 	      else if (strcmp(name,"MeshDimension")==0) return MeshDimensionEnum;
 	      else if (strcmp(name,"MeshEdges")==0) return MeshEdgesEnum;
-	      else if (strcmp(name,"MeshElementconnectivity")==0) return MeshElementconnectivityEnum;
          else stage=2;
    }
    if(stage==2){
-	      if (strcmp(name,"MeshElementonbed")==0) return MeshElementonbedEnum;
+	      if (strcmp(name,"MeshElementconnectivity")==0) return MeshElementconnectivityEnum;
+	      else if (strcmp(name,"MeshElementonbed")==0) return MeshElementonbedEnum;
 	      else if (strcmp(name,"MeshElementonsurface")==0) return MeshElementonsurfaceEnum;
 	      else if (strcmp(name,"MeshElements2d")==0) return MeshElements2dEnum;
@@ -260,9 +261,9 @@
 	      else if (strcmp(name,"SurfaceSlopeAnalysis")==0) return SurfaceSlopeAnalysisEnum;
 	      else if (strcmp(name,"SurfaceSlopeSolution")==0) return SurfaceSlopeSolutionEnum;
-	      else if (strcmp(name,"SurfaceSlopeXAnalysis")==0) return SurfaceSlopeXAnalysisEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"SurfaceSlopeYAnalysis")==0) return SurfaceSlopeYAnalysisEnum;
+	      if (strcmp(name,"SurfaceSlopeXAnalysis")==0) return SurfaceSlopeXAnalysisEnum;
+	      else if (strcmp(name,"SurfaceSlopeYAnalysis")==0) return SurfaceSlopeYAnalysisEnum;
 	      else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum;
 	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
@@ -383,9 +384,9 @@
 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
-	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
@@ -506,9 +507,9 @@
 	      else if (strcmp(name,"Verbose")==0) return VerboseEnum;
 	      else if (strcmp(name,"TriangleInterp")==0) return TriangleInterpEnum;
-	      else if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
+	      if (strcmp(name,"BilinearInterp")==0) return BilinearInterpEnum;
+	      else if (strcmp(name,"NearestInterp")==0) return NearestInterpEnum;
 	      else if (strcmp(name,"XY")==0) return XYEnum;
 	      else if (strcmp(name,"XYZP")==0) return XYZPEnum;
Index: issm/trunk-jpl/src/m/classes/autodiff.m
===================================================================
--- issm/trunk-jpl/src/m/classes/autodiff.m	(revision 13515)
+++ issm/trunk-jpl/src/m/classes/autodiff.m	(revision 13516)
@@ -58,4 +58,5 @@
 			if ~obj.isautodiff, 
 				WriteData(fid,'data',false,'enum',AutodiffMassFluxSegmentsPresentEnum,'format','Boolean');
+				WriteData(fid,'data',false,'enum',AutodiffKeepEnum,'format','Boolean');
 				return; 
 			end
@@ -180,4 +181,25 @@
 			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 length(obj.driver)<=3,
+				keep=false; %there is no "_reverse" string within the driver string: 
+			else
+				if strncmpi(obj.driver(4:end),'_reverse',8),
+					keep=true;
+				else
+					keep=false;
+				end
+			end
+			WriteData(fid,'data',keep,'enum',AutodiffKeepEnum,'format','Boolean');
+			%}}}
 
 		end % }}}
Index: issm/trunk-jpl/src/m/classes/autodiff.py
===================================================================
--- issm/trunk-jpl/src/m/classes/autodiff.py	(revision 13515)
+++ issm/trunk-jpl/src/m/classes/autodiff.py	(revision 13516)
@@ -40,4 +40,5 @@
 		WriteData(fid,'object',self,'fieldname','isautodiff','format','Boolean')
 		WriteData(fid,'data',False,'enum',AutodiffMassFluxSegmentsPresentEnum(),'format','Boolean');
+		WriteData(fid,'data',False,'enum',AutodiffKeepEnum(),'format','Boolean');
 	# }}}
 
Index: issm/trunk-jpl/src/m/enum/AutodiffKeepEnum.m
===================================================================
--- issm/trunk-jpl/src/m/enum/AutodiffKeepEnum.m	(revision 13516)
+++ issm/trunk-jpl/src/m/enum/AutodiffKeepEnum.m	(revision 13516)
@@ -0,0 +1,11 @@
+function macro=AutodiffKeepEnum()
+%AUTODIFFKEEPENUM - Enum of AutodiffKeep
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=AutodiffKeepEnum()
+
+macro=StringToEnum('AutodiffKeep');
Index: issm/trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 13515)
+++ issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 13516)
@@ -199,4 +199,14 @@
 	return StringToEnum('AutodiffMassFluxSegmentsPresent')[0]
 
+def AutodiffKeepEnum():
+	"""
+	AUTODIFFKEEPENUM - Enum of AutodiffKeep
+
+	   Usage:
+	      macro=AutodiffKeepEnum()
+	"""
+
+	return StringToEnum('AutodiffKeep')[0]
+
 def BalancethicknessSpcthicknessEnum():
 	"""
@@ -4937,4 +4947,4 @@
 	"""
 
-	return 492
-
+	return 493
+
Index: issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m
===================================================================
--- issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m	(revision 13515)
+++ issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m	(revision 13516)
@@ -9,3 +9,3 @@
 %      macro=MaximumNumberOfEnums()
 
-macro=492;
+macro=493;
