Index: /issm/trunk/src/c/DataSet/DataSet.h
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.h	(revision 3955)
+++ /issm/trunk/src/c/DataSet/DataSet.h	(revision 3956)
@@ -152,6 +152,4 @@
 
 		void ChangeEnum(int enumtype,int new_enumtype);
-		void PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type);
-		void PatchFill(int* pcount, double* patches,int patch_numcols,Parameters* parameters);
 
 		/*}}}*/
Index: /issm/trunk/src/c/DataSet/Inputs.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/Inputs.cpp	(revision 3955)
+++ /issm/trunk/src/c/DataSet/Inputs.cpp	(revision 3956)
@@ -654,82 +654,2 @@
 }
 /*}}}*/
-/*FUNCTION Inputs::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type);{{{1*/
-void Inputs::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){
-
-	int i;
-
-	vector<Object*>::iterator object;
-	Input* input=NULL;
-	bool   found=false;
-
-	int patch_numrows=0;
-	int numcols=0;
-
-	/*First, recover the counter patch_numrows: */
-	patch_numrows=*ppatch_numrows;
-
-	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		input=(Input*)(*object); 
-		if (input->EnumType()==enum_type){
-			found=true;
-			break;
-		}
-	}
-
-	if (!found){
-		/*Ok, the input looked for does not exist. No problem. Just return a patch size of 0, and do 
-		 * not increment the counter: */
-		numcols=0;
-	}
-	else{
-		/*We found the input, get it to tell us the size of the patch information it returns, and increment 
-		 * the counter: */
-		patch_numrows++;
-		numcols=input->PatchSize();
-	}
-
-	/*Assign output pointers:*/
-	*ppatch_numrows=patch_numrows;
-	*pnumcols=numcols;
-
-}
-/*}}}*/
-/*FUNCTION Inputs::PatchFill(int* pcount, double* patches,int patch_numcols);{{{1*/
-void Inputs::PatchFill(int* pcount, double* patches,int patch_numcols,Parameters* parameters){
-
-	int i;
-
-	vector<Object*>::iterator object;
-	Input* input=NULL;
-	bool   found=false;
-
-	int count=0;
-
-	/*First, recover the counter patch_numrows: */
-	count=*pcount;
-
-	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		input=(Input*)(*object); 
-		if (input->EnumType()==enum_type){
-			found=true;
-			break;
-		}
-	}
-
-	if (!found){
-		/*Ok, the input looked for does not exist. No problem. Just return :*/
-	}
-	else{
-		/*We found the input, get it to fill the patch, at the right position in the patches matrix: */
-		input->PatchFill(patches+patch_numcols*count,parameters);
-		count++;
-	}
-
-	/*Assign output pointers:*/
-	*pcount=count;
-}
-/*}}}*/
Index: /issm/trunk/src/c/DataSet/Results.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/Results.cpp	(revision 3955)
+++ /issm/trunk/src/c/DataSet/Results.cpp	(revision 3956)
@@ -105,3 +105,2 @@
 }
 /*}}}*/
-
Index: /issm/trunk/src/c/modules/InputToResultx/InputToPatches.cpp
===================================================================
--- /issm/trunk/src/c/modules/InputToResultx/InputToPatches.cpp	(revision 3955)
+++ /issm/trunk/src/c/modules/InputToResultx/InputToPatches.cpp	(revision 3956)
@@ -15,5 +15,5 @@
 #include "../../DataSet/DataSet.h"
 
