Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 16300)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 16301)
@@ -542,4 +542,8 @@
 
 #}}}
+#Responses sources  {{{
+responses_sources =  ./classes/Massfluxatgate.h \
+					 ./modules/ModelProcessorx/CreateOutputDefinitions.cpp
+#}}}
 #Damage sources  {{{
 damage_sources =  ./analyses/damage_core.cpp\
@@ -878,4 +882,8 @@
 endif
 
+if RESPONSES
+issm_sources  +=  $(responses_sources)
+endif
+
 if PETSC
 issm_sources  +=  $(petsc_sources)
Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 16300)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 16301)
@@ -891,4 +891,71 @@
 }
 /*}}}*/
+/*FUNCTION IoModel::FetchMultipleData(char***       pstrings,int* pnumstrings,int data_enum){{{*/
+void  IoModel::FetchMultipleData(char*** pstrings,int* pnumstrings,int data_enum){
+
+	int my_rank;
+
+	int i;
+	int num_instances;
+
+	/*output: */
+	int   numstrings=0;
+	char** strings=NULL;
+
+	/*intermediary: */
+	char* string=NULL;
+	int   string_size;
+	int*   code=NULL;
+	FILE** file_instances=NULL;
+	FILE* file_id=NULL;
+
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
+
+	/*Get file pointers to beginning of the data (multiple instances of it): */
+	file_instances=this->SetFilePointerToData(&codes,NULL,&num_instances,data_enum);
+
+	if(num_instances){
+
+		strings=xNew<char*>(num_instances);
+
+		for(i=0;i<num_instances;i++){
+
+			file_id=file_instances[i];
+
+			/*check we are indeed finding a string, not something else: */
+			if(codes[i]!=4)_error_("expecting a string for enum " << EnumToStringx(data_enum));
+
+			/*We have to read a string from disk. First read the dimensions of the string, then the string: */
+			if(my_rank==0){  
+				if(fread(&string_size,sizeof(int),1,file_id)!=1) _error_("could not read length of string ");
+			}
+
+			ISSM_MPI_Bcast(&string_size,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+
+			/*Now allocate string: */
+			if(string_size){
+				string=xNew<char>((string_size+1));
+				string[string_size]='\0';
+
+				/*Read string on node 0, then broadcast: */
+				if(my_rank==0){  
+					if(fread(string,string_size*sizeof(char),1,file_id)!=1)_error_(" could not read string ");
+				}
+				ISSM_MPI_Bcast(string,string_size,ISSM_MPI_CHAR,0,IssmComm::GetComm()); 
+			}
+			else{
+				string=xNew<char>(1);
+				string[0]='\0';
+			}
+			strings[i]=string;
+		}
+	}
+	
+	/*Assign output pointers: */
+	*pstrings=strings;
+	*pnumstrings=num_instances;
+}
+/*}}}*/
 /*FUNCTION IoModel::FetchData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{*/
 void  IoModel::FetchData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){
@@ -975,4 +1042,97 @@
 	*pndims=ndims;
 	*pnumrecords=numrecords;
+}
+/*}}}*/
+/*FUNCTION IoModel::FetchMultipleData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pM,int data_enum){{{*/
+void  IoModel::FetchMultipleData(IssmDouble*** pmatrices,int** pmdims,int** pndims, int* pnumrecords,int data_enum){
+
+	int i;
+	int num_instances;
+	int my_rank;
+	
+	FILE** file_instances=NULL;
+	FILE* file_id=NULL;
+
+	/*output: */
+	IssmDouble** matrices=NULL;
+	int*     mdims=NULL;
+	int*     ndims=NULL;
+	int      numrecords=0;
+
+	/*intermediary: */
+	int     M, N;
+	IssmPDouble *pmatrix = NULL;
+	IssmDouble *matrix = NULL;
+	int     code;
+
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
+	
+	/*Get file pointers to beginning of the data (multiple instances of it): */
+	file_instances=this->SetFilePointerToData(&codes,NULL,&num_instances,data_enum);
+
+	if(num_instances){
+
+		/*Allocate matrices :*/
+		matrices=xNew<IssmDouble*>(numrecords);
+		mdims=xNew<int>(numrecords);
+		ndims=xNew<int>(numrecords);
+
+		for(i=0;i<num_instances;i++){
+
+			file_id=file_instances[i];
+			code=codes[i];
+
+			if((code!=5) && (code!=6) && (code!=7))_error_("expecting a IssmDouble, integer or boolean matrix for enum " << EnumToStringx(data_enum));
+			
+			/*We have to read a matrix from disk. First read the dimensions of the matrix, then the whole matrix: */
+			/*numberofelements: */
+			if(my_rank==0){  
+				if(fread(&M,sizeof(int),1,file_id)!=1) _error_("could not read number of rows for matrix ");
+			}
+			ISSM_MPI_Bcast(&M,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+
+			if(my_rank==0){  
+				if(fread(&N,sizeof(int),1,file_id)!=1) _error_("could not read number of columns for matrix ");
+			}
+			ISSM_MPI_Bcast(&N,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+
+			/*Now allocate matrix: */
+			if(M*N){
+				pmatrix=xNew<IssmPDouble>(M*N);
+
+				/*Read matrix on node 0, then broadcast: */
+				if(my_rank==0){  
+					if(fread(pmatrix,M*N*sizeof(IssmPDouble),1,file_id)!=1) _error_("could not read matrix ");
+				}
+				ISSM_MPI_Bcast(pmatrix,M*N,ISSM_MPI_PDOUBLE,0,IssmComm::GetComm()); 
+
+				_assert_(this->independents);
+				if (this->independents[data_enum]){
+					/*this data has already been checked out! So cancel all that we've done here, and return 
+					 * the data[data_enum] directly: */
+					matrix=this->data[data_enum];
+				}
+				else{
+					matrix=xNew<IssmDouble>(M*N);
+					for (int i=0;i<M*N;++i) matrix[i]=pmatrix[i];
+				}
+				xDelete<IssmPDouble>(matrix);
+			}
+			else
+				matrix=NULL;
+			
+			/*Assign: */
+			mdims[i]=M;
+			matrices[i]=matrix;
+			ndims[i]=N;
+		}
+	}
+
+	/*Assign output pointers: */
+	*pmatrices=matrices;
+	*pmdims=mdims;
+	*pndims=ndims;
+	*pnumrecords=num_instances;
 }
 /*}}}*/
@@ -1257,5 +1417,4 @@
 	ISSM_MPI_Bcast(&record_code,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
 	ISSM_MPI_Bcast(&vector_type,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
-	if(record_code==5) ISSM_MPI_Bcast(&vector_type,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
 
 	/*Assign output pointers:*/
@@ -1266,2 +1425,100 @@
 }
 /*}}}*/
+/*FUNCTION IoModel::SetFilePointersToData{{{*/
+FILE** IoModel::SetFilePointersToData(int** pcodes,int** pvector_types, int* pnum_instances, int data_enum){
+
+	int  my_rank;
+	int  found         = 0;
+	int  record_enum;
+	int  record_length;
+	int  record_code;       //1 to 7 number
+	int  vector_type;       //1 to 7 number
+	int* vector_types   = NULL;
+	int* codes= NULL;
+	int  num_instances  = 0;
+	int  counter;
+	FILE** file_instances =NULL;
+
+	/*recover my_rank:*/
+	my_rank=IssmComm::GetRank();
+
+	/*Go find in the binary file, the data we want to fetch and count the number of 
+	 * instances it appears: */
+	if(my_rank==0){
+
+		/*First set FILE* position to the beginning of the file: */
+		fseek(fid,0,SEEK_SET);
+
+		/*Now march through file looking for the correct data identifier: */
+		for(;;){
+			/*Read enum for this size of first string name: */
+			if(fread(&record_enum,sizeof(int),1,fid)==0){
+				/*Ok, we have reached the end of the file. break: */
+				break;
+			}
+
+			/*Is this the record sought for? : */
+			if (data_enum==record_enum) num_instances++;
+
+			/*Read the record length, and use it to skip the record: */
+			if(fread(&record_length,sizeof(int),1,fid)!=1) _error_("Could not read record_length");
+			fseek(fid,record_length,SEEK_CUR);
+		}
+
+		/*Ok, initialize the number of file handles we are going to return: */
+		if(num_instances){
+			file_instances = xNew<FILE*>(num_instances);
+			codes = xNew<int>(num_instances);
+			vector_types = xNew<int>(num_instances);
+		}
+
+	
+		/*Reset FILE* position to the beginning of the file, and start again, this time saving the data information 
+		 * as we find it: */
+		counter=0;
+		fseek(fid,0,SEEK_SET);
+
+		for(;;){
+			/*Read enum for this size of first string name: */
+			if(fread(&record_enum,sizeof(int),1,fid)==0){
+				/*Ok, we have reached the end of the file. break: */
+				break;
+			}
+
+			/*Is this the record sought for? : */
+			if (data_enum==record_enum){
+				/*Ok, we have found the correct string. Pass the record length, and read data type code: */
+				fseek(fid,sizeof(int),SEEK_CUR);
+				if(fread(&record_code,sizeof(int),1,fid)!=1) _error_("Could not read record_code");
+
+				/*if record_code points to a vector, get its type (nodal or elementary): */
+				if(5<=record_code && record_code<=7){
+					if(fread(&vector_type,sizeof(int),1,fid)!=1) _error_("Could not read vector_type");
+				}
+				codes[counter]=record_code;
+				vector_types[counter]=vector_type;
+				file_instances[counter]=fid;
+				counter++;
+				break;
+			}
+			else{
+				/*This is not the correct string, read the record length, and use it to skip this record: */
+				if(fread(&record_length,sizeof(int),1,fid)!=1) _error_("Could not read record_length");
+				/*skip: */
+				fseek(fid,record_length,SEEK_CUR);
+			}
+		}
+	}
+
+	/*Broadcast data: */
+	ISSM_MPI_Bcast(&num_instances,1,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+	ISSM_MPI_Bcast(codes,num_instances,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+	ISSM_MPI_Bcast(vector_types,num_instances,ISSM_MPI_INT,0,IssmComm::GetComm()); 
+
+	/*Assign output pointers:*/
+	*pcodes=codes;
+	*pnum_instances=num_instances;
+	if(pvector_types)*pvector_types=vector_types;
+	return file_instances;
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/IoModel.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.h	(revision 16300)
+++ /issm/trunk-jpl/src/c/classes/IoModel.h	(revision 16301)
@@ -76,4 +76,6 @@
 		void        FetchData(char***   pstringarray,int* pnumstrings,int data_enum);
 		void        FetchData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
+		void        FetchMultipleData(char***   pstringarray,int* pnumstrings,int data_enum);
+		void        FetchMultipleData(IssmDouble*** pmatrixarray,int** pmdims,int** pndims, int* pnumrecords,int data_enum);
 		void        FetchData(Option **poption,int data_enum);
 		void        FetchData(int num,...);
@@ -81,4 +83,5 @@
 		void        FetchDataToInput(Elements* elements,int vector_enum,IssmDouble default_value);
 		void        LastIndex(int *pindex);
+		FILE**      SetFilePointersToData(int** pcodes,int** pvector_types, int data_enum);
 		FILE*       SetFilePointerToData(int* pcode,int* pvector_type, int data_enum);
 		void        DeclareIndependents(void);
Index: /issm/trunk-jpl/src/c/classes/Massfluxatgate.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 16301)
+++ /issm/trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 16301)
@@ -0,0 +1,124 @@
+/*!\file Massfluxatgate.h
+ * \brief: header file for Massfluxatgate object
+ */
+
+#ifndef _MASSFLUXATGATE_H_
+#define _MASSFLUXATGATE_H_
+
+/*Headers:*/
+/*{{{*/
+#include "../shared/shared.h"
+#include "../datastructures/datastructures.h"
+/*}}}*/
+
+template <class doubletype>
+class Massfluxatgate: public Object{
+
+	public: 
+
+		char*       name;
+		int         numsegments;
+		doubletype *x1;
+		doubletype *y1;
+		doubletype *x2;
+		doubletype *y2;
+		int*        elements;
+
+		/*Massfluxatgate constructors, destructors :*/
+		/*FUNCTION Massfluxatgate() {{{*/
+		Massfluxatgate(){
+			this->name     = 0;
+			this->numsegments     = 0;
+			this->segments   = 0;
+		}
+		/*}}}*/
+		/*FUNCTION Massfluxatgate(char* name, int numsegments, doubletype* segments) {{{*/
+		Massfluxatgate(char* in_name, int in_numsegments, doubletype* in_segments) {
+
+			this->name   = xNew<char>(strlen(in_name)+1);
+			xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
+
+			this->numsegments=in_numsegments;
+
+			if(this->numsegments){
+				this->x1=xNew<doubletype>(this->numsegments);
+				this->x2=xNew<doubletype>(this->numsegments);
+				this->y1=xNew<doubletype>(this->numsegments);
+				this->y2=xNew<doubletype>(this->numsegments);
+				this->elements=xNew<int>(this->numsegments);
+
+				for(i=0;i<this->numsegments;i++){
+					this->x1[i]=in_segments[5*i+0];
+					this->y1[i]=in_segments[5*i+1];
+					this->x2[i]=in_segments[5*i+2];
+					this->y2[i]=in_segments[5*i+3];
+					this->elements[i]=(int)in_segments[5*i+4];
+				}
+			}
+		}
+		/*}}}*/
+		/*FUNCTION Massfluxatgate(char* name, int numsegments, doubletype* x1, doubletype* y1, doubletype* x2, doubletype* y2,int* elements) {{{*/
+		Massfluxatgate(char* in_name, int in_numsegments, doubletype* in_x1, doubletype* in_y1, doubletype* in_x2, doubletype* in_y2,int* in_elements){
+
+			this->name   = xNew<char>(strlen(in_name)+1);
+			xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
+
+			this->numsegments=in_numsegments;
+
+			if(this->numsegments){
+				this->x1=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->x1,in_x1,this->numsegments);
+				this->y1=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->y1,in_y1,this->numsegments);
+				this->x2=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->x2,in_x2,this->numsegments);
+				this->y2=xNew<doubletype>(this->numsegments); xMemCpy<doubletype>(this->y2,in_y2,this->numsegments);
+				this->elements=xNew<int>(this->numsegments); xMemCpy<int>(this->elements,in_elements,this->numsegments);
+				
+			}
+		}
+		/*}}}*/
+		/*FUNCTION ~Massfluxatgate() {{{*/
+		~Massfluxatgate(){
+			xDelete<doubletype>(this->x1);
+			xDelete<doubletype>(this->y1);
+			xDelete<doubletype>(this->x2);
+			xDelete<doubletype>(this->y2);
+			xDelete<int>(this->elements);
+			xDelete<char>(this->name);
+		}
+		/*}}}*/
+
+		/*Object virtual function resolutoin: */
+		/*FUNCTION Echo(){{{*/
+		void Echo(void){
+			_printf_(" Massfluxatgate: " << name << "\n");
+			_printf_("    numsegments: " << numsegments << "\n");
+			if(numsegments){
+				_printf_("   element: x1, y1, x2, y2:\n");
+				for(int i=0;i<numsegments;i++){
+					_printf_(elements[i] << " " << x1[i] << " " << y1[i] << " " << x2[i] << " " << y2[i] << "\n");
+				}
+			}
+		}
+		/*}}}*/
+		/*FUNCTION DeepEcho(){{{*/
+		void DeepEcho(void){
+			this->Echo();
+		}
+		/*}}}*/
+		/*FUNCTION Id(){{{*/
+		int Id(void){
+			return -1;
+		}
+		/*}}}*/
+		/*FUNCTION ObjectEnum{{{*/
+		int ObjectEnum(void){
+			return MassfluxatgateEnum;
+		}
+		/*}}}*/
+		/*FUNCTION copy {{{*/
+		Object* copy() {
+			return new Massfluxatgate(this->name,this->numsegments,this->); 
+		}
+		/*}}}*/
+};
+
+#endif  /* _MASSFLUXATGATE_H_ */
Index: /issm/trunk-jpl/src/c/classes/classes.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/classes.h	(revision 16300)
+++ /issm/trunk-jpl/src/c/classes/classes.h	(revision 16301)
@@ -17,4 +17,5 @@
 #include "./IndependentObject.h"
 #include "./Segment.h"
+#include "./Massfluxatgate.h"
 
 /*Constraints: */
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 16301)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 16301)
@@ -0,0 +1,41 @@
+/*!\file: CreateParametersOutputDefinitions.cpp
+ * \brief driver for creating output definitions dataset, and including it into the parameters dataset
+ */ 
+
+#include "../../../toolkits/toolkits.h"
+#include "../../../classes/classes.h"
+#include "../../../shared/shared.h"
+#include "../ModelProcessorx.h"
+
+void CreateParametersOutputDefinitions(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type){
+
+	Parameters *parameters = NULL;
+	DataSet* output_definitions=NULL;
+
+	/*Get parameters: */
+	parameters=*pparameters;
+
+	output_definitions=new DataSet();
+	
+	iomodel->FetchData(&output_definition_enums,&num_output_definitions,NULL,OutputdefinitionEnumsEnum); 
+	if(num_output_definitions){
+		for (i=0;i<num_output_definitions;i++){
+
+			if (output_definition_enums[i]==MassfluxatgateEnum){
+
+				/*Fetch segments and names: */
+				iomodel->FetchMultipleData(&gatenames,&numgates,MassfluxatgateNameEnum);
+				iomodel->FetchMultipleData(&gatesegments,&gatesegments_M,&gatesegments_N,&numgates,MassfluxatgateSegmentsEnum);
+				for(j=0;j<numgates;j++){
+					output_definitions->AddObject(new Massfluxgate(gatenames[i],gatesegments[i],gatesegments_M[i],gatesegments_N[i]));
+				}
+			}
+			else _error_("output definition enum " << output_definition_enums[i] << "not supported yet!");
+		}
+	}
+	parameters->AddObject(new DataSetParam(OutputdefinitionEnum,output_definitions);
+
+	
+	/*Assign output pointer: */
+	*pparameters=parameters;
+}
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16300)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 16301)
@@ -24,17 +24,4 @@
 	IssmDouble  time;
 	bool        ispdd,isdelta18o;
