Index: /issm/trunk/src/c/objects/Gauss/GaussTria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Gauss/GaussTria.cpp	(revision 5738)
+++ /issm/trunk/src/c/objects/Gauss/GaussTria.cpp	(revision 5739)
@@ -56,5 +56,5 @@
 	weights=(double*)xmalloc(numgauss*sizeof(double));
 
-	/*Reverse grid1 and 2 if necessary*/
+	/*Reverse index1 and 2 if necessary*/
 	if (index1>index2){
 		index3=index1; index1=index2; index2=index3;
@@ -150,4 +150,35 @@
 	coord2=ONETHIRD;
 	coord3=ONETHIRD;
+
+}
+/*}}}*/
+/*FUNCTION GaussTria::GaussEdgeCenter{{{1*/
+void GaussTria::GaussEdgeCenter(int index1,int index2){
+
+	int     index3;
+
+	/*Reverse index1 and 2 if necessary*/
+	if (index1>index2){
+		index3=index1; index1=index2; index2=index3;
+	}
+
+	/*update static arrays*/
+	if (index1==0 && index2==1){
+		coord1=0.5;
+		coord2=0.5;
+		coord3=0.0;
+	}
+	else if (index1==0 && index2==2){
+		coord1=0.5;
+		coord2=0.0;
+		coord3=0.5;
+	}
+	else if (index1==1 && index2==2){
+		coord1=0.0;
+		coord2=0.5;
+		coord3=0.5;
+	}
+	else
+	 ISSMERROR("The 2 indices provided are not supported yet (user provided %i and %i)",index1,index2);
 
 }
Index: /issm/trunk/src/c/objects/Gauss/GaussTria.h
===================================================================
--- /issm/trunk/src/c/objects/Gauss/GaussTria.h	(revision 5738)
+++ /issm/trunk/src/c/objects/Gauss/GaussTria.h	(revision 5739)
@@ -42,4 +42,5 @@
 		void GaussVertex(int iv);
 		void GaussCenter(void);
+		void GaussEdgeCenter(int index1,int index2);
 };
 #endif  /* _GAUSSTRIA_H_ */
Index: /issm/trunk/src/c/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 5738)
+++ /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 5739)
@@ -20,5 +20,6 @@
 
 /*Load macros*/
-#define NUMVERTICES 4
+#define NUMVERTICES_INTERNAL 4
+#define NUMVERTICES_BOUNDARY 2
 #define NDOF1 1
 
@@ -400,20 +401,20 @@
 
 	/* constants*/
-	const int numdof=NDOF1*NUMVERTICES;
+	const int numdof=NDOF1*NUMVERTICES_INTERNAL;
 
 	/* Intermediaries*/
 	int        i,j,ig,index1,index2,analysis_type;
 	double     DL1,DL2,Jdet,dt,vx,vy,UdotN;
-	double     xyz_list[NUMVERTICES][3];
+	double     xyz_list[NUMVERTICES_INTERNAL][3];
 	double     normal[2];
 	double     B[numdof];
 	double     Bprime[numdof];
-	double     Ke_gg1[numdof][numdof];
-	double     Ke_gg2[numdof][numdof];
-	double     Ke_gg[numdof][numdof] = {0.0};
+	double     Ke_g1[numdof][numdof];
+	double     Ke_g2[numdof][numdof];
+	double     Ke[numdof][numdof] = {0.0};
 	int       *doflist = NULL;
 	GaussTria *gauss;
 
-	GetVerticesCoordinates(&xyz_list[0][0], nodes,NUMVERTICES);
+	GetVerticesCoordinates(&xyz_list[0][0], nodes,NUMVERTICES_INTERNAL);
 	GetDofList(&doflist);
 
@@ -454,15 +455,15 @@
 					&DL1,1,1,0,
 					&Bprime[0],1,numdof,0,