-void InputToPatches(DataSet* elements,double* patches,int patch_numrows,int patch_numcols){
+void InputToPatches(DataSet* elements,double* patches,int patch_numcols,int max_vertices,int enum_type){
 
 	int i;
@@ -29,5 +29,5 @@
 
 		element=(Element*)elements->GetObjectByOffset(i);
-		element->PatchFill(&count,patches,patch_numcols);
+		element->PatchFill(&count,patches,patch_numcols,max_vertices,enum_type);
 
 	}
Index: /issm/trunk/src/c/modules/InputToResultx/InputToResultx.cpp
===================================================================
--- /issm/trunk/src/c/modules/InputToResultx/InputToResultx.cpp	(revision 3955)
+++ /issm/trunk/src/c/modules/InputToResultx/InputToResultx.cpp	(revision 3956)
@@ -13,4 +13,21 @@
 void InputToResultx(Result** presult,DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials,Parameters* parameters,int enum_type,int id, double time, int step){
 
+	/*We are going to extract from the inputs, the results desired, and create a table 
+	 * of patch information, that will hold, for each element that computed the result that 
+	 * we desire, the id of the element, the interpolation type, the vertices ids, and the values 
+	 * at the nodes (could be different from the vertices). This will be used for visualization purposed. 
+	 * For example, we could build the following patch table, for velocities: 
+	 * 
+	 * 1 P0  1 2       4.5 NaN  NaN (constant on a beam element)
+	 * 2 P1  1 3 4     4.5 3.2  2.5  (linear values on a tria element)
+	 * 3 P0  1 5 4     5.5 NaN  NaN  (contant on a tria element)
+	 * ... etc ...
+	 *
+	 * So what do we need to build the table: the maximum number of vertices included in the table, 
+	 * and the maximum number of nodal values, as well as the number of rows. Once we have that, 
+	 * we ask the elements to fill their own row in the table, by looping on the elememnts.
+	 * Finally, we include the table in a Result object, that will be used by the OutputResults 
+	 * module to write to disk: */
+
 	int i,j,count;
 
@@ -21,4 +38,6 @@
 	double* patches=NULL; //build a matrix of patch information, corresponding to the input with  name enum_type
 	int     patch_numrows,patch_numcols;
+	int     max_vertices;
+	int     max_nodes;
 
 	/*First, get elements*/
@@ -26,5 +45,10 @@
 
 	/*Figure out size of patches matrix: */
-	PatchesSize(elements,&patch_numrows, &patch_numcols,enum_type);
+	PatchesSize(elements,&patch_numrows, &max_vertices, &max_nodes, enum_type);
+
+	patch_numcols=1+ //element id
+		          1+ //interpolation type
+				  max_vertices+ //vertices
+				  max_nodes; //values+
 
 	/*Allocate matrix: */
@@ -39,5 +63,5 @@
 
 	/*Now, go through elements, their inputs with the correct enum_type, and fill the patches: */
-	InputToPatches(elements,patches,patch_numrows,patch_numcols);
+	InputToPatches(elements,patches,patch_numrows,max_vertices,enum_type); 
 
 	/*Create result object embedding patches: */
@@ -48,2 +72,6 @@
 
 }
+
+
+
+
Index: /issm/trunk/src/c/modules/InputToResultx/InputToResultx.h
===================================================================
--- /issm/trunk/src/c/modules/InputToResultx/InputToResultx.h	(revision 3955)
+++ /issm/trunk/src/c/modules/InputToResultx/InputToResultx.h	(revision 3956)
@@ -12,6 +12,6 @@
 
 /* local prototypes: */
-void PatchesSize(DataSet* elements,int* ppatch_numrows, int* ppatch_numcols,int enum_type);
-void InputToPatches(DataSet* elements,double* patches,int patch_numrows,int patch_numcols);
+void PatchesSize(DataSet* elements,int* pnumrows, int* pnumvertices, int* pnumnodes,int enum_type);
+void InputToPatches(DataSet* elements,double* patches,int numcols, int max_vertices, int enum_type);
 
 #endif  /* _INPUTTORESULTX_H */
Index: /issm/trunk/src/c/modules/InputToResultx/PatchesSize.cpp
===================================================================
--- /issm/trunk/src/c/modules/InputToResultx/PatchesSize.cpp	(revision 3955)
+++ /issm/trunk/src/c/modules/InputToResultx/PatchesSize.cpp	(revision 3956)
@@ -15,38 +15,40 @@
 #include "../../DataSet/DataSet.h"
 
-void PatchesSize(DataSet* elements,int* ppatch_numrows, int* ppatch_numcols,int enum_type){
+void PatchesSize(DataSet* elements,int* pnumrows, int* pnumvertices, int* pnumnodes,int enum_type){
 
 	int i;
 
 	/*output: */
-	int patch_numrows;
-	int patch_numcols;
+	int numrows;
+	int numvertices;
+	int numnodes;
 
 	/*intermediary:*/
 	Element* element=NULL;
-	int count=0;
-	int numcols=0;
-	int max_numcols=0;
+	int element_numvertices;
+	int element_numnodes;
+	
+	/*Go through elemnets, and each time an element holds an input with the correct enum_type, increase numrows by 1. At the 
+	 * same time, retrieve number of vertices this element holds, as well as number of nodes the input holds values for. 
+	 * Update the values of numvertices and numnodes to be the max of all the input numvertices and numnodes:*/
+	
+	numrows=0;
+	numvertices=0;
+	numnodes=0;
 
-	/*Go through elemnets, and each time an element holds an input with the correct enum_type, increase count by 1. At the 
-	 * same time, retrieve size of patch that this input will output, and during the loop, figure out the max of that patch size. 
-	 * The final count will be the number of rows in the patches array, and max_numcols will be the number of columns of the 
-	 * p[atches array: */
-	 
-	patch_numrows=0;
-	patch_numcols=0;
-	numcols=0;
-	
 	for(i=0;i<elements->Size();i++){
 
 		element=(Element*)elements->GetObjectByOffset(i);
-		element->PatchSize(&patch_numrows,&numcols,enum_type);
-		if(numcols>patch_numcols)patch_numcols=numcols;
+		element->PatchSize(&numrows,&element_numvertices,&element_numnodes,enum_type);
+		
+		if(element_numvertices>numvertices)numvertices=element_numvertices;
+		if(element_numnodes>numnodes)numnodes=element_numnodes;
 
 	}
 
 	/*Assign output pointers:*/
-	*ppatch_numrows=patch_numrows;
-	*ppatch_numcols=patch_numcols;
+	*pnumrows=numrows;
+	*pnumvertices=numvertices;
+	*pnumnodes=numnodes;
 }
 
Index: /issm/trunk/src/c/objects/Elements/Beam.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 3956)
@@ -842,12 +842,114 @@
 }
 /*}}}*/
