Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
===================================================================
--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 18872)
+++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 18873)
@@ -29,16 +29,18 @@
 				/*massfluxatgate variables: */
 				int          numgates;
 				char       **gatenames               = NULL;
+				int        *gatedefinitionenums      = NULL;
 				IssmDouble **gatesegments            = NULL;
 				int         *gatesegments_M          = NULL;
 
 
 				/*Fetch segments and names: */
 				iomodel->FetchMultipleData(&gatenames,&numgates,MassfluxatgateNameEnum);
+				iomodel->FetchMultipleData(&gatedefinitionenums,&numgates,MassfluxatgateDefinitionenumEnum);
 				iomodel->FetchMultipleData(&gatesegments,&gatesegments_M,NULL,&numgates,MassfluxatgateSegmentsEnum);
 
 				for(j=0;j<numgates;j++){
-					output_definitions->AddObject(new Massfluxatgate<IssmDouble>(gatenames[j],gatesegments_M[j],gatesegments[j]));
+					output_definitions->AddObject(new Massfluxatgate<IssmDouble>(gatenames[j],gatedefinitionenums[j],gatesegments_M[j],gatesegments[j]));
 				}
 				/*Free ressources:*/
 				for(j=0;j<numgates;j++){
@@ -48,6 +50,7 @@
 				xDelete<char*>(gatenames);
 				xDelete<IssmDouble*>(gatesegments);
 				xDelete<int>(gatesegments_M);
+				xDelete<int>(gatedefinitionenums);
 				/*}}}*/
 			}
 			else if (output_definition_enums[i]==MisfitEnum){
@@ -56,6 +59,7 @@
 				/*misfit variables: */
 				int          nummisfits;
 				char**       misfit_name_s             = NULL;    
+				int*         misfit_definitionenums_s             = NULL;    
 				int*         misfit_model_enum_s        = NULL;
 				IssmDouble** misfit_observation_s      = NULL;
 				int*         misfit_observation_enum_s  = NULL;
@@ -69,6 +73,7 @@
 
 				/*Fetch name, model_enum, observation, observation_enum, etc ... (see src/m/classes/misfit.m): */
 				iomodel->FetchMultipleData(&misfit_name_s,&nummisfits,MisfitNameEnum);
+				iomodel->FetchMultipleData(&misfit_definitionenums_s,&nummisfits,MisfitDefinitionenumEnum);
 				iomodel->FetchMultipleData(&misfit_model_enum_s,&nummisfits,MisfitModelEnumEnum);
 				iomodel->FetchMultipleData(&misfit_observation_s,&misfit_observation_M_s,&misfit_observation_N_s,&nummisfits,MisfitObservationEnum);
 				iomodel->FetchMultipleData(&misfit_observation_enum_s,&nummisfits,MisfitObservationEnumEnum);
@@ -79,7 +84,7 @@
 				for(j=0;j<nummisfits;j++){
 
 					/*First create a misfit object for that specific enum (misfit_model_enum_s[j]):*/
-					output_definitions->AddObject(new Misfit(misfit_name_s[j],misfit_model_enum_s[j],misfit_observation_enum_s[j],misfit_timeinterpolation_s[j],misfit_weights_enum_s[j]));
+					output_definitions->AddObject(new Misfit(misfit_name_s[j],misfit_definitionenums_s[j],misfit_model_enum_s[j],misfit_observation_enum_s[j],misfit_timeinterpolation_s[j],misfit_weights_enum_s[j]));
 
 					/*Now, for this particular misfit object, make sure we plug into the elements: the observation, and the weights.*/
 					for(i=0;i<elements->Size();i++){
@@ -119,17 +124,19 @@
 				/*masscon variables: */
 				int          nummasscons;
 				char**       masscon_name_s             = NULL;    
+				int*         masscon_definitionenum_s   = NULL;    
 				IssmDouble** masscon_levelset_s           = NULL;
 				int*         masscon_levelset_M_s    = NULL;
 				int*         masscon_levelset_N_s    = NULL;
 
 				/*Fetch name and levelset, etc ... (see src/m/classes/masscon.m): */
 				iomodel->FetchMultipleData(&masscon_name_s,&nummasscons,MassconNameEnum);
+				iomodel->FetchMultipleData(&masscon_definitionenum_s,&nummasscons,MassconDefinitionenumEnum);
 				iomodel->FetchMultipleData(&masscon_levelset_s,&masscon_levelset_M_s,&masscon_levelset_N_s,&nummasscons,MassconLevelsetEnum);
 				for(j=0;j<nummasscons;j++){
 
 					/*Create a masscon object: */
-					output_definitions->AddObject(new Masscon(masscon_name_s[j],masscon_levelset_s[j],masscon_levelset_M_s[j]));
+					output_definitions->AddObject(new Masscon(masscon_name_s[j],masscon_definitionenum_s[j],masscon_levelset_s[j],masscon_levelset_M_s[j]));
 
 				}
 
@@ -145,6 +152,7 @@
 				xDelete<IssmDouble*>(masscon_levelset_s);
 				xDelete<int>(masscon_levelset_M_s);
 				xDelete<int>(masscon_levelset_N_s);
+				xDelete<int>(masscon_definitionenum_s);
 				/*}}}*/
 			}
 			else if (output_definition_enums[i]==MassconaxpbyEnum){
@@ -152,6 +160,7 @@
 				
 				/*masscon variables: */
 				char**       masscon_name_s             = NULL;    
+				int*         masscon_definitionenum_s             = NULL;    
 				char**       masscon_namex_s             = NULL;    
 				char**       masscon_namey_s             = NULL;    
 				IssmDouble*  masscon_alpha_s     = NULL;
@@ -160,6 +169,7 @@
 
 				/*Fetch names and multiplicators, etc ... (see src/m/classes/masscon_axpby.m): */
 				iomodel->FetchMultipleData(&masscon_name_s,&num,MassconaxpbyNameEnum);
+				iomodel->FetchMultipleData(&masscon_definitionenum_s,&num,MassconaxpbyDefinitionenumEnum);
 				iomodel->FetchMultipleData(&masscon_namex_s,&num,MassconaxpbyNamexEnum);
 				iomodel->FetchMultipleData(&masscon_namey_s,&num,MassconaxpbyNameyEnum);
 				iomodel->FetchMultipleData(&masscon_alpha_s,&num,MassconaxpbyAlphaEnum);
@@ -167,7 +177,7 @@
 				for(j=0;j<num;j++){
 
 					/*Create a masscon axpyb object: */
-					output_definitions->AddObject(new Massconaxpby(masscon_name_s[j],masscon_namex_s[j],masscon_namey_s[j],masscon_alpha_s[j],masscon_beta_s[j]));
+					output_definitions->AddObject(new Massconaxpby(masscon_name_s[j],masscon_definitionenum_s[j],masscon_namex_s[j],masscon_namey_s[j],masscon_alpha_s[j],masscon_beta_s[j]));
 
 				}
 
@@ -181,6 +191,7 @@
 				xDelete<char*>(masscon_name_s);
 				xDelete<char*>(masscon_namex_s);
 				xDelete<char*>(masscon_namey_s);
+				xDelete<int>(masscon_definitionenum_s);
 				xDelete<IssmDouble>(masscon_alpha_s);
 				xDelete<IssmDouble>(masscon_beta_s);
 				/*}}}*/
Index: ../trunk-jpl/src/c/classes/Definition.h
===================================================================
--- ../trunk-jpl/src/c/classes/Definition.h	(revision 18872)
+++ ../trunk-jpl/src/c/classes/Definition.h	(revision 18873)
@@ -12,6 +12,7 @@
 	public:
 		virtual       ~Definition(){};
 		virtual char*  Name()=0;
+		virtual int    DefinitionEnum()=0;
 		virtual IssmDouble  Response(FemModel*)=0;
 
 };