-					&Ke_gg1[0][0],0);
+					&Ke_g1[0][0],0);
 		TripleMultiply(&B[0],1,numdof,1,
 					&DL2,1,1,0,
 					&B[0],1,numdof,0,
-					&Ke_gg2[0][0],0);
-
-		for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg1[i][j];
-		for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg2[i][j];
-	}
-
-	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES);
+					&Ke_g2[0][0],0);
+
+		for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke[i][j]+=Ke_g1[i][j];
+		for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke[i][j]+=Ke_g2[i][j];
+	}
+
+	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES);
 	
 	/*Free ressources:*/
@@ -475,74 +476,45 @@
 void  Numericalflux::CreateKMatrixBoundary(Mat Kgg){
 
-	/* local declarations */
-	int             i,j;
-	int analysis_type;
-
-	/* node data: */
-	const int numgrids=2;
-	const int numdof=NDOF1*numgrids;
-	double    xyz_list[numgrids][3];
-	double    normal[2];
-	int*      doflist=NULL;
-
-	/* gaussian points: */
-	int     num_gauss,ig;
-	double* gauss_coords =NULL;
-	double  gauss_coord;
-	double* gauss_weights=NULL;
-	double  gauss_weight;
-
-	/* matrices: */
-	double L[numgrids];
-	double DL;
-	double Ke_gg[numdof][numdof]={0.0};
-	double Ke_gg_gaussian[numdof][numdof];
-	double Jdet;
-
-	/*input parameters for structural analysis (diagnostic): */
-	double vx,vy;
-	double mean_vx;
-	double mean_vy;
-	double UdotN;
-	double dt;
-	int    dofs[1]={0};
-	int    dim;
-
-	/*dynamic objects pointed to by hooks: */
-	Input*  vxaverage_input=NULL;
-	Input*  vyaverage_input=NULL;
-
-	/*Retrieve parameters: */
+	/* constants*/
+	const int numdof=NDOF1*NUMVERTICES_BOUNDARY;
+
+	/* Intermediaries*/
+	int        i,j,ig,index1,index2,analysis_type;
+	double     DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN;
+	double     xyz_list[NUMVERTICES_BOUNDARY][3];
+	double     normal[2];
+	double     L[numdof];
+	double     Ke_g[numdof][numdof];
+	double     Ke[numdof][numdof] = {0.0};
+	int       *doflist = NULL;
+	GaussTria *gauss;
+
+	GetVerticesCoordinates(&xyz_list[0][0],nodes,NUMVERTICES_BOUNDARY);
+
+	/*Retrieve all inputs and parameters we will be needing: */
+	Tria*  tria=(Tria*)element;
+	Input* vxaverage_input=tria->inputs->GetInput(VxEnum);
+	Input* vyaverage_input=tria->inputs->GetInput(VyEnum);
 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&dim,DimEnum);
-
-	/*recover objects from hooks: */
-	Tria* tria=(Tria*)element;
-
-	/*recover parameters: */
-	if (analysis_type==PrognosticAnalysisEnum){
-		parameters->FindParam(&dt,DtEnum);
-	}
-	else if (analysis_type==BalancedthicknessAnalysisEnum || analysis_type==AdjointBalancedthicknessAnalysisEnum){
-		/*No transient term is involved*/
-		dt=1;
-	}
-	else{
-		ISSMERROR("analysis_type %s not supported yet",EnumToString(analysis_type));
-	}
-	
-	/* Get node coordinates and normal vector: */
-	GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
 	GetNormal(&normal[0],xyz_list);