-/*FUNCTION Beam::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){{{1*/
-void  Beam::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){
-	this->inputs->PatchSize(ppatch_numrows,pnumcols,enum_type);
-}
-/*}}}*/
-/*FUNCTION Beam::PatchFill(int* pcount, double* patches,int patch_numcols);{{{1*/
-void  Beam::PatchFill(int* pcount, double* patches,int patch_numcols){
-	this->inputs->PatchFill(pcount,patches,patch_numcols,this->parameters);
-}
-/*}}}*/
+/*FUNCTION Beam::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){{{1*/
+void  Beam::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){
+
+	int    i;
+	Input *input       = NULL;
+	bool   found       = false;
+	int    numrows;
+	int    numvertices;
+	int    numnodes;
+
+	/*Recover counter: */
+	numrows=*pnumrows;
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just be sure numvertices and numnodes
+		 * are 0, so that they do not increase the size of the patches array. Also, do not increase 
+		 * the counter, as this element has nothing to do with results: */
+		numvertices=0;
+		numnodes=0;
+	}
+	else{
+		/*Ok, we found an input with the correct enum_type. Ask it to tell us how many nodal values it 
+		 * holds. : */
+		numnodes=input->PatchSize();
+		/*We know the number of vertices from this element: */
+		numvertices=2;
+		/*Increase counter, because this element does hold a result in its inputs: */
+		numrows++;
+	}
+
+	/*Assign output pointers:*/
+	*pnumrows=numrows;
+	*pnumvertices=numvertices;
+	*pnumnodes=numnodes;
+	
+}
+/*}}}*/
+/*FUNCTION Beam::PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type){{{1*/
+void  Beam::PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type){
+
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1 2       4.5 NaN 
+	 2 P1  1 3       4.5 3.2
+	 3 P0  1 5       5.5 NaN
+	 4 P1  2 4       4.5 3.2
+
+	 Here, we will provide the nodal values, after having processed them, can provide: id, and vertices ids. 
+	 Then go find an input with enum_type. If we find it, fill in the values at the nodal points. 
+	 If we don't find an input, get out of here doing nothing, as this element is not involved in 
+	 outputting results. 
+	 */
+
+	int      i;
+	Input   *input      = NULL;
+	bool     found      = false;
+	int      count      = 0;
+	Node   **nodes      = NULL;
+	double  *this_patch = NULL;
+
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just return :*/
+	}
+	else{
+		
+		/*First, recover the patches row where we will plug in the information: */
+		count=*pcount;
+
+		/*Recover nodes: */
+		nodes=(Node**)hnodes.deliverp();
+
+		/*set this_patch to point at the beginning of the patches row, where we will plug our information :*/
+		this_patch=patches+numcols*count;
+
+		/*Fill in id: */
+		this_patch[0]=this->id;
+
+		/*Fill in vertices ids: */
+		for(i=0;i<2;i++) this_patch[2+i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
+
+		/*We found the input, get it to fill the interpolation type, and the nodal values:*/
+		input->PatchFill(this_patch,max_vertices,this->parameters);
+		
+		/*Increase counter, so that next time, we don't point to the same patches row: */
+		count++;
+
+		/*Assign output pointers:*/
+		*pcount=count;
+	}
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Beam.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Beam.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Beam.h	(revision 3956)
@@ -79,6 +79,6 @@
 		void  ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type);
 		void  GetNodes(void** vpnodes);
-		void  PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type);
-		void  PatchFill(int* pcount, double* patches,int patch_numcols);
+		void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes,int enum_type);
+		void  PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Element.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Element.h	(revision 3956)
@@ -47,6 +47,6 @@
 		virtual void   ComputeStrainRate(Vec eps,     int analysis_type,int sub_analysis_type)=0;
 		virtual double MassFlux(double* segment,double* ug)=0;
-		virtual void   PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type)=0;
-		virtual void   PatchFill(int* pcount, double* patches,int patch_numcols)=0;
+		virtual void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes,int enum_type)=0;
+		virtual void   PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type)=0;
 
 		/*Implementation: */
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 3956)
@@ -4732,12 +4732,111 @@
 }
 /*}}}*/
