Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 5988)
+++ /issm/trunk/src/c/Makefile.am	(revision 5989)
@@ -272,5 +272,4 @@
 					./shared/Elements/GetGlobalDofList.cpp\
 					./shared/Elements/GetNumberOfDofs.cpp\
-					./shared/Elements/NewElementMatrix.cpp\
 					./shared/String/DescriptorIndex.cpp\
 					./shared/String/sharedstring.h\
@@ -831,5 +830,4 @@
 					./shared/Elements/GetGlobalDofList.cpp\
 					./shared/Elements/GetNumberOfDofs.cpp\
-					./shared/Elements/NewElementMatrix.cpp\
 					./shared/String/DescriptorIndex.cpp\
 					./shared/String/sharedstring.h\
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5989)
@@ -2005,6 +2005,6 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke1=NewElementMatrix(pentabase->nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
-	ElementMatrix* Ke2=NewElementMatrix(this->nodes     ,NUMVERTICES,this->parameters,PattynApproximationEnum);
+	ElementMatrix* Ke1=new ElementMatrix(pentabase->nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
+	ElementMatrix* Ke2=new ElementMatrix(this->nodes     ,NUMVERTICES,this->parameters,PattynApproximationEnum);
 	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
 	delete Ke1; delete Ke2;
@@ -2073,6 +2073,6 @@
 
 	/*compute all stiffness matrices for this element*/
-	ElementMatrix* Ke1=NewElementMatrix(this->nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
-	ElementMatrix* Ke2=NewElementMatrix(this->nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
+	ElementMatrix* Ke1=new ElementMatrix(this->nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
+	ElementMatrix* Ke2=new ElementMatrix(this->nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
 	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
 	delete Ke1;
@@ -2141,5 +2141,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Spawn 3 beam elements: */
@@ -2257,5 +2257,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(tria->nodes,NUMVERTICES2D,this->parameters,MacAyealApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(tria->nodes,NUMVERTICES2D,this->parameters,MacAyealApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2373,5 +2373,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2481,5 +2481,5 @@
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 	if(IsOnWater() || (approximation!=StokesApproximationEnum && approximation!=PattynStokesApproximationEnum)) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2549,5 +2549,5 @@
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 	if(IsOnWater() || IsOnShelf() || !IsOnBed() || (approximation!=StokesApproximationEnum && approximation!=PattynStokesApproximationEnum)) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2640,5 +2640,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2781,5 +2781,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5989)
@@ -2425,5 +2425,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all Inputs and parameters: */
@@ -2530,5 +2530,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2597,5 +2597,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2729,5 +2729,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2797,5 +2797,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater() || IsOnShelf()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -2868,6 +2868,6 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater() || IsOnShelf()) return NULL;
-	ElementMatrix* Ke1=NewElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
-	ElementMatrix* Ke2=NewElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
+	ElementMatrix* Ke1=new ElementMatrix(nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
+	ElementMatrix* Ke2=new ElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
 	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
 	delete Ke1; delete Ke2;
@@ -2957,5 +2957,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater() || IsOnShelf()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -3017,5 +3017,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Create Element matrix*/
@@ -3047,5 +3047,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -3097,5 +3097,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -3168,5 +3168,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -3287,5 +3287,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -3362,5 +3362,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	GetVerticesCoordinates(&xyz_list[0][0],nodes,NUMVERTICES);
@@ -3410,5 +3410,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater() || !IsOnShelf()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters,NoneApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
Index: /issm/trunk/src/c/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 5989)
@@ -444,5 +444,5 @@
 	Tria*  tria=(Tria*)element;
 	if(tria->IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES_INTERNAL,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES_INTERNAL,this->parameters);
 
 	/*Retrieve all inputs and parameters*/
@@ -515,5 +515,5 @@
 	Tria*  tria=(Tria*)element;
 	if(tria->IsOnWater()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES_BOUNDARY,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES_BOUNDARY,this->parameters);
 
 	/*Retrieve all inputs and parameters*/
Index: /issm/trunk/src/c/objects/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 5989)
@@ -545,5 +545,5 @@
 	penta->inputs->GetParameterValue(&approximation,ApproximationEnum);
 	if(approximation!=StokesApproximationEnum) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(&node,1,this->parameters,StokesApproximationEnum);
+	ElementMatrix* Ke=new ElementMatrix(&node,1,this->parameters,StokesApproximationEnum);
 
 	/*Retrieve all inputs and parameters*/
@@ -572,5 +572,5 @@
 	/*check that pengrid is not a clone (penalty to be added only once)*/
 	if (node->IsClone()) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(&node,1,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(&node,1,this->parameters);
 
 	/*Retrieve all inputs and parameters*/
@@ -599,5 +599,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(!this->active) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(&node,NUMVERTICES,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(&node,NUMVERTICES,this->parameters);
 
 	/*recover parameters: */
Index: /issm/trunk/src/c/objects/Loads/Penpair.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 5989)
@@ -312,5 +312,5 @@
 
 	/*Initialize Element vector and return if necessary*/
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters);
 
 	/*recover parameters: */
@@ -339,5 +339,5 @@
 
 	/*Initialize Element vector and return if necessary*/
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters);
 
 	/*recover parameters: */
Index: /issm/trunk/src/c/objects/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Riftfront.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Loads/Riftfront.cpp	(revision 5989)
@@ -499,5 +499,5 @@
 	/*Initialize Element Matrix*/
 	if(!this->active) return NULL;
-	ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters);
+	ElementMatrix* Ke=new ElementMatrix(nodes,NUMVERTICES,this->parameters);
 
 	/*Get some parameters: */
Index: /issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp
===================================================================
--- /issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp	(revision 5989)
@@ -188,86 +188,40 @@
 }
 /*}}}*/
-/*FUNCTION ElementMatrix::ElementMatrix(bool square,int* in_gglobaldoflist,int gsize){{{1*/
-ElementMatrix::ElementMatrix(bool square,int* in_gglobaldoflist,int gsize){
-
-	if(square=false)ISSMERROR(" calling square constructor with false square flag!");
-
-	this->nrows=gsize;
-	this->ncols=gsize;
+/*FUNCTION ElementMatrix::ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){{{1*/
+ElementMatrix::ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){
+
+	/*retrieve some parameters: */
+	parameters->FindParam(&kff,KffEnum);
+
+	/*get Matrix size and properties*/
 	this->square=true;
-	this->kff=false;
+	this->nrows=GetNumberOfDofs(nodes,numnodes,GsetEnum,approximation);
+	this->ncols=this->nrows;
 
 	/*fill values with 0: */
 	this->values=(double*)xcalloc(this->nrows*this->ncols,sizeof(double));
-	
-	if(this->nrows){
-		this->gglobaldoflist=(int*)xmalloc(this->nrows*sizeof(int));
-		memcpy(this->gglobaldoflist,in_gglobaldoflist,this->nrows*sizeof(int));
-	}
-	else{
-		this->gglobaldoflist=NULL;
-	}
-
-	/*don't do rows and cols, because kff is false:*/
-	this->row_fsize=0;
-	this->row_flocaldoflist=NULL;
-	this->row_fglobaldoflist=NULL;
-	this->row_ssize=0;
-	this->row_slocaldoflist=NULL;
-	this->row_sglobaldoflist=NULL;
-	
-	this->col_fsize=0;
-	this->col_flocaldoflist=NULL;
-	this->col_fglobaldoflist=NULL;
-	this->col_ssize=0;
-	this->col_slocaldoflist=NULL;
-	this->col_sglobaldoflist=NULL;
-
-}
-/*}}}*/
-/*FUNCTION ElementMatrix::ElementMatrix(bool square,int* in_gglobaldoflist,int gsize,int* flocaldoflist,int* fglobaldoflist,int fsize,int* slocaldoflist,int* sglobaldoflist,int ssize){{{1*/
-ElementMatrix::ElementMatrix(bool square,int* in_gglobaldoflist,int gsize,int* flocaldoflist,int* fglobaldoflist,int fsize,int* slocaldoflist,int* sglobaldoflist,int ssize){
-
-	if(square=false)ISSMERROR(" calling square constructor with false square flag!");
-	ISSMASSERT(gsize);
-
-	this->nrows=gsize;
-	this->ncols=gsize;
-	this->square=true;
-	this->kff=true;
-
-	/*fill values with 0: */
-	this->values=(double*)xcalloc(this->nrows*this->ncols,sizeof(double));
-
-	/*g dofs*/
-	this->gglobaldoflist=(int*)xmalloc(gsize*sizeof(int));
-	memcpy(this->gglobaldoflist,in_gglobaldoflist,gsize*sizeof(int));
-
-	/*row dofs: */
-	this->row_fsize=fsize;
-	if(fsize){
-		this->row_flocaldoflist=(int*)xmalloc(fsize*sizeof(int));
-		this->row_fglobaldoflist=(int*)xmalloc(fsize*sizeof(int));
-		memcpy(this->row_flocaldoflist,flocaldoflist,fsize*sizeof(int));
-		memcpy(this->row_fglobaldoflist,fglobaldoflist,fsize*sizeof(int));
-	}
-	else{
+
+	/*g list*/
+	this->gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation);
+
+	/*get dof lists for f and s set: */
+	if(kff){
+		this->row_fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
+		this->row_flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
+		this->row_fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
+		this->row_ssize=GetNumberOfDofs(nodes,numnodes,SsetEnum,approximation);
+		this->row_slocaldoflist =GetLocalDofList( nodes,numnodes,SsetEnum,approximation);
+		this->row_sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation);
+	}
+	else{
+		this->row_fsize=0;
 		this->row_flocaldoflist=NULL;
 		this->row_fglobaldoflist=NULL;
-	}
-
-	this->row_ssize=ssize;
-	if(ssize){
-		this->row_slocaldoflist=(int*)xmalloc(ssize*sizeof(int));
-		this->row_sglobaldoflist=(int*)xmalloc(ssize*sizeof(int));
-		memcpy(this->row_slocaldoflist,slocaldoflist,ssize*sizeof(int));
-		memcpy(this->row_sglobaldoflist,sglobaldoflist,ssize*sizeof(int));
-	}
-	else{
+		this->row_ssize=0;
 		this->row_slocaldoflist=NULL;
 		this->row_sglobaldoflist=NULL;
 	}
 
-	/*don't do cols, we can pick them up from the rows: */
+	/*Because this matrix is "square" don't do cols, we can pick them up from the rows: */
 	this->col_fsize=0;
 	this->col_flocaldoflist=NULL;
Index: /issm/trunk/src/c/objects/Numerics/ElementMatrix.h
===================================================================
--- /issm/trunk/src/c/objects/Numerics/ElementMatrix.h	(revision 5988)
+++ /issm/trunk/src/c/objects/Numerics/ElementMatrix.h	(revision 5989)
@@ -13,4 +13,6 @@
 #include "../Object.h"
 #include "../../toolkits/toolkits.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+class Node;
 /*}}}*/
 
@@ -52,6 +54,5 @@
 		ElementMatrix(ElementMatrix* Ke1,ElementMatrix* Ke2);
 		ElementMatrix(ElementMatrix* Ke1,ElementMatrix* Ke2,ElementMatrix* Ke3);
-		ElementMatrix(bool square,int* gglobaldoflist,int gsize);
-		ElementMatrix(bool square,int* gglobaldoflist,int gsize,int* flocaldoflist,int* fglobaldoflist,int fsize,int* slocaldoflist,int* sglobaldoflist,int ssize);
+		ElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation=NoneApproximationEnum);
 		~ElementMatrix();
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Numerics/ElementVector.cpp
===================================================================
--- /issm/trunk/src/c/objects/Numerics/ElementVector.cpp	(revision 5988)
+++ /issm/trunk/src/c/objects/Numerics/ElementVector.cpp	(revision 5989)
@@ -137,5 +137,5 @@
 	parameters->FindParam(&this->pf,KffEnum);
 
-	/*get number of dofs in sets g,f and s: */
+	/*get Vector size and properties*/
 	this->nrows=GetNumberOfDofs(nodes,numnodes,GsetEnum,approximation);
 
@@ -143,17 +143,17 @@
 	this->values=(double*)xcalloc(this->nrows,sizeof(double));
 	
+	/*g list*/
+	this->gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation);
+
 	/*Get fsize*/