-
-	/*parameters for mass flux: {{{*/
-	int          mass_flux_num_profiles     = 0;
-	bool         qmu_mass_flux_present      = false;
-	bool         mass_flux_present          = false;
-	IssmDouble **array                      = NULL;
-	int         *mdims_array                = NULL;
-	int         *ndims_array                = NULL;
-	IssmDouble  *temp_matrix                = NULL;
-	int          temp_m,temp_n;
-	IssmDouble  *matrix                     = NULL;
-	int          count;
-	/*}}}*/
 
 	if(*pparameters)return; //do not create parameters twice!
@@ -150,64 +137,6 @@
 	iomodel->DeleteData(requestedoutputs,MasstransportRequestedOutputsEnum);
 
-	/*Deal with mass flux segments: {{{*/
-	iomodel->FetchData(&qmu_mass_flux_present,QmuMassFluxSegmentsPresentEnum);
-
-	if(qmu_mass_flux_present)mass_flux_present=true;
-	else mass_flux_present=false;
-	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];
-			_assert_(temp_n==5);
-
-			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;
-				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);
-		}
-
-		/*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);
-	}
-	/*}}}*/
+	/*Output definitions dataset: */
+	CreateOutputDefinitions(&parameters,iomodel);
 
 	/*Solution specific parameters*/
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 16300)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 16301)
@@ -160,3 +160,7 @@
 void DistributeNumDofs(DofIndexing* index,int analysis_type,int node_type);
 