-/*FUNCTION Penta::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){{{1*/
-void  Penta::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){
-	this->inputs->PatchSize(ppatch_numrows,pnumcols,enum_type);
-}
-/*}}}*/
-/*FUNCTION Penta::PatchFill(int* pcount, double* patches,int patch_numcols);{{{1*/
-void  Penta::PatchFill(int* pcount, double* patches,int patch_numcols){
-	this->inputs->PatchFill(pcount,patches,patch_numcols,this->parameters);
-}
-/*}}}*/
+/*FUNCTION Penta::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){{{1*/
+void  Penta::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){
+
+	int    i;
+	Input *input       = NULL;
+	bool   found       = false;
+	int    numrows;
+	int    numvertices;
+	int    numnodes;
+
+	/*Recover counter: */
+	numrows=*pnumrows;
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just be sure numvertices and numnodes
+		 * are 0, so that they do not increase the size of the patches array. Also, do not increase 
+		 * the counter, as this element has nothing to do with results: */
+		numvertices=0;
+		numnodes=0;
+	}
+	else{
+		/*Ok, we found an input with the correct enum_type. Ask it to tell us how many nodal values it 
+		 * holds. : */
+		numnodes=input->PatchSize();
+		/*We know the number of vertices from this element: */
+		numvertices=6;
+		/*Increase counter, because this element does hold a result in its inputs: */
+		numrows++;
+	}
+
+	/*Assign output pointers:*/
+	*pnumrows=numrows;
+	*pnumvertices=numvertices;
+	*pnumnodes=numnodes;
+	
+}
+/*}}}*/
+/*FUNCTION Penta::PatchFill(int* pcount, double* patches,int numcols,int max_vertices);{{{1*/
+void  Penta::PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type){
+
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1 2 4 11 12 14      4.5  NaN  NaN    NaN NaN NaN
+	 2 P1  2 4 5 12 14 15      4.5  23.3 23.3   4.2 4.2 3.2
+	 3 P0  5 2 1 15 12 11      5.5  NaN  NaN    NaN NaN NaN
+	 4 P1  2 3 5 12 13 15      4.5  30.2 322.2  4.2 3.2 8.3
+	 ...
+
+	 Here, we can provide: id, and vertices ids. 
+	 Then go find an input with enum_type. If we find it, fill in the values at the nodal points. 
+	 If we don't find an input, get out of here doing nothing, as this element is not involved in 
+	 outputting results. 
+	 */
+
+	int      i;
+	Input   *input      = NULL;
+	bool     found      = false;
+	int      count      = 0;
+	double  *this_patch = NULL;
+
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just return :*/
+	}
+	else{
+		
+		/*First, recover the patches row where we will plug in the information: */
+		count=*pcount;
+
+		/*set this_patch to point at the beginning of the patches row, where we will plug our information :*/
+		this_patch=patches+numcols*count;
+
+		/*Fill in id: */
+		this_patch[0]=this->id;
+
+		/*Fill in vertices ids: */
+		for(i=0;i<6;i++) this_patch[2+i]=this->nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
+
+		/*We found the input, get it to fill the interpolation type, and the nodal values:*/
+		input->PatchFill(this_patch,max_vertices,this->parameters);
+		
+		/*Increase counter, so that next time, we don't point to the same patches row: */
+		count++;
+
+		/*Assign output pointers:*/
+		*pcount=count;
+	}
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 3956)
@@ -144,6 +144,6 @@
 		void  GetPhi(double* phi, double*  epsilon, double viscosity);
 		double MassFlux(double* segment,double* ug);
-		void  PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type);
-		void  PatchFill(int* pcount, double* patches,int patch_numcols);
+		void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes,int enum_type);
+		void  PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type);
 
 		/*updates: */
Index: /issm/trunk/src/c/objects/Elements/Sing.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 3956)
@@ -606,12 +606,113 @@
 }
 /*}}}*/