-
-	/*Retrieve all inputs we will be needing: */
-	if(dim==2){
-		vxaverage_input=tria->inputs->GetInput(VxEnum);
-		vyaverage_input=tria->inputs->GetInput(VyEnum);
+	switch(analysis_type){
+		case PrognosticAnalysisEnum:
+			parameters->FindParam(&dt,DtEnum); break;
+		case BalancedthicknessAnalysisEnum: case AdjointBalancedthicknessAnalysisEnum:
+			dt=1; break;/*No transient term is involved*/
+		default:
+			ISSMERROR("analysis_type %s not supported yet",EnumToString(analysis_type));
 	}
 
 	/*Check wether it is an inflow or outflow BC (0 is the middle of the segment)*/
-	this->GetParameterValue(&mean_vx,0.,vxaverage_input);
-	this->GetParameterValue(&mean_vy,0.,vyaverage_input);
+	index1=tria->GetNodeIndex(nodes[0]);
+	index2=tria->GetNodeIndex(nodes[1]);
+
+	gauss=new GaussTria();
+	gauss->GaussEdgeCenter(index1,index2);
+	vxaverage_input->GetParameterValue(&mean_vx,gauss);
+	vyaverage_input->GetParameterValue(&mean_vy,gauss);
+	delete gauss;
+
 	UdotN=mean_vx*normal[0]+mean_vy*normal[1];
 	if (UdotN<=0){
@@ -551,53 +523,33 @@
 	}
 
-	/*Get dof list*/
 	GetDofList(&doflist);
 
-	/* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
-	num_gauss=2;
-	gaussSegment(&gauss_coords, &gauss_weights,num_gauss);
-
 	/* Start  looping on the number of gaussian points: */
-	for (ig=0; ig<num_gauss; ig++){
-
-		/*Pick up the gaussian point: */
-		gauss_weight=gauss_weights[ig];
-		gauss_coord =gauss_coords[ig];
-
-		/* Get Jacobian determinant: */
-		GetJacobianDeterminant(&Jdet,xyz_list,gauss_coord);
-
-		//Get vx, vy and v.n
-		this->GetParameterValue(&vx,gauss_coord,vxaverage_input);
-		this->GetParameterValue(&vy,gauss_coord,vyaverage_input);
-
+	gauss=new GaussTria(index1,index2,2);
+	for(ig=gauss->begin();ig<gauss->end();ig++){
+
+		gauss->GaussPoint(ig);
+
+		tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2);
+
+		vxaverage_input->GetParameterValue(&vx,gauss);
+		vyaverage_input->GetParameterValue(&vy,gauss);
 		UdotN=vx*normal[0]+vy*normal[1];
-
-		/*Get L*/
-		GetL(&L[0],gauss_coord,numdof);
-
-		/*Compute DLs*/
-		DL=gauss_weight*Jdet*dt*UdotN;
-
-		/*Do triple product*/
+		tria->GetSegmentJacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
+		DL=gauss->weight*Jdet*dt*UdotN;
+
 		TripleMultiply(&L[0],1,numdof,1,
 					&DL,1,1,0,
 					&L[0],1,numdof,0,
-					&Ke_gg_gaussian[0][0],0);
-
-		/* Add the Ke_gg_gaussian, and optionally Ke_gg_drag_gaussian onto Ke_gg: */
-		for( i=0; i<numdof; i++) for(j=0;j<numdof;j++) Ke_gg[i][j]+=Ke_gg_gaussian[i][j];
-
-	} // for (ig=0; ig<num_gauss; ig++)
-
-	/*Add Ke_gg to global matrix Kgg: */
-	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke_gg,ADD_VALUES);
-
-	xfree((void**)&gauss_coords);
-	xfree((void**)&gauss_weights);
+					&Ke_g[0][0],0);
+
+		for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke[i][j]+=Ke_g[i][j];
+	} 
+
+	MatSetValues(Kgg,numdof,doflist,numdof,doflist,(const double*)Ke,ADD_VALUES);
 
 	/*Free ressources:*/
+	delete gauss;
 	xfree((void**)&doflist);
-
 }
 /*}}}*/
