Index: /issm/trunk/src/c/objects/Numericalflux.cpp
===================================================================
--- /issm/trunk/src/c/objects/Numericalflux.cpp	(revision 3644)
+++ /issm/trunk/src/c/objects/Numericalflux.cpp	(revision 3645)
@@ -53,4 +53,97 @@
 	/*point parameters: */
 	this->parameters=numericalflux_parameters;
+}
+/*}}}*/
+/*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel) {{{1*/
+Numericalflux::Numericalflux(int numericalflux_id,int i, IoModel* iomodel){
+
+	/* Intermediary */
+	int  e1,e2;
+	int  i1,i2;
+	int  pos1,pos2;
+	int  num_nodes;
+	int  num_elems;
+
+	/*numericalflux constructor data: */
+	int   numericalflux_elem_ids[2];
+	int   numericalflux_mparid;
+	int   numericalflux_node_ids[4];
+	int   numericalflux_type;
+
+	/* Get MatPar id */
+	numericalflux_mparid=iomodel->numberofelements+1; //matlab indexing
+
+	/*Get left and right elements*/
+	e1=(double)iomodel->edges[4*i+2]; //edges are [node1 node2 elem1 elem2]
+	e2=(double)iomodel->edges[4*i+3]; //edges are [node1 node2 elem1 elem2]
+	if (isnan(e2)){
+		/* Boundary edge, only one element */
+		num_elems=1;
+		num_nodes=2;
+		numericalflux_type=BoundaryEnum;
+		numericalflux_elem_ids[0]=(int)e1;
+	}
+	else{
+		/* internal edge: connected to 2 elements */
+		num_elems=2;
+		num_nodes=4;
+		numericalflux_type=InternalEnum;
+		numericalflux_elem_ids[0]=(int)e1;
+		numericalflux_elem_ids[1]=(int)e2;
+	}
+
+	/*1: Get vertices ids*/
+	i1=(int)iomodel->edges[4*i+0];
+	i2=(int)iomodel->edges[4*i+1];
+
+	if (numericalflux_type==InternalEnum){
+
+		/*Now, we must get the nodes of the 4 nodes located on the edge*/
+
+		/*2: Get the column where these ids are located in the index*/
+		pos1=pos2=UNDEF;
+		for(j=0;j<3;j++){
+			if (iomodel->elements[3*(int)e1+j]==i1) pos1=j+1;
+			if (iomodel->elements[3*(int)e2+j]==i1) pos2=j+1;
+		}
+		ISSMASSERT(pos1!=UNDEF && pos2!=UNDEF);
+
+		/*3: We have the id of the elements and the position of the vertices in the index
+		 * we can compute their dofs!*/
+		numericalflux_node_ids[0]=3*(int)e1+pos1;       //ex: 1 2 3
+		numericalflux_node_ids[1]=3*(int)e1+(pos1%3)+1; //ex: 2 3 1
+		numericalflux_node_ids[2]=3*(int)e2+pos2;           //ex: 1 2 3
+		numericalflux_node_ids[3]=3*(int)e2+((pos2+1)%3)+1; //ex: 3 1 2
+	}
+	else{
+
+		/*2: Get the column where these ids are located in the index*/
+		pos1==UNDEF;
+		for(j=0;j<3;j++){
+			if (iomodel->elements[3*(int)e1+j]==i1) pos1=j+1;
+		}
+		ISSMASSERT(pos1!=UNDEF);
+
+		/*3: We have the id of the elements and the position of the vertices in the index
+		 * we can compute their dofs!*/
+		numericalflux_node_ids[0]=3*(int)e1+pos1;
+		numericalflux_node_ids[1]=3*(int)e1+(pos1%3)+1;
+
+	}
+
+	/*Ok, we have everything to build the object: */
+	this->id=numericalflux_id;
+
+	/*Hooks: */
+	this->hnodes.Init(numericalflux_node_ids,num_nodes);
+	this->helements.Init(&numericalflux_elem_ids,num_elems);
+	this->hmatpar.Init(&numericalflux_mparid,1);
+
+	//intialize  and add as many inputs per element as requested: 
+	this->inputs=new Inputs();
+	this->inputs->AddInput(new IntInput(TypeEnum,numericalflux_type));
+
+	//this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
+	this->parameters=NULL;
 }
 /*}}}*/
