Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 7369)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 7370)
@@ -539,4 +539,6 @@
 	_assert_(this->nodes && this->matice && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
 	/*}}}*/
+	
+	if(IsOnWater()) return;
 
 	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
@@ -632,13 +634,10 @@
 /*FUNCTION Penta::CreateKMatrixCouplingMacAyealPattyn{{{1*/
 ElementMatrix* Penta::CreateKMatrixCouplingMacAyealPattyn(void){
-
+	
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixCouplingMacAyealPattynViscous();
 	ElementMatrix* Ke2=CreateKMatrixCouplingMacAyealPattynFriction();
-	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
-
-	/*clean-up and return*/
-	delete Ke1;
-	delete Ke2;
+	ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
+	
 	return Ke;
 }
@@ -785,4 +784,5 @@
 	/*Initialize Element matrix and return if necessary*/
 	if(IsOnWater()) return NULL;
+
 	ElementMatrix* Ke1=new ElementMatrix(pentabase->nodes,NUMVERTICES,this->parameters,MacAyealApproximationEnum);
 	ElementMatrix* Ke2=new ElementMatrix(this->nodes     ,NUMVERTICES,this->parameters,StokesApproximationEnum);
@@ -1244,17 +1244,14 @@
 ElementMatrix* Penta::CreateKMatrixDiagnosticPattyn(void){
 	
-	ElementMatrix* Ke =NULL;
 
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixDiagnosticPattynViscous();
 	ElementMatrix* Ke2=CreateKMatrixDiagnosticPattynFriction();
-
-	if(Ke1 || Ke2){
-		 Ke=new ElementMatrix(Ke1,Ke2);
-
-		/*clean-up and return*/
-		delete Ke1;
-		delete Ke2;
-	}
+	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+
+	/*clean-up and return*/
+	delete Ke1;
+	delete Ke2;
+
 	return Ke;
 
@@ -1523,17 +1520,13 @@
 ElementMatrix* Penta::CreateKMatrixDiagnosticVert(void){
 	
-	ElementMatrix* Ke =NULL;
 
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixDiagnosticVertVolume();
 	ElementMatrix* Ke2=CreateKMatrixDiagnosticVertSurface();
-	
-	if(Ke1 || Ke2){
-		 Ke=new ElementMatrix(Ke1,Ke2);
-
-		/*clean-up and return*/
-		delete Ke1;
-		delete Ke2;
-	}
+	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
+
+	/*clean-up and return*/
+	delete Ke1;
+	delete Ke2;
 	return Ke;
 
@@ -1651,17 +1644,12 @@
 ElementMatrix* Penta::CreateKMatrixThermal(void){
 	
-	ElementMatrix* Ke =NULL;
-
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixThermalVolume();
 	ElementMatrix* Ke2=CreateKMatrixThermalShelf();
+	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
 	
-	if(Ke1 || Ke2){
-		 Ke=new ElementMatrix(Ke1,Ke2);
-
-		/*clean-up and return*/
-		delete Ke1;
-		delete Ke2;
-	}
+	/*clean-up and return*/
+	delete Ke1;
+	delete Ke2;
 	return Ke;
 }
@@ -1851,4 +1839,6 @@
 	_assert_(this->nodes && this->matice && this->matpar && this->verticalneighbors && this->parameters && this->inputs);
 	/*}}}*/
+
+	if(IsOnWater()) return;
 
 	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 7369)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 7370)
@@ -387,4 +387,6 @@
 	_assert_(this->nodes && this->matice && this->matpar && this->parameters && this->inputs);
 	/*}}}*/
+	
+	if(IsOnWater()) return;
 
 	/*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */
@@ -756,17 +758,13 @@
 ElementMatrix* Tria::CreateKMatrixDiagnosticMacAyeal(void){
 
-	ElementMatrix* Ke=NULL;
 
 	/*compute all stiffness matrices for this element*/
 	ElementMatrix* Ke1=CreateKMatrixDiagnosticMacAyealViscous();
 	ElementMatrix* Ke2=CreateKMatrixDiagnosticMacAyealFriction();
+	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2);
 	
-	if(Ke1 || Ke2){
-		 Ke=new ElementMatrix(Ke1,Ke2);
-
-		/*clean-up and return*/
-		delete Ke1;
-		delete Ke2;
-	}
+	/*clean-up and return*/
+	delete Ke1;
+	delete Ke2;
 	return Ke;
 
@@ -1523,4 +1521,6 @@
 	_assert_(this->nodes && this->matice && this->matpar && this->parameters && this->inputs);
 	/*}}}*/
+	
+	if(IsOnWater()) return;
 
 	/*Just branch to the correct load generator, according to the type of analysis we are carrying out: */
