Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5872)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5873)
@@ -2194,14 +2194,9 @@
 			break;
 		case MacAyealPattynApproximationEnum:
-			Ke=CreateKMatrixDiagnosticMacAyeal3d();
-			if(Ke) Ke->AddToGlobal(Kgg,NULL,NULL);
-			delete Ke;
-			Ke=CreateKMatrixDiagnosticPattyn();
-			if(Ke) Ke->AddToGlobal(Kgg,NULL,NULL);
-			delete Ke;
-			Ke=CreateKMatrixCouplingMacAyealPattyn();
+			Ke=CreateKMatrixDiagnosticMacAyealPattyn();
 			if(Ke) Ke->AddToGlobal(Kgg,NULL,NULL);
 			delete Ke;
 			break;
+
 		case PattynStokesApproximationEnum:
 			Ke=CreateKMatrixDiagnosticPattyn();
@@ -2416,4 +2411,20 @@
 
 	/*clean-up and return*/
+	return Ke;
+}
+/*}}}*/
+/*FUNCTION Penta::CreateKMatrixDiagnosticMacAyealPattyn{{{1*/
+ElementMatrix* Penta::CreateKMatrixDiagnosticMacAyealPattyn(void){
+
+	/*compute all stiffness matrices for this element*/
+	ElementMatrix* Ke1=CreateKMatrixDiagnosticMacAyeal3d();
+	ElementMatrix* Ke2=CreateKMatrixDiagnosticPattyn();
+	ElementMatrix* Ke3=CreateKMatrixCouplingMacAyealPattyn();
+	ElementMatrix* Ke =new ElementMatrix(Ke1,Ke2,Ke3);
+
+	/*clean-up and return*/
+	delete Ke1;
+	delete Ke2;
+	delete Ke3;
 	return Ke;
 }
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 5872)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 5873)
@@ -133,4 +133,5 @@
 		ElementMatrix* CreateKMatrixDiagnosticMacAyeal3dViscous(void);
 		ElementMatrix* CreateKMatrixDiagnosticMacAyeal3dFriction(void);
+		ElementMatrix* CreateKMatrixDiagnosticMacAyealPattyn(void);
 		ElementMatrix* CreateKMatrixDiagnosticPattyn(void);
 		ElementMatrix* CreateKMatrixDiagnosticPattynViscous(void);
Index: /issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp
===================================================================
--- /issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp	(revision 5872)
+++ /issm/trunk/src/c/objects/Numerics/ElementMatrix.cpp	(revision 5873)
@@ -171,4 +171,19 @@
 	/*clean-up*/
 	xfree((void**)&P);
+}
+/*}}}*/
+/*FUNCTION ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2,ElementMatrix* Ke3){{{1*/
+ElementMatrix::ElementMatrix(ElementMatrix* Ke1, ElementMatrix* Ke2,ElementMatrix* Ke3){
+
+	/*Concatenate all matrices*/
+	ElementMatrix* Ke12 =new ElementMatrix(Ke1,Ke2);
+	ElementMatrix* Ke123=new ElementMatrix(Ke12,Ke3);
+
+	/*Initialize current object with this matrix*/
+	this->Init(Ke123);
+
+	/*clean-up*/
+	delete Ke12;
+	delete Ke123;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Numerics/ElementMatrix.h
===================================================================
--- /issm/trunk/src/c/objects/Numerics/ElementMatrix.h	(revision 5872)
+++ /issm/trunk/src/c/objects/Numerics/ElementMatrix.h	(revision 5873)
@@ -51,4 +51,5 @@
 		ElementMatrix();
 		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);
