Index: /issm/trunk-jpl/src/c/bamg/BamgOpts.cpp
===================================================================
--- /issm/trunk-jpl/src/c/bamg/BamgOpts.cpp	(revision 25388)
+++ /issm/trunk-jpl/src/c/bamg/BamgOpts.cpp	(revision 25389)
@@ -77,2 +77,34 @@
 }
 /*}}}*/
+void BamgOpts::Echo(){/*{{{*/
+
+	_printf_("anisomax: "    << this->anisomax<<"\n");
+	_printf_("cutoff: "      << this->cutoff<<"\n");
+	_printf_("coeff: "       << this->coeff<<"\n");
+	_printf_("errg: "        << this->errg<<"\n");
+	_printf_("gradation: "   << this->gradation<<"\n");
+	_printf_("Hessiantype: " << this->Hessiantype<<"\n");
+	_printf_("maxnbv: "      << this->maxnbv<<"\n");
+	_printf_("maxsubdiv: "   << this->maxsubdiv<<"\n");
+	_printf_("Metrictype: "  << this->Metrictype<<"\n");
+	_printf_("nbjacobi: "    << this->nbjacobi<<"\n");
+	_printf_("nbsmooth: "    << this->nbsmooth<<"\n");
+	_printf_("omega: "       << this->omega<<"\n");
+	_printf_("power: "       << this->power<<"\n");
+	_printf_("verbose: "     << this->verbose<<"\n");
+   _printf_("\n"<<"\n");
+	_printf_("Crack: "        << this->Crack<<"\n");
+	_printf_("KeepVertices: " << this->KeepVertices<<"\n");
+	_printf_("splitcorners: " << this->splitcorners<<"\n");
+
+	_printf_("hmin: "<<this->hmin<<"\n");
+	_printf_("hmax: "<<this->hmax<<"\n");
+   _printf_("hVerticesLength: "  << this->hVerticesLength     << "\n");
+   _printf_("hminVerticesSize: " << this->hminVerticesSize[0] << "x"    << this->hminVerticesSize[1] << "\n");
+   _printf_("hmaxVerticesSize: " << this->hmaxVerticesSize[0] << "x"    << this->hmaxVerticesSize[1] << "\n");
+   _printf_("metricSize: "       << this->metricSize[0]       << "x"    << this->metricSize[1]       << "\n");
+   _printf_("fieldSize: "        << this->fieldSize[0]        << "x"    << this->fieldSize[1]        << "\n");
+   _printf_("errSize: "          << this->errSize[0]          << "x"    << this->errSize[1]          << "\n");
+
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/bamg/BamgOpts.h
===================================================================
--- /issm/trunk-jpl/src/c/bamg/BamgOpts.h	(revision 25388)
+++ /issm/trunk-jpl/src/c/bamg/BamgOpts.h	(revision 25389)
@@ -51,4 +51,5 @@
 
 		void Check(void);
+		void Echo(void);
 
 };
Index: /issm/trunk-jpl/src/c/bamg/Mesh.cpp
===================================================================
--- /issm/trunk-jpl/src/c/bamg/Mesh.cpp	(revision 25388)
+++ /issm/trunk-jpl/src/c/bamg/Mesh.cpp	(revision 25389)
@@ -1007,24 +1007,4 @@
 		int Hessiantype=bamgopts->Hessiantype;
 
-		/*Check err, we need to make sure it has the right size!*/
-		if(bamgopts->errSize[0]==1){
-			/*Let's copy this value for all vertices*/
-			double* newerr =  new double[nbv*bamgopts->errSize[1]];
-			for(int i=0;i<nbv;i++){
-				for(int j=0;j<bamgopts->errSize[1];j++){
-					newerr[i*bamgopts->errSize[1]+j] = bamgopts->err[j];
-				}
-			}
-			delete bamgopts->err;
-			bamgopts->err = newerr;
-			bamgopts->errSize[0] = nbv;
-		}
-		else if(bamgopts->errSize[0]==this->nbv){
-			/*Nothing to do, already right size*/
-		}
-		else{
-			_error_("number of rows in 'err' not supported");
-		}
-
 		if (Hessiantype==0){
 			BuildMetric0(bamgopts);
@@ -1758,5 +1738,29 @@
 		}
 
