Index: /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17182)
+++ /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.cpp	(revision 17183)
@@ -64,6 +64,15 @@
 
 	/*Intermediaries */
+	int         meshtype,dim;
 	IssmDouble  Jdet,D;
 	IssmDouble *xyz_list = NULL;
+
+	/*Get dimension*/
+	element->FindParam(&meshtype,MeshTypeEnum);
+	switch(meshtype){
+		case Mesh2DverticalEnum: dim = 2; break;
+		case Mesh3DEnum:         dim = 3; break;
+		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+	}
 
 	/*Fetch number of nodes and dof for this finite element*/
@@ -85,5 +94,5 @@
 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
 		element->NodalFunctions(Bprime,gauss);
-		GetB(B,element,xyz_list,gauss);
+		GetB(B,element,dim,xyz_list,gauss);
 		D=gauss->weight*Jdet;
 
@@ -187,5 +196,5 @@
 	return NULL;
 }/*}}}*/
-void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+void ExtrudeFromBaseAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
 		where hi is the interpolation function for node i.*/
@@ -195,10 +204,10 @@
 
 	/*Get nodal functions derivatives*/
-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
 
 	/*Build B: */
 	for(int i=0;i<numnodes;i++){
-		B[i] = dbasis[1*numnodes+i];  
+		B[i] = dbasis[(dim-1)*numnodes+i];
 	}
 
Index: /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h
===================================================================
--- /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17182)
+++ /issm/trunk-jpl/src/c/analyses/ExtrudeFromBaseAnalysis.h	(revision 17183)
@@ -29,5 +29,5 @@
 		ElementMatrix* CreateKMatrixBed(Element* element);
 		ElementVector* CreatePVector(Element* element);
-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
Index: /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17182)
+++ /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.cpp	(revision 17183)
@@ -64,6 +64,15 @@
 
 	/*Intermediaries */
+	int         meshtype,dim;
 	IssmDouble  Jdet,D;
 	IssmDouble *xyz_list = NULL;
+
+	/*Get dimension*/
+	element->FindParam(&meshtype,MeshTypeEnum);
+	switch(meshtype){
+		case Mesh2DverticalEnum: dim = 2; break;
+		case Mesh3DEnum:         dim = 3; break;
+		default: _error_("mesh "<<EnumToStringx(meshtype)<<" not supported yet");
+	}
 
 	/*Fetch number of nodes and dof for this finite element*/
@@ -85,5 +94,5 @@
 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
 		element->NodalFunctions(Bprime,gauss);
-		GetB(B,element,xyz_list,gauss);
+		GetB(B,element,dim,xyz_list,gauss);
 		D=gauss->weight*Jdet;
 
@@ -187,5 +196,5 @@
 	return NULL;
 }/*}}}*/
-void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+void ExtrudeFromTopAnalysis::GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
 	/*	Compute B  matrix. B=[dh1/dz dh2/dz dh3/dz dh4/dz dh5/dz dh6/dz];
 		where hi is the interpolation function for node i.*/
@@ -195,10 +204,10 @@
 
 	/*Get nodal functions derivatives*/
-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+	IssmDouble* dbasis=xNew<IssmDouble>(dim*numnodes);
 	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
 
 	/*Build B: */
 	for(int i=0;i<numnodes;i++){
-		B[i] = dbasis[1*numnodes+i];  
+		B[i] = dbasis[(dim-1)*numnodes+i];
 	}
 
Index: /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h
===================================================================
--- /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17182)
+++ /issm/trunk-jpl/src/c/analyses/ExtrudeFromTopAnalysis.h	(revision 17183)
@@ -29,5 +29,5 @@
 		ElementMatrix* CreateKMatrixBed(Element* element);
 		ElementVector* CreatePVector(Element* element);
-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+		void GetB(IssmDouble* B,Element* element,int dim,IssmDouble* xyz_list,Gauss* gauss);
 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