+#ifdef _HAVE_RESPONSES_
+void CreateParametersOutputDefinitions(Parameters** pparameters,IoModel* iomodel,int solution_type,int analysis_type);
 #endif
+
+#endif
Index: /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16300)
+++ /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 16301)
@@ -212,8 +212,4 @@
 	MasstransportNumRequestedOutputsEnum,
 	MasstransportRequestedOutputsEnum,
-	MassFluxSegmentsEnum,
-	MassFluxSegmentsPresentEnum,
-	MassfluxatgateNameEnum,
-	MassfluxatgateSegmentsEnum,
 	QmuIsdakotaEnum,
 	QmuNumberofpartitionsEnum,
@@ -543,4 +539,11 @@
 	WaterColumnOldEnum,
 	/*}}}*/
+	/*Output Definitions{{{*/
+	OutputdefinitionEnum,
+	OutputdefinitionEnumsEnum,
+	MassfluxatgateEnum,
+	MassfluxatgateNameEnum,
+	MassfluxatgateSegmentsEnum,
+	/*}}}*/
 	/*Responses{{{*/
 	MinVelEnum,
Index: /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16300)
+++ /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 16301)
@@ -220,8 +220,4 @@
 		case MasstransportNumRequestedOutputsEnum : return "MasstransportNumRequestedOutputs";
 		case MasstransportRequestedOutputsEnum : return "MasstransportRequestedOutputs";