-	if(pf) fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
-	else   fsize=0;
-
-	/*get dof lists for f and s set: */
-	gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation);
 	if(pf){
-		flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
-		fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
-	}
-	else{
-		flocaldoflist =NULL;
-		fglobaldoflist=NULL;
+		this->fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
+		this->flocaldoflist =GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
+		this->fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
+	}
+	else{
+		this->fsize=0;
+		this->flocaldoflist =NULL;
+		this->fglobaldoflist=NULL;
 	}
 }
Index: sm/trunk/src/c/shared/Elements/NewElementMatrix.cpp
===================================================================
--- /issm/trunk/src/c/shared/Elements/NewElementMatrix.cpp	(revision 5988)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*!\file:  NewElementMatrix.cpp
- * \brief create new element matrix
- */ 
-#include "./elements.h"
-
-ElementMatrix* NewElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation){
-
-	/*parameters: */
-	bool kff=false;
-
-	/*output: */
-	ElementMatrix* Ke=NULL;
-	int gsize;
-	int fsize;
-	int ssize;
-	int* gglobaldoflist=NULL;
-	int* flocaldoflist=NULL;
-	int* fglobaldoflist=NULL;
-	int* slocaldoflist=NULL;
-	int* sglobaldoflist=NULL;
-	bool square=true;
-
-	/*retrieve some parameters: */
-	parameters->FindParam(&kff,KffEnum);
-
-	/*get number of dofs in sets g,f and s: */
-	gsize=GetNumberOfDofs(nodes,numnodes,GsetEnum,approximation);
-	if(kff){
-		fsize=GetNumberOfDofs(nodes,numnodes,FsetEnum,approximation);
-		ssize=GetNumberOfDofs(nodes,numnodes,SsetEnum,approximation);
-	}
-
-	/*get dof lists for f and s set: */
-	gglobaldoflist=GetGlobalDofList(nodes,numnodes,GsetEnum,approximation);
-	if(kff){
-		flocaldoflist= GetLocalDofList( nodes,numnodes,FsetEnum,approximation);
-		fglobaldoflist=GetGlobalDofList(nodes,numnodes,FsetEnum,approximation);
-		slocaldoflist= GetLocalDofList( nodes,numnodes,SsetEnum,approximation);
-		sglobaldoflist=GetGlobalDofList(nodes,numnodes,SsetEnum,approximation);
-	}
-
-	/*constructor for ElementMatrix: */
-	if(!kff) Ke=new ElementMatrix(square,gglobaldoflist,gsize);
-	else     Ke=new ElementMatrix(square,gglobaldoflist,gsize,flocaldoflist,fglobaldoflist,fsize,slocaldoflist,sglobaldoflist,ssize);
-
-	/*Clean-up and return*/
-	xfree((void**)&gglobaldoflist);
-	xfree((void**)&flocaldoflist);
-	xfree((void**)&sglobaldoflist);
-	xfree((void**)&slocaldoflist);
-	xfree((void**)&fglobaldoflist);
-	return Ke;
-}
Index: /issm/trunk/src/c/shared/Elements/elements.h
===================================================================
--- /issm/trunk/src/c/shared/Elements/elements.h	(revision 5988)
+++ /issm/trunk/src/c/shared/Elements/elements.h	(revision 5989)
@@ -11,10 +11,9 @@
 class ElementVector;
 
-double         Paterson(double temperature);
-int            GetVerticesCoordinates(double* xyz,  Node** nodes, int numvertices);
-int            GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum);
-int*           GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum);
-int*           GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation_enum);
-ElementMatrix* NewElementMatrix(Node** nodes,int numnodes,Parameters* parameters,int approximation=NoneApproximationEnum);
+double Paterson(double temperature);
+int    GetVerticesCoordinates(double* xyz,  Node** nodes, int numvertices);
+int    GetNumberOfDofs( Node** nodes,int numnodes,int setenum,int approximation_enum);
+int*   GetLocalDofList( Node** nodes,int numnodes,int setenum,int approximation_enum);
+int*   GetGlobalDofList(Node** nodes,int numnodes,int setenum,int approximation_enum);
 
 inline void printarray(double* array,int lines,int cols=1){
