Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 13484)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 13485)
@@ -25,5 +25,5 @@
 	Parameters *parameters       = NULL;
 	IssmDouble *requestedoutputs = NULL;
-	bool        isdelta18o;
+	bool        isdelta18o,isautodiff;
 
 	/*parameters for mass flux: {{{*/
@@ -156,60 +156,63 @@
 		
 	
-	/*Deal with mass flux segments: {{{*/
-	iomodel->FetchData(&mass_flux_present,MassFluxSegmentsPresentEnum);
-	parameters->AddObject(new BoolParam(MassFluxSegmentsPresentEnum,mass_flux_present));
-
-	if(mass_flux_present){
-
-		/*Fetch the mass flux segments necessary to compute the mass fluxes.  Build a DoubleMatArrayParam object out of them: */ 
-		iomodel->FetchData(&array,&mdims_array,&ndims_array,&mass_flux_num_profiles,MassFluxSegmentsEnum);
-		if(mass_flux_num_profiles==0)_error_("mass_flux_num_profiles is 0, when MassFlux computations were requested!");
-
-		/*Go through segments, and extract those that belong to this cpu: */
-		for(i=0;i<mass_flux_num_profiles;i++){
-			temp_matrix=array[i];
-			temp_m=mdims_array[i];
-			temp_n=ndims_array[i];
-
-			m=0;
-			for(j=0;j<temp_m;j++){
-				if (  iomodel->my_elements[reCast<int>(*(temp_matrix+5*j+4))-1] )m++;
-			}
-			if(m){
-				matrix=xNewZeroInit<IssmDouble>(5*m);
-				count=0;
+	if(isautodiff){
+		/*Deal with mass flux segments: {{{*/
+		iomodel->Constant(&isautodiff,AutodiffIsautodiffEnum);
+		iomodel->FetchData(&mass_flux_present,MassFluxSegmentsPresentEnum);
+		parameters->AddObject(new BoolParam(MassFluxSegmentsPresentEnum,mass_flux_present));
+
+		if(mass_flux_present){
+
+			/*Fetch the mass flux segments necessary to compute the mass fluxes.  Build a DoubleMatArrayParam object out of them: */ 
+			iomodel->FetchData(&array,&mdims_array,&ndims_array,&mass_flux_num_profiles,MassFluxSegmentsEnum);
+			if(mass_flux_num_profiles==0)_error_("mass_flux_num_profiles is 0, when MassFlux computations were requested!");
+
+			/*Go through segments, and extract those that belong to this cpu: */
+			for(i=0;i<mass_flux_num_profiles;i++){
+				temp_matrix=array[i];
+				temp_m=mdims_array[i];
+				temp_n=ndims_array[i];
+
+				m=0;
 				for(j=0;j<temp_m;j++){
-					if (iomodel->my_elements[reCast<int>(*(temp_matrix+5*j+4))-1]){
-						for(k=0;k<5;k++)*(matrix+5*count+k)=*(temp_matrix+5*j+k);
-						count++;
+					if (  iomodel->my_elements[reCast<int>(*(temp_matrix+5*j+4))-1] )m++;
+				}
+				if(m){
+					matrix=xNewZeroInit<IssmDouble>(5*m);
+					count=0;
+					for(j=0;j<temp_m;j++){
+						if (iomodel->my_elements[reCast<int>(*(temp_matrix+5*j+4))-1]){
+							for(k=0;k<5;k++)*(matrix+5*count+k)=*(temp_matrix+5*j+k);
+							count++;
+						}
 					}
 				}
+				else{
+					matrix=NULL;
+				}
+
+				/*Assign: */
+				array[i]=matrix;
+				mdims_array[i]=m;
+				ndims_array[i]=5;
+
+				/*Free temporary matrix: */
+				xDelete<IssmDouble>(temp_matrix);
 			}
-			else{
-				matrix=NULL;
+
+			/*Ok, we have an array of segments, different on every cpu. Create a DoubleMatArrayParam object with it: */
+			parameters->AddObject(new DoubleMatArrayParam(MassFluxSegmentsEnum,array,mass_flux_num_profiles,mdims_array,ndims_array));
+
+			/*Free data: */
+			for(i=0;i<mass_flux_num_profiles;i++){
+				IssmDouble* matrix=array[i];
+				xDelete<IssmDouble>(matrix);
 			}
-
-			/*Assign: */
-			array[i]=matrix;
-			mdims_array[i]=m;
-			ndims_array[i]=5;
-
-			/*Free temporary matrix: */
-			xDelete<IssmDouble>(temp_matrix);
+			xDelete<int>(mdims_array); 
+			xDelete<int>(ndims_array);
+			xDelete<IssmDouble*>(array);
 		}
-
-		/*Ok, we have an array of segments, different on every cpu. Create a DoubleMatArrayParam object with it: */
-		parameters->AddObject(new DoubleMatArrayParam(MassFluxSegmentsEnum,array,mass_flux_num_profiles,mdims_array,ndims_array));
-
-		/*Free data: */
-		for(i=0;i<mass_flux_num_profiles;i++){
-			IssmDouble* matrix=array[i];
-			xDelete<IssmDouble>(matrix);
-		}
-		xDelete<int>(mdims_array); 
-		xDelete<int>(ndims_array);
-		xDelete<IssmDouble*>(array);
+		/*}}}*/
 	}
-	/*}}}*/
 
 	/*Before returning, create parameters in case we are running Qmu or control types runs: */