-		case MassFluxSegmentsEnum : return "MassFluxSegments";
-		case MassFluxSegmentsPresentEnum : return "MassFluxSegmentsPresent";
-		case MassfluxatgateNameEnum : return "MassfluxatgateName";
-		case MassfluxatgateSegmentsEnum : return "MassfluxatgateSegments";
 		case QmuIsdakotaEnum : return "QmuIsdakota";
 		case QmuNumberofpartitionsEnum : return "QmuNumberofpartitions";
@@ -532,4 +528,9 @@
 		case TriaP1ElementResultEnum : return "TriaP1ElementResult";
 		case WaterColumnOldEnum : return "WaterColumnOld";
+		case OutputdefinitionEnum : return "Outputdefinition";
+		case OutputdefinitionEnumsEnum : return "OutputdefinitionEnums";
+		case MassfluxatgateEnum : return "Massfluxatgate";
+		case MassfluxatgateNameEnum : return "MassfluxatgateName";
+		case MassfluxatgateSegmentsEnum : return "MassfluxatgateSegments";
 		case MinVelEnum : return "MinVel";
 		case MaxVelEnum : return "MaxVel";
Index: /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16300)
+++ /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 16301)
@@ -223,8 +223,4 @@
 	      else if (strcmp(name,"MasstransportNumRequestedOutputs")==0) return MasstransportNumRequestedOutputsEnum;
 	      else if (strcmp(name,"MasstransportRequestedOutputs")==0) return MasstransportRequestedOutputsEnum;