@@ -613,78 +565,50 @@
 void  Numericalflux::CreatePVectorBoundary(Vec pg){
 
-	/* local declarations */
-	int             i,j;
-	int analysis_type;
-
-	/* node data: */
-	const int numgrids=2;
-	const int numdof=NDOF1*numgrids;
-	double    xyz_list[numgrids][3];
-	double    normal[2];
-	int*      doflist=NULL;
-
-	/* gaussian points: */
-	int     num_gauss,ig;
-	double* gauss_coords =NULL;
-	double  gauss_coord;
-	double* gauss_weights=NULL;
-	double  gauss_weight;
-
-	/* matrices: */
-	double L[numgrids];
-	double DL;
-	double pe_g[numdof]={0.0};
-	double Jdet;
-
-	/*input parameters for structural analysis (diagnostic): */
-	double vx,vy;
-	double mean_vx;
-	double mean_vy;
-	double UdotN;
-	double thickness;
-	double dt;
-	int    dofs[1]={0};
-	int    dim;
-
-	/*dynamic objects pointed to by hooks: */
-	Input*  vxaverage_input=NULL;
-	Input*  vyaverage_input=NULL;
-	Input*  thickness_input=NULL;
-
-	/*recover objects from hooks: */
-	Tria* tria=(Tria*)element;
-
-	/*Retrieve parameters: */
+	/* constants*/
+	const int numdof=NDOF1*NUMVERTICES_BOUNDARY;
+
+	/* Intermediaries*/
+	int        i,j,ig,index1,index2,analysis_type;
+	double     DL,Jdet,dt,vx,vy,mean_vx,mean_vy,UdotN,thickness;
+	double     xyz_list[NUMVERTICES_BOUNDARY][3];
+	double     normal[2];
+	double     L[numdof];
+	double     pe[numdof] = {0.0};
+	int       *doflist = NULL;
+	GaussTria *gauss;
+
+	GetVerticesCoordinates(&xyz_list[0][0],nodes,NUMVERTICES_BOUNDARY);
+
+	/*Retrieve all inputs and parameters we will be needing: */
+	Tria*  tria=(Tria*)element;
+	Input* vxaverage_input=tria->inputs->GetInput(VxEnum); ISSMASSERT(vxaverage_input); 
+	Input* vyaverage_input=tria->inputs->GetInput(VyEnum); ISSMASSERT(vyaverage_input);
+	Input* thickness_input=tria->inputs->GetInput(ThicknessObsEnum);
+
+	/*Here, as it is a forcing, we have H=Hobs by default (for control methods)*/
+	if (!thickness_input){
+		thickness_input=tria->inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input);
+	}
+
 	this->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	parameters->FindParam(&dim,DimEnum);
-
-	/*recover parameters: */
-	if (analysis_type==PrognosticAnalysisEnum){
-		parameters->FindParam(&dt,DtEnum);
-	}
-	else if (analysis_type==BalancedthicknessAnalysisEnum || analysis_type==AdjointBalancedthicknessAnalysisEnum){
-		/*No transient term is involved*/
-		dt=1;
-	}
-	else{
-		ISSMERROR("analysis_type %s not supported yet",EnumToString(analysis_type));
-	}
-	
-	/*Retrieve all inputs we will be needing: */
-	if(dim==2){
-		vxaverage_input=tria->inputs->GetInput(VxEnum);
-		vyaverage_input=tria->inputs->GetInput(VyEnum);
-	}
-	/*Here, as it is a forcing, we have H=Hobs by default (for control methods)*/
-	thickness_input=tria->inputs->GetInput(ThicknessObsEnum);
-	if (!thickness_input) thickness_input=tria->inputs->GetInput(ThicknessEnum);
-
-	/* Get node coordinates and normal vector: */
-	GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids);
 	GetNormal(&normal[0],xyz_list);
+	switch(analysis_type){
+		case PrognosticAnalysisEnum:
+			parameters->FindParam(&dt,DtEnum); break;
+		case BalancedthicknessAnalysisEnum: case AdjointBalancedthicknessAnalysisEnum:
+			dt=1; break;/*No transient term is involved*/
+		default:
+			ISSMERROR("analysis_type %s not supported yet",EnumToString(analysis_type));
+	}
 
 	/*Check wether it is an inflow or outflow BC (0 is the middle of the segment)*/