-/*FUNCTION Sing::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){{{1*/
-void  Sing::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){
-	this->inputs->PatchSize(ppatch_numrows,pnumcols,enum_type);
-}
-/*}}}*/
-/*FUNCTION Sing::PatchFill(int* pcount, double* patches,int patch_numcols);{{{1*/
-void  Sing::PatchFill(int* pcount, double* patches,int patch_numcols){
-	this->inputs->PatchFill(pcount,patches,patch_numcols,this->parameters);
-}
-/*}}}*/
+/*FUNCTION Sing::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){{{1*/
+void  Sing::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){
+
+	int    i;
+	Input *input       = NULL;
+	bool   found       = false;
+	int    numrows;
+	int    numvertices;
+	int    numnodes;
+
+	/*Recover counter: */
+	numrows=*pnumrows;
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just be sure numvertices and numnodes
+		 * are 0, so that they do not increase the size of the patches array. Also, do not increase 
+		 * the counter, as this element has nothing to do with results: */
+		numvertices=0;
+		numnodes=0;
+	}
+	else{
+		/*Ok, we found an input with the correct enum_type. Ask it to tell us how many nodal values it 
+		 * holds. : */
+		numnodes=input->PatchSize();
+		/*We know the number of vertices from this element: */
+		numvertices=1;
+		/*Increase counter, because this element does hold a result in its inputs: */
+		numrows++;
+	}
+
+	/*Assign output pointers:*/
+	*pnumrows=numrows;
+	*pnumvertices=numvertices;
+	*pnumnodes=numnodes;
+}
+	
+/*FUNCTION Sing::PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type){{{1*/
+void  Sing::PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type){
+
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1       4.5 
+	 2 P1  3       4.5
+	 3 P0  5       5.5
+	 4 P1  4       4.5
+
+	 Here, we will provide the nodal values, after having processed them, can provide: id, and vertices ids. 
+	 Then go find an input with enum_type. If we find it, fill in the values at the nodal points. 
+	 If we don't find an input, get out of here doing nothing, as this element is not involved in 
+	 outputting results. 
+	 */
+
+	int      i;
+	Input   *input      = NULL;
+	bool     found      = false;
+	int      count      = 0;
+	Node   **nodes      = NULL;
+	double  *this_patch = NULL;
+
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just return :*/
+	}
+	else{
+		
+		/*First, recover the patches row where we will plug in the information: */
+		count=*pcount;
+
+		/*Recover nodes: */
+		nodes=(Node**)hnodes.deliverp();
+
+		/*set this_patch to point at the beginning of the patches row, where we will plug our information :*/
+		this_patch=patches+numcols*count;
+
+		/*Fill in id: */
+		this_patch[0]=this->id;
+
+		/*Fill in vertices ids: */
+		for(i=0;i<1;i++) this_patch[2+i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
+
+		/*We found the input, get it to fill the interpolation type, and the nodal values:*/
+		input->PatchFill(this_patch,max_vertices,this->parameters);
+		
+		/*Increase counter, so that next time, we don't point to the same patches row: */
+		count++;
+
+		/*Assign output pointers:*/
+		*pcount=count;
+	}
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Sing.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Sing.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Sing.h	(revision 3956)
@@ -78,6 +78,6 @@
 		void  ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type);
 		void  GetNodes(void** vpnodes);
-		void  PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type);
-		void  PatchFill(int* pcount, double* patches,int patch_numcols);
+		void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes,int enum_type);
+		void  PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 3956)
@@ -4875,12 +4875,111 @@
 }
 /*}}}*/
-/*FUNCTION Tria::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){{{1*/
-void  Tria::PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type){
-	this->inputs->PatchSize(ppatch_numrows,pnumcols,enum_type);
-}
-/*}}}*/
-/*FUNCTION Tria::PatchFill(int* pcount, double* patches,int patch_numcols);{{{1*/
-void  Tria::PatchFill(int* pcount, double* patches,int patch_numcols){
-	this->inputs->PatchFill(pcount,patches,patch_numcols,this->parameters);
-}
-/*}}}*/
+/*FUNCTION Tria::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){{{1*/
+void  Tria::PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes, int enum_type){
+
+	int    i;
+	Input *input       = NULL;
+	bool   found       = false;
+	int    numrows;
+	int    numvertices;
+	int    numnodes;
+
+	/*Recover counter: */
+	numrows=*pnumrows;
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just be sure numvertices and numnodes
+		 * are 0, so that they do not increase the size of the patches array. Also, do not increase 
+		 * the counter, as this element has nothing to do with results: */
+		numvertices=0;
+		numnodes=0;
+	}
+	else{
+		/*Ok, we found an input with the correct enum_type. Ask it to tell us how many nodal values it 
+		 * holds. : */
+		numnodes=input->PatchSize();
+		/*We know the number of vertices from this element: */
+		numvertices=3;
+		/*Increase counter, because this element does hold a result in its inputs: */
+		numrows++;
+	}
+
+	/*Assign output pointers:*/
+	*pnumrows=numrows;
+	*pnumvertices=numvertices;
+	*pnumnodes=numnodes;
+	
+}
+/*}}}*/
+/*FUNCTION Tria::PatchFill(int* pcount, double* patches,int numcols,int max_vertices);{{{1*/
+void  Tria::PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type){
+
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1 2 4       4.5  NaN  NaN 
+	 2 P1  2 4 5       4.5  23.3 23.3
+	 3 P0  5 2 1       5.5  NaN  NaN
+	 4 P1  2 3 5       4.5  30.2 322.2 
+	 ...
+
+	 Here, we can provide: id, and vertices ids. 
+	 Then go find an input with enum_type. If we find it, fill in the values at the nodal points. 
+	 If we don't find an input, get out of here doing nothing, as this element is not involved in 
+	 outputting results. 
+	 */
+
+	int      i;
+	Input   *input      = NULL;
+	bool     found      = false;
+	int      count      = 0;
+	double  *this_patch = NULL;
+
+
+	/*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
+	for (i=0;i<this->inputs->Size();i++){
+		input=(Input*)this->inputs->GetObjectByOffset(i);
+		if (input->EnumType()==enum_type){
+			found=true;
+			break;
+		}
+	}
+
+	if (!found){
+		/*Ok, the input looked for does not exist. No problem. Just return :*/
+	}
+	else{
+		
+		/*First, recover the patches row where we will plug in the information: */
+		count=*pcount;
+
+		/*set this_patch to point at the beginning of the patches row, where we will plug our information :*/
+		this_patch=patches+numcols*count;
+
+		/*Fill in id: */
+		this_patch[0]=this->id;
+
+		/*Fill in vertices ids: */
+		for(i=0;i<3;i++) this_patch[2+i]=this->nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
+
+		/*We found the input, get it to fill the interpolation type, and the nodal values:*/
+		input->PatchFill(this_patch,max_vertices,this->parameters);
+		
+		/*Increase counter, so that next time, we don't point to the same patches row: */
+		count++;
+
+		/*Assign output pointers:*/
+		*pcount=count;
+	}
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 3956)
@@ -122,6 +122,6 @@
 		double GetArea(void);
 		double GetAreaCoordinate(double x, double y, int which_one);