-	      else if (strcmp(name,"MassFluxSegments")==0) return MassFluxSegmentsEnum;
-	      else if (strcmp(name,"MassFluxSegmentsPresent")==0) return MassFluxSegmentsPresentEnum;
-	      else if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
-	      else if (strcmp(name,"MassfluxatgateSegments")==0) return MassfluxatgateSegmentsEnum;
 	      else if (strcmp(name,"QmuIsdakota")==0) return QmuIsdakotaEnum;
 	      else if (strcmp(name,"QmuNumberofpartitions")==0) return QmuNumberofpartitionsEnum;
@@ -260,12 +256,12 @@
 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
 	      else if (strcmp(name,"SurfaceforcingsIspdd")==0) return SurfaceforcingsIspddEnum;
+	      else if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
+	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
+	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
+	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"SurfaceforcingsDesfac")==0) return SurfaceforcingsDesfacEnum;
-	      else if (strcmp(name,"SurfaceforcingsS0p")==0) return SurfaceforcingsS0pEnum;
-	      else if (strcmp(name,"SurfaceforcingsIssmbgradients")==0) return SurfaceforcingsIssmbgradientsEnum;
-	      else if (strcmp(name,"SurfaceforcingsMonthlytemperatures")==0) return SurfaceforcingsMonthlytemperaturesEnum;
-	      else if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
+	      if (strcmp(name,"SurfaceforcingsHref")==0) return SurfaceforcingsHrefEnum;
 	      else if (strcmp(name,"SurfaceforcingsSmbref")==0) return SurfaceforcingsSmbrefEnum;
 	      else if (strcmp(name,"SurfaceforcingsBPos")==0) return SurfaceforcingsBPosEnum;