-		//for all Solutions
+		/*Check err, we need to make sure it has the right size!*/
+		bool    deleteerr = false;
+		double* err       = NULL;
+		if(bamgopts->errSize[0]==1){
+			/*Let's copy this value for all vertices*/
+			err =  new double[nbv*bamgopts->errSize[1]];
+			for(int i=0;i<nbv;i++){
+				for(int j=0;j<bamgopts->errSize[1];j++){
+					err[i*bamgopts->errSize[1]+j] = bamgopts->err[j];
+				}
+			}
+			//delete bamgopts->err;
+			//bamgopts->err = newerr;
+			//bamgopts->errSize[0] = nbv;
+			deleteerr = true;
+		}
+		else if(bamgopts->errSize[0]==this->nbv){
+			/*Nothing to do, already right size*/
+			err = bamgopts->err;
+		}
+		else{
+			_error_("number of rows in 'err' not supported: size "<<bamgopts->errSize[0]<<"x"<<bamgopts->errSize[1]<<" (nbv is "<<this->nbv<<")");
+		}
+
+		/*for all Solutions*/
 		for (int nusol=0;nusol<nbsol;nusol++) {
 			double smin=ss[nusol],smax=ss[nusol];
@@ -1838,6 +1842,6 @@
 
 			/*Compute Metric from Hessian*/
-			for ( iv=0;iv<nbv;iv++){
-				vertices[iv].MetricFromHessian(dxdx_vertex[iv],dxdy_vertex[iv],dydy_vertex[iv],smin,smax,ss[iv*nbsol+nusol],bamgopts->err[iv*nbsol+nusol],bamgopts);
+			for(iv=0;iv<nbv;iv++){
+				vertices[iv].MetricFromHessian(dxdx_vertex[iv],dxdy_vertex[iv],dydy_vertex[iv],smin,smax,ss[iv*nbsol+nusol],err[iv*nbsol+nusol],bamgopts);
 			}
 
@@ -1861,4 +1865,5 @@
 		delete [] dxdy_vertex;
 		delete [] dydy_vertex;
+		if(deleteerr) delete [] err;
 	}
 	/*}}}*/
@@ -1967,4 +1972,28 @@
 			//else: the triangle is a boundary triangle -> workT=-1
 			else workT[i]=-1;
+		}
+
+		/*Check err, we need to make sure it has the right size!*/
+		bool    deleteerr = false;
+		double* err       = NULL;
+		if(bamgopts->errSize[0]==1){
+			/*Let's copy this value for all vertices*/
+			err =  new double[nbv*bamgopts->errSize[1]];
+			for(int i=0;i<nbv;i++){
+				for(int j=0;j<bamgopts->errSize[1];j++){
+					err[i*bamgopts->errSize[1]+j] = bamgopts->err[j];
+				}
+			}
+			//delete bamgopts->err;
+			//bamgopts->err = newerr;
+			//bamgopts->errSize[0] = nbv;
+			deleteerr = true;
+		}
+		else if(bamgopts->errSize[0]==this->nbv){
+			/*Nothing to do, already right size*/
+			err = bamgopts->err;
+		}
+		else{
+			_error_("number of rows in 'err' not supported: size "<<bamgopts->errSize[0]<<"x"<<bamgopts->errSize[1]<<" (nbv is "<<this->nbv<<")");
 		}
 
@@ -2163,4 +2192,5 @@
 		delete [] Mmassxx;
 		delete [] OnBoundary;
+		if(deleteerr) delete [] err;
 
 	}
Index: /issm/trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 25388)
+++ /issm/trunk-jpl/src/c/classes/FemModel.cpp	(revision 25389)
@@ -5483,4 +5483,5 @@
 	this->parameters->FindParam(&this->amrbamg->deviatoricerror_groupthreshold,AmrDeviatoricErrorGroupThresholdEnum);
 	this->parameters->FindParam(&this->amrbamg->deviatoricerror_maximum,AmrDeviatoricErrorMaximumEnum);
+
 	/*Set BamgOpts*/
 	this->amrbamg->SetBamgOpts(hmin,hmax,err,gradation);