-		void  PatchSize(int* ppatch_numrows,int* pnumcols, int enum_type);
-		void  PatchFill(int* pcount, double* patches,int patch_numcols);
+		void  PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes,int enum_type);
+		void  PatchFill(int* pcount, double* patches,int numcols,int max_vertices,int enum_type);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp	(revision 3956)
@@ -223,15 +223,32 @@
 /*FUNCTION BeamVertexInput::PatchSize(void);{{{1*/
 int BeamVertexInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 2;
 }
 /*}}}*/
-/*FUNCTION BeamVertexInput::PatchFill(double* patches);{{{1*/
-void BeamVertexInput::PatchFill(double* patches,Parameters* parameters){
-	patches[0]=values[0];
-	patches[1]=values[1];
-
-	/*Now, post-processing: */
-	ProcessResults(patches,2,this->enum_type,parameters);
-
-}
-/*}}}*/
+/*FUNCTION BeamVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void BeamVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
+	
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1 2       4.5 NaN 
+	 2 P1  1 3       4.5 3.2
+	 3 P0  1 5       5.5 NaN
+	 4 P1  2 4       4.5 3.2
+
+	 Here, we fill the info relevant to the input, ie interpolation_type and nodal values: */
+	int i;
+
+	patches[1]=P1Enum;
+	for(i=0;i<2;i++)patches[2+max_vertices+i]=values[i]; //start of nodal values is at position 2+max_vertices (2 for id and interpolation_type) and max_vertices for vertices ids.
+
+	/*Now, post-processing (essentially, unit conversion): */
+	ProcessResults(patches+2+max_vertices,2,this->enum_type,parameters);
+
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/BeamVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BeamVertexInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/BeamVertexInput.h	(revision 3956)
@@ -74,5 +74,5 @@
 		void ChangeEnum(int newenumtype);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/BoolInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BoolInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/BoolInput.cpp	(revision 3956)
@@ -213,13 +213,15 @@
 /*FUNCTION BoolInput::PatchSize(void);{{{1*/
 int BoolInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 1;
 }
 /*}}}*/
-/*FUNCTION BoolInput::PatchFill(double* patches);{{{1*/
-void BoolInput::PatchFill(double* patches,Parameters* parameters){
-	patches[0]=(double)value;
-	
-	/*Now, post-processing: */
-	ProcessResults(patches,1,this->enum_type,parameters);
-}
-/*}}}*/
+/*FUNCTION BoolInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void BoolInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
+
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/BoolInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BoolInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/BoolInput.h	(revision 3956)
@@ -74,5 +74,5 @@
 		void ChangeEnum(int newenumtype);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/DoubleInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/DoubleInput.cpp	(revision 3956)
@@ -223,13 +223,15 @@
 /*FUNCTION DoubleInput::PatchSize(void);{{{1*/
 int DoubleInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 1;
 }
 /*}}}*/
-/*FUNCTION DoubleInput::PatchFill(double* patches);{{{1*/
-void DoubleInput::PatchFill(double* patches,Parameters* parameters){
-	patches[0]=value;
-	
-	/*Now, post-processing: */
-	ProcessResults(patches,1,this->enum_type,parameters);
-}
-/*}}}*/
+/*FUNCTION DoubleInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void DoubleInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
+
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/DoubleInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/DoubleInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/DoubleInput.h	(revision 3956)
@@ -74,5 +74,5 @@
 		void ChangeEnum(int newenumtype);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/Input.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/Input.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/Input.h	(revision 3956)
@@ -48,5 +48,5 @@
 		virtual Input* SpawnTriaInput(int* indices)=0;
 		virtual int  PatchSize(void)=0;
-		virtual void PatchFill(double* patches,Parameters* parameters)=0;
+		virtual void PatchFill(double* patch, int max_vertices,Parameters* parameters)=0;
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/IntInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/IntInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/IntInput.cpp	(revision 3956)
@@ -210,14 +210,15 @@
 /*FUNCTION IntInput::PatchSize(void);{{{1*/
 int IntInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 1;
 }
 /*}}}*/