@@ -383,12 +379,12 @@
 	      else if (strcmp(name,"Input")==0) return InputEnum;
 	      else if (strcmp(name,"IntInput")==0) return IntInputEnum;
+	      else if (strcmp(name,"IntParam")==0) return IntParamEnum;
+	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
+	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
+	      else if (strcmp(name,"Matice")==0) return MaticeEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"IntParam")==0) return IntParamEnum;
-	      else if (strcmp(name,"IntVecParam")==0) return IntVecParamEnum;
-	      else if (strcmp(name,"TransientParam")==0) return TransientParamEnum;
-	      else if (strcmp(name,"Matice")==0) return MaticeEnum;
-	      else if (strcmp(name,"Matpar")==0) return MatparEnum;
+	      if (strcmp(name,"Matpar")==0) return MatparEnum;
 	      else if (strcmp(name,"Node")==0) return NodeEnum;
 	      else if (strcmp(name,"Numericalflux")==0) return NumericalfluxEnum;
@@ -506,12 +502,12 @@
 	      else if (strcmp(name,"StressTensorxz")==0) return StressTensorxzEnum;
 	      else if (strcmp(name,"StressTensoryy")==0) return StressTensoryyEnum;
+	      else if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
+	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
+	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
+	      else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"StressTensoryz")==0) return StressTensoryzEnum;
-	      else if (strcmp(name,"StressTensorzz")==0) return StressTensorzzEnum;
-	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
-	      else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum;
-	      else if (strcmp(name,"GiaW")==0) return GiaWEnum;
+	      if (strcmp(name,"GiaW")==0) return GiaWEnum;
 	      else if (strcmp(name,"P0")==0) return P0Enum;
 	      else if (strcmp(name,"P1")==0) return P1Enum;
