Index: /issm/trunk/src/c/objects/Matice.cpp
===================================================================
--- /issm/trunk/src/c/objects/Matice.cpp	(revision 3508)
+++ /issm/trunk/src/c/objects/Matice.cpp	(revision 3509)
@@ -52,15 +52,34 @@
  
 	/*Compute B on the element if provided*/
-	if (iomodel->B){
+	if (num_vertices==3 || num_vertices==6){
+		if (iomodel->B){
+			B_avg=0;
+			for(j=0;j<num_vertices;j++){
+				B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1));
+			}
+			B_avg=B_avg/num_vertices;
+		}
+	}
+	else if (num_vertices==1 || num_vertices==2){
 		B_avg=0;
-		for(j=0;j<num_vertices;j++){
-			B_avg+=*(iomodel->B+((int)*(iomodel->elements+num_vertices*i+j)-1));
+		if (iomodel->B){
+			B_avg+=*(iomodel->B+i);
 		}
 		B_avg=B_avg/num_vertices;
 	}
+	else ISSMERROR("num_vertices = %i not supported yet",num_vertices);
 	
 	if (iomodel->B) matice_B=B_avg;
 	else            matice_B=UNDEF;
-	if (iomodel->n) matice_n=(double)*(iomodel->n+i);
+	if (iomodel->n){
+		if (num_vertices==3 || num_vertices==6){
+			matice_n=(double)*(iomodel->n+i);
+		}
+		else if (num_vertices==1 || num_vertices==2){
+			/*n is on the elements for now, so just take the first one*/
+			matice_n=(double)*(iomodel->n);
+		}
+		else ISSMERROR("num_vertices = %i not supported yet",num_vertices);
+	}
 	else            matice_n=UNDEF;
 
Index: /issm/trunk/src/c/objects/Matpar.cpp
===================================================================
--- /issm/trunk/src/c/objects/Matpar.cpp	(revision 3508)
+++ /issm/trunk/src/c/objects/Matpar.cpp	(revision 3509)
@@ -34,7 +34,7 @@
 Matpar::Matpar(IoModel* iomodel){
 
-	int	matpar_mid;
-	double	matpar_rho_ice;
-	double	matpar_rho_water;
+	int	  matpar_mid;
+	double  matpar_rho_ice;
+	double  matpar_rho_water;
 	double  matpar_heatcapacity;
 	double  matpar_thermalconductivity;
@@ -46,5 +46,13 @@
 	double  matpar_g;
 
-	matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials
+	if (iomodel->analysis_type==DiagnosticAnalysisEnum() && iomodel->sub_analysis_type==HutterAnalysisEnum()){
+		if (strcmp(iomodel->meshtype,"2d")==0){
+			matpar_mid=iomodel->numberofvertices+1; //put it at the end of the materials
+		}
+		else{ matpar_mid=iomodel->numberofvertices2d*(iomodel->numlayers-1)+1;}
+	}
+	else{
+		matpar_mid=iomodel->numberofelements+1; //put it at the end of the materials
+	}
 	matpar_g=iomodel->g; 
 	matpar_rho_ice=iomodel->rho_ice; 