-/*FUNCTION IntInput::PatchFill(double* patches);{{{1*/
-void IntInput::PatchFill(double* patches,Parameters* parameters){
-	patches[0]=(double)value;
-	
-	/*Now, post-processing: */
-	ProcessResults(patches,1,this->enum_type,parameters);
-
-}
-/*}}}*/
+/*FUNCTION IntInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void IntInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
+
+	ISSMERROR(" not supported yet!");
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/IntInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/IntInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/IntInput.h	(revision 3956)
@@ -74,5 +74,5 @@
 		void ChangeEnum(int newenumtype);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp	(revision 3956)
@@ -872,20 +872,37 @@
 /*FUNCTION PentaVertexInput::PatchSize(void);{{{1*/
 int PentaVertexInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 6;
 }
 /*}}}*/
-/*FUNCTION PentaVertexInput::PatchFill(double* patches);{{{1*/
-void PentaVertexInput::PatchFill(double* patches,Parameters* parameters){
-
-	patches[0]=values[0];
-	patches[1]=values[1];
-	patches[2]=values[2];
-	patches[3]=values[3];
-	patches[4]=values[4];
-	patches[5]=values[5];
+/*FUNCTION PentaVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void PentaVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
 	
-	/*Now, post-processing: */
-	ProcessResults(patches,6,this->enum_type,parameters);
-
-}
-/*}}}*/
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1 2 4 11 12 14      4.5  NaN  NaN    NaN NaN NaN
+	 2 P1  2 4 5 12 14 15      4.5  23.3 23.3   4.2 4.2 3.2
+	 3 P0  5 2 1 15 12 11      5.5  NaN  NaN    NaN NaN NaN
+	 4 P1  2 3 5 12 13 15      4.5  30.2 322.2  4.2 3.2 8.3
+	 ...
+	 
+	 Here, we fill the info relevant to the input, ie interpolation_type and nodal values: */
+
+	int i;
+
+
+	patches[1]=P1Enum;
+	for(i=0;i<6;i++)patches[2+max_vertices+i]=values[i]; //start of nodal values is at position 2+max_vertices (2 for id and interpolation_type) and max_vertices for vertices ids.
+
+	/*Now, post-processing (essentially, unit conversion): */
+	ProcessResults(patches+2+max_vertices,6,this->enum_type,parameters);
+
+}
+/*}}}*/
+
+
Index: /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h	(revision 3956)
@@ -83,5 +83,5 @@
 		void GetBStokes(double* B, double* xyz_list, double* gauss_coord);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/ProcessResults.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/ProcessResults.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/ProcessResults.cpp	(revision 3956)
@@ -1,7 +1,7 @@
 /*!\file:  ProcessResults.cpp
- * \brief: process patch that was created by an input, for results purposes.
+ * \brief: process nodal_values that were created by an input.
  * For example, velocities need to be in m/yr, melting rates in m/yr, etc ...
  * This centralizes all post-processing of inputs when they are being output to 
- * patched results.
+ * results.
  *
  */ 
@@ -19,5 +19,5 @@
 #include "../../shared/shared.h"
 