@@ -544,4 +540,9 @@
 	      else if (strcmp(name,"TriaP1ElementResult")==0) return TriaP1ElementResultEnum;
 	      else if (strcmp(name,"WaterColumnOld")==0) return WaterColumnOldEnum;
+	      else if (strcmp(name,"Outputdefinition")==0) return OutputdefinitionEnum;
+	      else if (strcmp(name,"OutputdefinitionEnums")==0) return OutputdefinitionEnumsEnum;
+	      else if (strcmp(name,"Massfluxatgate")==0) return MassfluxatgateEnum;
+	      else if (strcmp(name,"MassfluxatgateName")==0) return MassfluxatgateNameEnum;
+	      else if (strcmp(name,"MassfluxatgateSegments")==0) return MassfluxatgateSegmentsEnum;
 	      else if (strcmp(name,"MinVel")==0) return MinVelEnum;
 	      else if (strcmp(name,"MaxVel")==0) return MaxVelEnum;
Index: /issm/trunk-jpl/src/m/classes/outputdefinition.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/outputdefinition.m	(revision 16300)
+++ /issm/trunk-jpl/src/m/classes/outputdefinition.m	(revision 16301)
@@ -47,5 +47,7 @@
 			obj.enums(i)=StringToEnum(class(obj.definitions{i}));
 		end
-		WriteData(fid,'object',obj,'fieldname','enums','format','DoubleMat','mattype',1,'scale',1./yts,'forcinglength',md.mesh.numberofvertices+1);
+		obj.enums=unique(obj.enums);
+		
+		WriteData(fid,'object',obj,'fieldname','enums','format','DoubleMat','mattype',1);
 		end % }}}
 	end
Index: /issm/trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- /issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16300)
+++ /issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 16301)
@@ -212,8 +212,4 @@
 def MasstransportNumRequestedOutputsEnum(): return StringToEnum("MasstransportNumRequestedOutputs")[0]
 def MasstransportRequestedOutputsEnum(): return StringToEnum("MasstransportRequestedOutputs")[0]