-	this->GetParameterValue(&mean_vx,0.,vxaverage_input);
-	this->GetParameterValue(&mean_vy,0.,vyaverage_input);
+	index1=tria->GetNodeIndex(nodes[0]);
+	index2=tria->GetNodeIndex(nodes[1]);
+
+	gauss=new GaussTria();
+	gauss->GaussEdgeCenter(index1,index2);
+	vxaverage_input->GetParameterValue(&mean_vx,gauss);
+	vyaverage_input->GetParameterValue(&mean_vy,gauss);
+	delete gauss;
 	UdotN=mean_vx*normal[0]+mean_vy*normal[1];
 	if (UdotN>0){
@@ -693,64 +617,30 @@
 	}
 
-	/*Get dof list*/
 	GetDofList(&doflist);
 
-	/* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
-	num_gauss=2;
-	gaussSegment(&gauss_coords, &gauss_weights,num_gauss);
-
 	/* Start  looping on the number of gaussian points: */
-	for (ig=0; ig<num_gauss; ig++){
-
-		/*Pick up the gaussian point: */
-		gauss_weight=gauss_weights[ig];
-		gauss_coord =gauss_coords[ig];
-
-		/* Get Jacobian determinant: */
-		GetJacobianDeterminant(&Jdet,xyz_list,gauss_coord);
-
-		//Get vx, vy and v.n
-		this->GetParameterValue(&vx,gauss_coord,vxaverage_input);
-		this->GetParameterValue(&vy,gauss_coord,vyaverage_input);
-		this->GetParameterValue(&thickness,gauss_coord,thickness_input);
-
+	gauss=new GaussTria(index1,index2,2);
+	for(ig=gauss->begin();ig<gauss->end();ig++){
+
+		gauss->GaussPoint(ig);
+
+		tria->GetSegmentNodalFunctions(&L[0],gauss,index1,index2);
+
+		vxaverage_input->GetParameterValue(&vx,gauss);
+		vyaverage_input->GetParameterValue(&vy,gauss);
+		thickness_input->GetParameterValue(&thickness,gauss);
 		UdotN=vx*normal[0]+vy*normal[1];
-
-		/*Get L*/
-		GetL(&L[0],gauss_coord,numdof);
-
-		/*Compute DL*/
-		DL= - gauss_weight*Jdet*dt*UdotN*thickness;
-
-		/* Add value into pe_g: */
-		for( i=0; i<numdof; i++) pe_g[i] += DL* L[i];
-
-	} // for (ig=0; ig<num_gauss; ig++)
+		tria->GetSegmentJacobianDeterminant(&Jdet,&xyz_list[0][0],gauss);
+		DL= - gauss->weight*Jdet*dt*UdotN*thickness;
+
+		for(i=0;i<numdof;i++) pe[i] += DL*L[i];
+	}
 
 	/*Add pe_g to global matrix Kgg: */
-	VecSetValues(pg,numdof,doflist,(const double*)pe_g,ADD_VALUES);
-
-	xfree((void**)&gauss_coords);
-	xfree((void**)&gauss_weights);
+	VecSetValues(pg,numdof,doflist,(const double*)pe,ADD_VALUES);
 
 	/*Free ressources:*/
+	delete gauss;
 	xfree((void**)&doflist);
-
-}
-/*}}}*/
-/*FUNCTION Numericalflux::GetB {{{1*/
-void Numericalflux::GetB(double* B, double gauss_coord){
-
-	const int numgrids=4;
-	double l1l4[numgrids];
-
-	/*Get nodal functions: */
-	GetNodalFunctions(&l1l4[0],gauss_coord);
-
-	/*Build B: */
-	B[0] = +l1l4[0];
-	B[1] = +l1l4[1];
-	B[2] = -l1l4[0];
-	B[3] = -l1l4[1];
 }
 /*}}}*/
@@ -797,52 +687,4 @@
 }
 /*}}}*/