-void ProcessResults(double* patch, int patch_size,int enum_type,Parameters* parameters){
+void ProcessResults(double* nodal_values, int num_nodal_values,int enum_type,Parameters* parameters){
 
 	int i;
@@ -28,8 +28,8 @@
 
 	switch(enum_type){
-		case VxEnum: for(i=0;i<patch_size;i++)patch[i]=patch[i]/yts;break;
-		case VyEnum: for(i=0;i<patch_size;i++)patch[i]=patch[i]/yts;break;
-		case VzEnum: for(i=0;i<patch_size;i++)patch[i]=patch[i]/yts;break;
-		case MeltingRateEnum: for(i=0;i<patch_size;i++)patch[i]=patch[i]/yts;break;
+		case VxEnum: for(i=0;i<num_nodal_values;i++)nodal_values[i]=nodal_values[i]/yts;break;
+		case VyEnum: for(i=0;i<num_nodal_values;i++)nodal_values[i]=nodal_values[i]/yts;break;
+		case VzEnum: for(i=0;i<num_nodal_values;i++)nodal_values[i]=nodal_values[i]/yts;break;
+		case MeltingRateEnum: for(i=0;i<num_nodal_values;i++)nodal_values[i]=nodal_values[i]/yts;break;
 		default: break;
 	}
Index: /issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp	(revision 3956)
@@ -201,14 +201,32 @@
 /*FUNCTION SingVertexInput::PatchSize(void);{{{1*/
 int SingVertexInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 1;
 }
 /*}}}*/
-/*FUNCTION SingVertexInput::PatchFill(double* patches);{{{1*/
-void SingVertexInput::PatchFill(double* patches,Parameters* parameters){
-	patches[0]=value;
-	
-	/*Now, post-processing: */
-	ProcessResults(patches,1,this->enum_type,parameters);
-
-}
-/*}}}*/
+/*FUNCTION SingVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void SingVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
+	
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0   2       4.5 
+	 2 P1   3       4.5
+	 3 P0   5       5.5 
+	 4 P1   4       4.5 
+
+	 Here, we fill the info relevant to the input, ie interpolation_type and nodal values: */
+	int i;
+
+	patches[1]=P1Enum;
+	patches[2+max_vertices+0]=value; //start of nodal values is at position 2+max_vertices (2 for id and interpolation_type) and max_vertices for vertices ids.
+
+	/*Now, post-processing (essentially, unit conversion): */
+	ProcessResults(patches+2+max_vertices,1,this->enum_type,parameters);
+
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/SingVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/SingVertexInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/SingVertexInput.h	(revision 3956)
@@ -73,5 +73,5 @@
 		void ChangeEnum(int newenumtype);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp	(revision 3956)
@@ -446,18 +446,34 @@
 /*FUNCTION TriaVertexInput::PatchSize(void);{{{1*/
 int TriaVertexInput::PatchSize(void){
+
+	/*Return the number of nodal values this input holds, so that 
+	 * results can be correctl dimensionned. See InputToResultsx 
+	 * module for more explanations: */
 	return 3;
 }
 /*}}}*/
-/*FUNCTION TriaVertexInput::PatchFill(double* patches);{{{1*/
-void TriaVertexInput::PatchFill(double* patches,Parameters* parameters){
-	
-	patches[0]=values[0];
-	patches[1]=values[1];
-	patches[2]=values[2];
-	
-	/*Now, post-processing: */
-	ProcessResults(patches,3,this->enum_type,parameters);
-
-
-}
-/*}}}*/
+/*FUNCTION TriaVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters);{{{1*/
+void TriaVertexInput::PatchFill(double* patches, int max_vertices,Parameters* parameters){
+	
+	/*A patch is made of the following information: 
+	 * element_id  interpolation_type  vertex_ids    values. 
+	 * For example: 
+
+	 1 P0  1 2 4       4.5  NaN  NaN 
+	 2 P1  2 4 5       4.5  23.3 23.3
+	 3 P0  5 2 1       5.5  NaN  NaN
+	 4 P1  2 3 5       4.5  30.2 322.2 
+	 ...
+	 
+	 Here, we fill the info relevant to the input, ie interpolation_type and nodal values: */
+
+	int i;
+
+	patches[1]=P1Enum;
+	for(i=0;i<3;i++)patches[2+max_vertices+i]=values[i]; //start of nodal values is at position 2+max_vertices (2 for id and interpolation_type) and max_vertices for vertices ids.
+
+	/*Now, post-processing (essentially, unit conversion): */
+	ProcessResults(patches+2+max_vertices,3,this->enum_type,parameters);
+
+}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/TriaVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/TriaVertexInput.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Inputs/TriaVertexInput.h	(revision 3956)
@@ -81,5 +81,5 @@
 		void GetJacobianInvert(double*  Jinv, double* xyz_list,double* gauss);
 		int  PatchSize(void);
-		void PatchFill(double* patches,Parameters* parameters);
+		void PatchFill(double* patches, int max_vertices,Parameters* parameters);
 		/*}}}*/
 
Index: /issm/trunk/src/c/objects/Node.cpp
===================================================================
--- /issm/trunk/src/c/objects/Node.cpp	(revision 3955)
+++ /issm/trunk/src/c/objects/Node.cpp	(revision 3956)
@@ -335,4 +335,13 @@
 int    Node::Id(void){ return id; }
 /*}}}*/
+/*FUNCTION Node::GetVertexId {{{2*/
+int   Node::GetVertexId(void){
+
+	Vertex*  vertex=NULL;
+
+	vertex=(Vertex*)hvertex.delivers();
+	return vertex->id;
+}
+/*}}}*/
 /*FUNCTION Node::GetVertexDof {{{2*/
 int   Node::GetVertexDof(void){
Index: /issm/trunk/src/c/objects/Node.h
===================================================================
--- /issm/trunk/src/c/objects/Node.h	(revision 3955)
+++ /issm/trunk/src/c/objects/Node.h	(revision 3956)
@@ -47,4 +47,5 @@
 		int   Id(void); 
 		int   GetVertexDof(void);
+		int   GetVertexId(void);
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