-def MassFluxSegmentsEnum(): return StringToEnum("MassFluxSegments")[0]
-def MassFluxSegmentsPresentEnum(): return StringToEnum("MassFluxSegmentsPresent")[0]
-def MassfluxatgateNameEnum(): return StringToEnum("MassfluxatgateName")[0]
-def MassfluxatgateSegmentsEnum(): return StringToEnum("MassfluxatgateSegments")[0]
 def QmuIsdakotaEnum(): return StringToEnum("QmuIsdakota")[0]
 def QmuNumberofpartitionsEnum(): return StringToEnum("QmuNumberofpartitions")[0]
@@ -524,4 +520,9 @@
 def TriaP1ElementResultEnum(): return StringToEnum("TriaP1ElementResult")[0]
 def WaterColumnOldEnum(): return StringToEnum("WaterColumnOld")[0]
+def OutputdefinitionEnum(): return StringToEnum("Outputdefinition")[0]
+def OutputdefinitionEnumsEnum(): return StringToEnum("OutputdefinitionEnums")[0]
+def MassfluxatgateEnum(): return StringToEnum("Massfluxatgate")[0]
+def MassfluxatgateNameEnum(): return StringToEnum("MassfluxatgateName")[0]
+def MassfluxatgateSegmentsEnum(): return StringToEnum("MassfluxatgateSegments")[0]
 def MinVelEnum(): return StringToEnum("MinVel")[0]
 def MaxVelEnum(): return StringToEnum("MaxVel")[0]
Index: sm/trunk-jpl/src/m/enum/MassFluxSegmentsEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/MassFluxSegmentsEnum.m	(revision 16300)
+++ 	(revision )
@@ -1,11 +1,0 @@
-function macro=MassFluxSegmentsEnum()
-%MASSFLUXSEGMENTSENUM - Enum of MassFluxSegments
-%
-%   WARNING: DO NOT MODIFY THIS FILE
-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
-%            Please read src/c/shared/Enum/README for more information
-%
-%   Usage:
-%      macro=MassFluxSegmentsEnum()
-
-macro=StringToEnum('MassFluxSegments');
Index: sm/trunk-jpl/src/m/enum/MassFluxSegmentsPresentEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/MassFluxSegmentsPresentEnum.m	(revision 16300)
+++ 	(revision )
@@ -1,11 +1,0 @@
-function macro=MassFluxSegmentsPresentEnum()
-%MASSFLUXSEGMENTSPRESENTENUM - Enum of MassFluxSegmentsPresent
-%
-%   WARNING: DO NOT MODIFY THIS FILE
-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
-%            Please read src/c/shared/Enum/README for more information
-%
-%   Usage:
-%      macro=MassFluxSegmentsPresentEnum()
-
-macro=StringToEnum('MassFluxSegmentsPresent');
Index: /issm/trunk-jpl/src/m/enum/MassfluxatgateEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/MassfluxatgateEnum.m	(revision 16301)
+++ /issm/trunk-jpl/src/m/enum/MassfluxatgateEnum.m	(revision 16301)
@@ -0,0 +1,11 @@
+function macro=MassfluxatgateEnum()
+%MASSFLUXATGATEENUM - Enum of Massfluxatgate
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=MassfluxatgateEnum()
+
+macro=StringToEnum('Massfluxatgate');
Index: /issm/trunk-jpl/src/m/enum/OutputdefinitionEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/OutputdefinitionEnum.m	(revision 16301)
+++ /issm/trunk-jpl/src/m/enum/OutputdefinitionEnum.m	(revision 16301)
@@ -0,0 +1,11 @@
+function macro=OutputdefinitionEnum()
+%OUTPUTDEFINITIONENUM - Enum of Outputdefinition
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=OutputdefinitionEnum()
+
+macro=StringToEnum('Outputdefinition');
Index: /issm/trunk-jpl/src/m/enum/OutputdefinitionEnumsEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/OutputdefinitionEnumsEnum.m	(revision 16301)
+++ /issm/trunk-jpl/src/m/enum/OutputdefinitionEnumsEnum.m	(revision 16301)
@@ -0,0 +1,11 @@
+function macro=OutputdefinitionEnumsEnum()
+%OUTPUTDEFINITIONENUMSENUM - Enum of Outputdefinitions
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=OutputdefinitionEnumsEnum()
+
+macro=StringToEnum('Outputdefinitions');