-/*FUNCTION Numericalflux::GetJacobianDeterminant{{{1*/
-void Numericalflux::GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord){
-
-	double Jdet,length;
-
-	length=sqrt(pow(xyz_list[1][0] - xyz_list[0][0],2.0) + pow(xyz_list[1][1] - xyz_list[0][1],2.0));
-	Jdet=1.0/2.0*length;
-
-	if(Jdet<0){
-		ISSMERROR(" negative jacobian determinant!");
-	}
-
-	*pJdet=Jdet;
-}
-/*}}}*/
-/*FUNCTION Numericalflux::GetL {{{1*/
-void Numericalflux::GetL(double* L, double gauss_coord, int numdof){
-
-	const int numgrids=4;
-	double l1l4[numgrids];
-
-	/*Check numdof*/
-	ISSMASSERT(numdof==2 || numdof==4);
-
-	/*Get nodal functions: */
-	GetNodalFunctions(&l1l4[0],gauss_coord);
-
-	/*Luild L: */
-	L[0] = l1l4[0];
-	L[1] = l1l4[1];
-	if (numdof==4){
-		L[2] = l1l4[2];
-		L[3] = l1l4[3];
-	}
-}
-/*}}}*/
-/*FUNCTION Numericalflux::GetNodalFunctions{{{1*/
-void Numericalflux::GetNodalFunctions(double* l1l4, double gauss_coord){
-
-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
-
-	l1l4[0]=-0.5*gauss_coord+0.5;
-	l1l4[1]=+0.5*gauss_coord+0.5;
-	l1l4[2]=-0.5*gauss_coord+0.5;
-	l1l4[3]=+0.5*gauss_coord+0.5;
-
-}
-/*}}}*/
 /*FUNCTION Numericalflux::GetNormal {{{1*/
 void Numericalflux:: GetNormal(double* normal,double xyz_list[4][3]){
@@ -862,34 +704,2 @@
 }
 /*}}}*/
-/*FUNCTION Numericalflux::GetParameterValue(double* pvalue, double gauss_coord,int enumtype) {{{1*/
-void Numericalflux::GetParameterValue(double* pvalue, double gauss_coord,int enumtype){
-
-	/*output: */
-	double value;
-
-	/*recover objects from hooks: */
-	Tria* tria=(Tria*)element;
-
-	/*Get value on Element 1*/
-	tria->GetParameterValue(&value,nodes[0],nodes[1],gauss_coord,enumtype);
-
-	/*Assign output pointers:*/
-	*pvalue=value;
-}
-/*}}}*/
-/*FUNCTION Numericalflux::GetParameterValue(double* pvalue, double gauss_coord,Input* input_in) {{{1*/
-void Numericalflux::GetParameterValue(double* pvalue, double gauss_coord,Input* input_in){
-
-	/*output: */
-	double value;
-
-	/*recover objects from hooks: */
-	Tria* tria=(Tria*)element;
-
-	/*Get value on Element 1*/
-	tria->GetParameterValue(&value,nodes[0],nodes[1],gauss_coord,input_in);
-
-	/*Assign output pointers:*/
-	*pvalue=value;
-}
-/*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Numericalflux.h
===================================================================
--- /issm/trunk/src/c/objects/Loads/Numericalflux.h	(revision 5738)
+++ /issm/trunk/src/c/objects/Loads/Numericalflux.h	(revision 5739)
@@ -72,12 +72,6 @@
 		/*}}}*/
 		/*Numericalflux management:{{{1*/
-		void  GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord);
-		void  GetNodalFunctions(double* l1l4, double gauss_coord);
-		void  GetB(double* B, double gauss_coord);
-		void  GetL(double* L, double gauss_coord,int numdof);
 		void  GetDofList(int** pdoflist);
 		void  GetNormal(double* normal,double xyz_list[4][3]);
-		void  GetParameterValue(double* pvalue, double gauss_coord,int enumtype);
-		void  GetParameterValue(double* pvalue, double gauss_coord,Input* input_in);
 		void  CreateKMatrixInternal(Mat Kgg);
 		void  CreateKMatrixBoundary(Mat Kgg);
