Index: /issm/trunk/src/c/modules/Bamgx/Bamgx.cpp
===================================================================
--- /issm/trunk/src/c/modules/Bamgx/Bamgx.cpp	(revision 5186)
+++ /issm/trunk/src/c/modules/Bamgx/Bamgx.cpp	(revision 5187)
@@ -116,9 +116,9 @@
 
 		// change using hVertices if provided
-		if (bamgmesh_in->hVertices){
+		if(bamgopts->hVertices && bamgopts->hVerticesSize[0]==BTh.nbv){
 			if (verbosity>1) printf("   Merging Metric with hVertices...\n");
 			for (i=0;i<BTh.nbv;i++){
-				if (!isnan(bamgmesh_in->hVertices[i])){
-					BTh[i].m=Metric((float)bamgmesh_in->hVertices[i]);
+				if (!isnan(bamgopts->hVertices[i])){
+					BTh[i].m=Metric((float)bamgopts->hVertices[i]);
 				}
 			}
Index: /issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
===================================================================
--- /issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	(revision 5186)
+++ /issm/trunk/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	(revision 5187)
@@ -82,5 +82,5 @@
 			//Get current point coordinates
 			r.x=x_interp[i]; r.y=y_interp[i];
-			I2 I=Th.toI2(r);
+			I2 I=Th.R2ToI2(r);
 
 			//Find triangle holding r/I
Index: /issm/trunk/src/c/objects/Bamg/BamgGeom.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/BamgGeom.cpp	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/BamgGeom.cpp	(revision 5187)
@@ -9,6 +9,4 @@
 	this->VerticesSize[0]=0,          this->VerticesSize[1]=0;          this->Vertices=NULL;
 	this->EdgesSize[0]=0,             this->EdgesSize[1]=0;             this->Edges=NULL;
-	this->hVertices=NULL;
-	this->MetricVertices=NULL;
 	this->TangentAtEdgesSize[0]=0,    this->TangentAtEdgesSize[1]=0;    this->TangentAtEdges=NULL;
 	this->CornersSize[0]=0,           this->CornersSize[1]=0;           this->Corners=NULL;
@@ -24,10 +22,6 @@
 BamgGeom::BamgGeom(mxArray* matlab_struct){
 
-	int lines,cols;
-
 	FetchData(&this->Vertices,        &this->VerticesSize[0],        &this->VerticesSize[1],        mxGetField(matlab_struct,0,"Vertices"));
 	FetchData(&this->Edges,           &this->EdgesSize[0],           &this->EdgesSize[1],           mxGetField(matlab_struct,0,"Edges"));
-	FetchData(&this->hVertices,&lines,&cols,mxGetField(matlab_struct,0,"hVertices"));
-	this->MetricVertices=NULL;
 	this->TangentAtEdgesSize[0]=0,    this->TangentAtEdgesSize[1]=0;    this->TangentAtEdges=NULL;
 	FetchData(&this->Corners,         &this->CornersSize[0],         &this->CornersSize[1],         mxGetField(matlab_struct,0,"Corners"));
@@ -36,7 +30,4 @@
 	FetchData(&this->CrackedEdges,    &this->CrackedEdgesSize[0],    &this->CrackedEdgesSize[1],    mxGetField(matlab_struct,0,"CrackedEdges"));
 	FetchData(&this->SubDomains,      &this->SubDomainsSize[0],      &this->SubDomainsSize[1],      mxGetField(matlab_struct,0,"SubDomains"));
-
-	/*Some checks*/
-	if (this->hVertices && (cols!=1 || lines!=this->VerticesSize[0])){ISSMERROR("the size of 'hVertices' should be [%i %i]",this->VerticesSize[0],1);}
 
 }
@@ -48,6 +39,4 @@
 	xfree((void**)&this->Vertices);
 	xfree((void**)&this->Edges);
-	xfree((void**)&this->hVertices);
-	xfree((void**)&this->MetricVertices);
 	xfree((void**)&this->TangentAtEdges);
 	xfree((void**)&this->Corners);
Index: /issm/trunk/src/c/objects/Bamg/BamgGeom.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/BamgGeom.h	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/BamgGeom.h	(revision 5187)
@@ -16,6 +16,4 @@
 		int     EdgesSize[2];
 		double* Edges;
-		double* hVertices;
-		double* MetricVertices;
 		int     TangentAtEdgesSize[2];
 		double* TangentAtEdges;
Index: /issm/trunk/src/c/objects/Bamg/BamgMesh.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/BamgMesh.cpp	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/BamgMesh.cpp	(revision 5187)
@@ -20,6 +20,4 @@
 	this->VerticesOnGeometricEdgeSize[0]=0,   this->VerticesOnGeometricEdgeSize[1]=0;  this->VerticesOnGeometricEdge=NULL;
 	this->EdgesOnGeometricEdgeSize[0]=0,      this->EdgesOnGeometricEdgeSize[1]=0;     this->EdgesOnGeometricEdge=NULL;
-
-	this->hVertices=NULL;
 
 	this->IssmEdgesSize[0]=0,                 this->IssmEdgesSize[1]=0;                this->IssmEdges=NULL;
@@ -53,6 +51,4 @@
 	FetchData(&this->EdgesOnGeometricEdge,     &this->EdgesOnGeometricEdgeSize[0],     &this->EdgesOnGeometricEdgeSize[1],     mxGetField(matlab_struct,0,"EdgesOnGeometricEdge"));
 
-	FetchData(&this->hVertices,                &lines,                                 &cols,                                  mxGetField(matlab_struct,0,"hVertices"));
-
 	this->IssmEdgesSize[0]=0,                 this->IssmEdgesSize[1]=0;                this->IssmEdges=NULL;
 	FetchData(&this->IssmSegments,             &this->IssmSegmentsSize[0],             &this->IssmSegmentsSize[1],             mxGetField(matlab_struct,0,"IssmSegments"));
@@ -61,7 +57,4 @@
 	this->NodalConnectivitySize[0]=0,         this->NodalConnectivitySize[1]=0;        this->NodalConnectivity=NULL;
 	this->NodalElementConnectivitySize[0]=0,  this->NodalElementConnectivitySize[1]=0; this->NodalElementConnectivity=NULL;
-
-	/*Checks*/
-	if (this->hVertices && (cols!=1 || lines!=this->VerticesSize[0])){ISSMERROR("the size of 'hVertices' should be [%i %i]",this->VerticesSize[0],1);}
 
 }
@@ -84,6 +77,4 @@
 	xfree((void**)&this->VerticesOnGeometricEdge);
 	xfree((void**)&this->EdgesOnGeometricEdge);
-
-	xfree((void**)&this->hVertices);
 
 	xfree((void**)&this->IssmEdges);
Index: /issm/trunk/src/c/objects/Bamg/BamgMesh.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/BamgMesh.h	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/BamgMesh.h	(revision 5187)
@@ -38,6 +38,4 @@
 		double* CrackedEdges;
 
-		double* hVertices;
-
 		/*Output for ISSM*/
 		int     IssmEdgesSize[2];
Index: /issm/trunk/src/c/objects/Bamg/BamgOpts.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/BamgOpts.cpp	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/BamgOpts.cpp	(revision 5187)
@@ -9,31 +9,33 @@
 BamgOpts::BamgOpts(){
 
+	this->anisomax=0;
+	this->cutoff=0;
+	this->coeff=0;
+	this->errg=0;
+	this->gradation=0;
+	this->Hessiantype=0;
+	this->MaxCornerAngle=0;
 	this->maxnbv=0;
-	this->MaxCornerAngle=0;
+	this->maxsubdiv=0;
+	this->Metrictype=0;
+	this->nbjacobi=0;
+	this->nbsmooth=0;
+	this->omega=0;
+	this->power=0;
+	this->verbose=0;
+
 	this->Crack=0;
-	this->Hessiantype=0;
-	this->Metrictype=0;
+	this->geometricalmetric=0;
 	this->KeepVertices=0;
-	this->maxsubdiv=0;
-	this->power=0;
-	this->anisomax=0;
-	this->nbsmooth=0;
-	this->nbjacobi=0;
-	this->omega=0;
+	this->splitcorners=0;
+
 	this->hmin=0;
 	this->hmax=0;
-	this->hminVertices=NULL;
-	this->hmaxVertices=NULL;
-	this->gradation=0;
-	this->cutoff=0;
-	this->splitcorners=0;
-	this->geometricalmetric=0;
-	this->verbose=0;
-	this->err=NULL;
-	this->errg=0;
-	this->coeff=0;
-	this->metric=NULL;
-	this->field=NULL;
-	this->numfields=0;
+	this->hminVertices=NULL; this->hminVerticesSize[0]=this->hminVerticesSize[1]=0;
+	this->hmaxVertices=NULL; this->hmaxVerticesSize[0]=this->hmaxVerticesSize[1]=0;
+	this->hVertices=NULL;    this->hVerticesSize[0]=this->hVerticesSize[1]=0;
+	this->metric=NULL;       this->metricSize[0]=this->metricSize[1]=0;
+	this->field=NULL;        this->fieldSize[0]=this->fieldSize[1]=0;
+	this->err=NULL;          this->errSize[0]=this->errSize[1]=0;
 
 }
@@ -43,33 +45,33 @@
 BamgOpts::BamgOpts(mxArray* matlab_struct){
 
-	int lines,cols;
+	FetchData(&this->anisomax,mxGetField(matlab_struct,0,"anisomax"));
+	FetchData(&this->cutoff,mxGetField(matlab_struct,0,"cutoff"));
+	FetchData(&this->coeff,mxGetField(matlab_struct,0,"coeff"));
+	FetchData(&this->errg,mxGetField(matlab_struct,0,"errg"));
+	FetchData(&this->gradation,mxGetField(matlab_struct,0,"gradation"));
+	FetchData(&this->Hessiantype,mxGetField(matlab_struct,0,"Hessiantype"));
+	FetchData(&this->MaxCornerAngle,mxGetField(matlab_struct,0,"MaxCornerAngle"));
+	FetchData(&this->maxnbv,mxGetField(matlab_struct,0,"maxnbv"));
+	FetchData(&this->maxsubdiv,mxGetField(matlab_struct,0,"maxsubdiv"));
+	FetchData(&this->Metrictype,mxGetField(matlab_struct,0,"Metrictype"));
+	FetchData(&this->nbjacobi,mxGetField(matlab_struct,0,"nbjacobi"));
+	FetchData(&this->nbsmooth,mxGetField(matlab_struct,0,"nbsmooth"));
+	FetchData(&this->omega,mxGetField(matlab_struct,0,"omega"));
+	FetchData(&this->power,mxGetField(matlab_struct,0,"power"));
+	FetchData(&this->verbose,mxGetField(matlab_struct,0,"verbose"));
 
-	FetchData(&this->maxnbv,mxGetField(matlab_struct,0,"maxnbv"));
-	FetchData(&this->MaxCornerAngle,mxGetField(matlab_struct,0,"MaxCornerAngle"));
 	FetchData(&this->Crack,mxGetField(matlab_struct,0,"Crack"));
-	FetchData(&this->Hessiantype,mxGetField(matlab_struct,0,"Hessiantype"));
-	FetchData(&this->Metrictype,mxGetField(matlab_struct,0,"Metrictype"));
+	FetchData(&this->geometricalmetric,mxGetField(matlab_struct,0,"geometricalmetric"));
 	FetchData(&this->KeepVertices,mxGetField(matlab_struct,0,"KeepVertices"));
-	FetchData(&this->maxsubdiv,mxGetField(matlab_struct,0,"maxsubdiv"));
-	FetchData(&this->power,mxGetField(matlab_struct,0,"power"));
-	FetchData(&this->anisomax,mxGetField(matlab_struct,0,"anisomax"));
-	FetchData(&this->nbsmooth,mxGetField(matlab_struct,0,"nbsmooth"));
-	FetchData(&this->nbjacobi,mxGetField(matlab_struct,0,"nbjacobi"));
-	FetchData(&this->omega,mxGetField(matlab_struct,0,"omega"));
+	FetchData(&this->splitcorners,mxGetField(matlab_struct,0,"splitcorners"));
+
 	FetchData(&this->hmin,mxGetField(matlab_struct,0,"hmin"));
 	FetchData(&this->hmax,mxGetField(matlab_struct,0,"hmax"));
-	FetchData(&this->hminVertices,&lines,&cols,mxGetField(matlab_struct,0,"hminVertices"));
-	FetchData(&this->hmaxVertices,&lines,&cols,mxGetField(matlab_struct,0,"hmaxVertices"));
-	FetchData(&this->gradation,mxGetField(matlab_struct,0,"gradation"));
-	FetchData(&this->cutoff,mxGetField(matlab_struct,0,"cutoff"));
-	FetchData(&this->splitcorners,mxGetField(matlab_struct,0,"splitcorners"));
-	FetchData(&this->geometricalmetric,mxGetField(matlab_struct,0,"geometricalmetric"));
-	FetchData(&this->verbose,mxGetField(matlab_struct,0,"verbose"));
-	FetchData(&this->field,&lines,&this->numfields,mxGetField(matlab_struct,0,"field"));
-	FetchData(&this->err,NULL,&cols,mxGetField(matlab_struct,0,"err"));
-	if (this->numfields!=0 && cols!=this->numfields){ISSMERROR("the size of 'err' should be the same as 'field'");}
-	FetchData(&this->errg,mxGetField(matlab_struct,0,"errg"));
-	FetchData(&this->coeff,mxGetField(matlab_struct,0,"coeff"));
-	FetchData(&this->metric,&lines,&cols,mxGetField(matlab_struct,0,"metric"));
+	FetchData(&this->hminVertices,&this->hminVerticesSize[0],&this->hminVerticesSize[1],mxGetField(matlab_struct,0,"hminVertices"));
+	FetchData(&this->hmaxVertices,&this->hmaxVerticesSize[0],&this->hmaxVerticesSize[1],mxGetField(matlab_struct,0,"hmaxVertices"));
+	FetchData(&this->hVertices,&this->hVerticesSize[0],&this->hVerticesSize[1],mxGetField(matlab_struct,0,"hVertices"));
+	FetchData(&this->metric,&this->metricSize[0],&this->metricSize[1],mxGetField(matlab_struct,0,"metric"));
+	FetchData(&this->field,&this->fieldSize[0],&this->fieldSize[1],mxGetField(matlab_struct,0,"field"));
+	FetchData(&this->err,&this->errSize[0],&this->errSize[1],mxGetField(matlab_struct,0,"err"));
 
 	/*Additional checks*/
@@ -84,7 +86,8 @@
 	xfree((void**)&this->hminVertices);
 	xfree((void**)&this->hmaxVertices);
-	xfree((void**)&this->err);
+	xfree((void**)&this->hVertices);
 	xfree((void**)&this->metric);
 	xfree((void**)&this->field);
+	xfree((void**)&this->err);
 
 }
@@ -97,20 +100,29 @@
 	int i;
 
+	if (this->anisomax<1) ISSMERROR("'anisomax' option should be >=1");
 	if (this->coeff==0) ISSMERROR("'coeff' should be positive");
+	if (this->errg<0) ISSMERROR("'errg' option should be >0");
+	if (this->gradation<1) ISSMERROR("'gradation' option should be >=1");
+	if (this->Hessiantype!=0  && this->Hessiantype!=1) ISSMERROR("'Hessiantype' supported options are 0 and 1");
+	if (this->maxnbv<3) ISSMERROR("'maxnbv' option should be >3");
 	if (this->maxsubdiv<=1) ISSMERROR("'maxsubdiv' should be >1");
+	if (this->Metrictype!=0   && this->Metrictype!=1 && this->Metrictype!=2) ISSMERROR("'Metrictype' supported options are 0, 1 and 2");
+	if (this->nbjacobi<=0) ISSMERROR("'nbjacobi' option should be >0");
+	if (this->nbsmooth<=0) ISSMERROR("'nbsmooth' option should be >0");
+
 	if (this->Crack!=0  && this->Crack!=1) ISSMERROR("'Crack' supported options are 0 and 1");
-	if (this->Hessiantype!=0  && this->Hessiantype!=1) ISSMERROR("'Hessiantype' supported options are 0 and 1");
-	if (this->Metrictype!=0   && this->Metrictype!=1 && this->Metrictype!=2) ISSMERROR("'Metrictype' supported options are 0, 1 and 2");
 	if (this->KeepVertices!=0 && this->KeepVertices!=1) ISSMERROR("'KeepVertices' supported options are 0 and 1");
-	if (this->errg<0) ISSMERROR("'errg' option should be >0");
-	if (this->nbjacobi<=0) ISSMERROR("'nbjacobi' option should be >0");
 	if (this->geometricalmetric!=0  && this->geometricalmetric!=1) ISSMERROR("'geometricalmetric' supported options are 0 and 1");
-	if (this->nbsmooth<=0) ISSMERROR("'nbsmooth' option should be >0");
-	if (this->maxnbv<3) ISSMERROR("'maxnbv' option should be >3");
+
 	if (this->hmin<=0) ISSMERROR("'hmin' option should be >0");
 	if (this->hmax<=0 || this->hmax<this->hmin) ISSMERROR("'hmax' option should be between 0 and hmin=%g",this->hmin);
-	if (this->anisomax<1) ISSMERROR("'anisomax' option should be >=1");
-	if (this->gradation<1) ISSMERROR("'gradation' option should be >=1");
-	for (i=0;i<this->numfields;i++) {if (this->err[i]<=0) ISSMERROR("'err' option should be >0");};
+	if (this->hminVertices && this->hminVerticesSize[1]!=1) ISSMERROR("'hminVertices' should be a column");
+	if (this->hmaxVertices && this->hmaxVerticesSize[1]!=1) ISSMERROR("'hmaxVertices' should be a column");
+	if (this->hVertices && this->hVerticesSize[1]!=1) ISSMERROR("'hVertices' should be a column");
+	if (this->metric && (this->metricSize[1]!=1 && this->metricSize[1]!=3)) ISSMERROR("'metric' should have either 1 (iso) or 3 (aniso) columns.");
+	if (this->field){
+		if (this->errSize[0]!=1 || this->errSize[1]!=this->fieldSize[1]) ISSMERROR("'err' should be of size %i x %i",1,this->fieldSize[1]);
+		for (i=0;i<this->fieldSize[1];i++) {if (this->err[i]<=0) ISSMERROR("'err' option should be >0");};
+	}
 
 }
Index: /issm/trunk/src/c/objects/Bamg/BamgOpts.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/BamgOpts.h	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/BamgOpts.h	(revision 5187)
@@ -14,31 +14,42 @@
 	public:
 
+		/*Parameters*/
+		double  anisomax;
+		double  cutoff;
+		double  coeff;
+		double  errg;
+		double  gradation;
+		int     Hessiantype;
+		double  MaxCornerAngle;
 		int     maxnbv;
-		double  MaxCornerAngle;
+		double  maxsubdiv;
+		int     Metrictype;
+		int     nbjacobi;
+		int     nbsmooth;
+		double  omega;
+		double  power;
+		int     verbose;
+
+		/*Flags*/
 		int     Crack;
-		int     Hessiantype;
-		int     Metrictype;
+		int     geometricalmetric;
 		int     KeepVertices;
-		double  maxsubdiv;
-		double  power;
-		double  anisomax;
-		int     nbsmooth;
-		int     nbjacobi;
-		double  omega;
+		int     splitcorners;
+
+		/*Metric related*/
 		double  hmin;
 		double  hmax;
+		int     hminVerticesSize[2];
 		double* hminVertices;
+		int     hmaxVerticesSize[2];
 		double* hmaxVertices;
-		double  gradation;
-		double  cutoff;
-		int     splitcorners;
-		int     geometricalmetric;
-		int     verbose;
+		int     hVerticesSize[2];
+		double* hVertices;
+		int     metricSize[2];
+		double* metric;
+		int     fieldSize[2];
+		double* field;
+		int     errSize[2];
 		double* err;
-		double  errg;
-		double  coeff;
-		double* metric;
-		double* field;
-		int     numfields;
 
 		BamgOpts();
Index: /issm/trunk/src/c/objects/Bamg/Geometry.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Geometry.cpp	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/Geometry.cpp	(revision 5187)
@@ -180,9 +180,9 @@
 
 		//hVertices
-		if(bamggeom->hVertices){
+		if(bamgopts->hVertices && bamgopts->hVerticesSize[0]==nbv){
 			if(verbose>5) printf("      processing hVertices\n");
 			for (i=0;i< nbv;i++){
-				if (!isnan(bamggeom->hVertices[i])){
-					vertices[i].m=Metric((double)bamggeom->hVertices[i]);
+				if (!isnan(bamgopts->hVertices[i])){
+					vertices[i].m=Metric((double)bamgopts->hVertices[i]);
 				}
 			}
@@ -190,8 +190,8 @@
 
 		//MetricVertices
-		if(bamggeom->MetricVertices){
+		if(bamgopts->metric && bamgopts->metric[0]==nbv){
 			if(verbose>5) printf("      processing MetricVertices\n");
 			for (i=0;i< nbv;i++) {
-				vertices[i].m = Metric((double)bamggeom->MetricVertices[i*3+0],(double)bamggeom->MetricVertices[i*3+1],(double)bamggeom->MetricVertices[i*3+2]);
+				vertices[i].m = Metric((double)bamgopts->metric[i*3+0],(double)bamgopts->metric[i*3+1],(double)bamgopts->metric[i*3+2]);
 			}
 		}
Index: /issm/trunk/src/c/objects/Bamg/Mesh.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Mesh.cpp	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/Mesh.cpp	(revision 5187)
@@ -483,14 +483,4 @@
 				}
 				edges[i].GeometricalEdgeHook=Gh.edges+j;
-			}
-		}
-
-		//hVertices
-		if(bamgmesh->hVertices){
-			if(verbose>5) printf("      processing hVertices\n");
-			for (i=0;i< nbv;i++){
-				if (!isnan(bamgmesh->hVertices[i])){
-					vertices[i].m=Metric((double)bamgmesh->hVertices[i]);
-				}
 			}
 		}
@@ -1710,5 +1700,8 @@
 		/*Get and process fields*/
 		s=bamgopts->field;
-		nbsol=bamgopts->numfields;
+		nbsol=bamgopts->fieldSize[1];
+
+		/*Check size*/
+		if (bamgopts->fieldSize[0] != nbv) ISSMERROR("'field' should have %i rows",nbv);
 
 		//initialization of some variables
@@ -1912,5 +1905,8 @@
 		/*Get and process fields*/
 		s=bamgopts->field;
-		nbsol=bamgopts->numfields;
+		nbsol=bamgopts->fieldSize[1];
+
+		/*Check size*/
+		if (bamgopts->fieldSize[0] != nbv) ISSMERROR("'field' should have %i rows",nbv);
 
 		//initialization of some variables
Index: /issm/trunk/src/c/objects/Bamg/Triangle.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Triangle.cpp	(revision 5186)
+++ /issm/trunk/src/c/objects/Bamg/Triangle.cpp	(revision 5187)
@@ -138,5 +138,5 @@
 	/*FUNCTION Triangle::NuEdgeTriangleAdj{{{1*/
 	short  Triangle::NuEdgeTriangleAdj(int i) const {
-		// Number of the  adjacent edge in adj tria  
+		/*Number of the  adjacent edge in adj tria (make sure it is between 0 and 2*/
 		return AdjEdgeNumber[i&3]&3;
 	}/*}}}*/
Index: /issm/trunk/src/m/classes/@bamggeom/bamggeom.m
===================================================================
--- /issm/trunk/src/m/classes/@bamggeom/bamggeom.m	(revision 5186)
+++ /issm/trunk/src/m/classes/@bamggeom/bamggeom.m	(revision 5187)
@@ -15,6 +15,4 @@
 	bg.RequiredEdges=[];
 	bg.CrackedEdges=[];
-	bg.hVertices=[];
-	bg.MetricVertices=[];
 	bg.SubDomains=[];
 
Index: /issm/trunk/src/m/classes/@bamgmesh/bamgmesh.m
===================================================================
--- /issm/trunk/src/m/classes/@bamgmesh/bamgmesh.m	(revision 5186)
+++ /issm/trunk/src/m/classes/@bamgmesh/bamgmesh.m	(revision 5187)
@@ -24,5 +24,4 @@
 	bm.CrackedVertices=[];
 	bm.CrackedEdges=[];
-	bm.hVertices=[];
 
 	bm=class(bm,'bamgmesh');
Index: /issm/trunk/src/m/classes/public/bamg.m
===================================================================
--- /issm/trunk/src/m/classes/public/bamg.m	(revision 5186)
+++ /issm/trunk/src/m/classes/public/bamg.m	(revision 5187)
@@ -224,11 +224,4 @@
 	end
 
-	if exist(options,'hVertices'),
-		bamg_geometry.hVertices=getfieldvalue(options,'hVertices');
-		if length(bamg_geometry.hVertices)~=nods,
-			error(['hVertices option should be of size [' num2str(nods) ',1]']);
-		end
-	end
-
 	%process geom
 	%bamg_geometry=processgeometry(bamg_geometry,getfieldvalue(options,'tol',NaN),domain(1));
@@ -253,11 +246,4 @@
 		bamg_mesh.Vertices=[md.x md.y ones(md.numberofgrids,1)];
 		bamg_mesh.Triangles=[md.elements ones(md.numberofelements,1)];
-	end
-
-	if exist(options,'hVertices'),
-		bamg_mesh.hVertices=getfieldvalue(options,'hVertices');
-		if length(bamg_mesh.hVertices)~=md.numberofgrids,
-			error(['hVertices option should be of size [' num2str(md.numberofgrids) ',1]']);
-		end
 	end
 
@@ -282,4 +268,5 @@
 bamg_options.hminVertices=getfieldvalue(options,'hminVertices',[]);
 bamg_options.hmaxVertices=getfieldvalue(options,'hmaxVertices',[]);
+bamg_options.hVertices=getfieldvalue(options,'hVertices',[]);
 bamg_options.KeepVertices=getfieldvalue(options,'KeepVertices',1);
 bamg_options.MaxCornerAngle=getfieldvalue(options,'MaxCornerAngle',10);
Index: /issm/trunk/src/mex/Bamg/Bamg.cpp
===================================================================
--- /issm/trunk/src/mex/Bamg/Bamg.cpp	(revision 5186)
+++ /issm/trunk/src/mex/Bamg/Bamg.cpp	(revision 5187)
@@ -25,6 +25,6 @@
 	/*Initialize variables*/
 	bamgopts   = new BamgOpts(BAMGOPTIONS);
-	bamggeom_in= new BamgGeom(BAMGGEOMETRY);
-	bamgmesh_in= new BamgMesh(BAMGMESH);
+	bamggeom_in= new BamgGeom(BAMGGEOMIN);
+	bamgmesh_in= new BamgMesh(BAMGMESHIN);
 
 	/*Initialize outputs*/
Index: /issm/trunk/src/mex/Bamg/Bamg.h
===================================================================
--- /issm/trunk/src/mex/Bamg/Bamg.h	(revision 5186)
+++ /issm/trunk/src/mex/Bamg/Bamg.h	(revision 5187)
@@ -17,7 +17,7 @@
     
 /* serial input macros: */
-#define BAMGMESH     (mxArray*)prhs[0]
-#define BAMGGEOMETRY (mxArray*)prhs[1]
-#define BAMGOPTIONS  (mxArray*)prhs[2]
+#define BAMGMESHIN  (mxArray*)prhs[0]
+#define BAMGGEOMIN  (mxArray*)prhs[1]
+#define BAMGOPTIONS (mxArray*)prhs[2]
 
 /* serial output macros: */
