Index: /issm/trunk-jpl/src/c/bamg/Mesh.cpp
===================================================================
--- /issm/trunk-jpl/src/c/bamg/Mesh.cpp	(revision 22251)
+++ /issm/trunk-jpl/src/c/bamg/Mesh.cpp	(revision 22252)
@@ -37,17 +37,17 @@
 
 		/*Fill holes and generate mesh properties*/
-		ReconstructExistingMesh();
-	}
-	/*}}}*/
-	Mesh::Mesh(int* index,double* x,double* y,int nods,int nels):Gh(*(new Geometry())),BTh(*this){/*{{{*/
+		ReconstructExistingMesh(bamgopts);
+	}
+	/*}}}*/
+	Mesh::Mesh(int* index,double* x,double* y,int nods,int nels,BamgOpts* bamgopts):Gh(*(new Geometry())),BTh(*this){/*{{{*/
 
 		Init(0);
-		ReadMesh(index,x,y,nods,nels);
+		ReadMesh(index,x,y,nods,nels,bamgopts);
 		SetIntCoor();
-		ReconstructExistingMesh();
-	}
-	/*}}}*/
-	Mesh::Mesh(double* x,double* y,int nods):Gh(*(new Geometry())),BTh(*this){/*{{{*/
-		Triangulate(x,y,nods);
+		ReconstructExistingMesh(bamgopts);
+	}
+	/*}}}*/
+	Mesh::Mesh(double* x,double* y,int nods,BamgOpts* bamgopts):Gh(*(new Geometry())),BTh(*this){/*{{{*/
+		Triangulate(x,y,nods,bamgopts);
 	}
 	/*}}}*/
@@ -143,5 +143,5 @@
 		  Gh.PostRead(); 
 		  SetIntCoor();
-		  ReconstructExistingMesh();
+		  ReconstructExistingMesh(bamgopts);
 
 		  /*Final checks*/
@@ -247,5 +247,5 @@
 
 	/*IO*/
-	void Mesh::ReadMesh(int* index,double* x,double* y,int nods,int nels){/*{{{*/
+	void Mesh::ReadMesh(int* index,double* x,double* y,int nods,int nels,BamgOpts* bamgopts){/*{{{*/
 
 		long i1,i2,i3;
@@ -258,4 +258,5 @@
 		maxnbv=nbv;
 		nbt=nels;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//Vertices
@@ -310,5 +311,5 @@
 	void Mesh::ReadMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts){/*{{{*/
 
-		int    verbose;
+		int    verbose=0;
 		double Hmin = HUGE_VAL;    // the infinie value
 		long   i1,i2,i3;
@@ -316,5 +317,8 @@
 		Metric M1(1);
 
-		verbose=bamgopts->verbose;
+		/*Check needed pointer*/
+		_assert_(bamgmesh);
+
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		nbv=bamgmesh->VerticesSize[0];
@@ -496,7 +500,11 @@
 		int* connectivitysize_1=NULL;
 		int  connectivitymax_1=0;
+		int verbose=0;
+	
+		/*Check needed pointer*/
+		_assert_(bamgmesh);
 
 		/*Get options*/
-		int verbose=bamgopts->verbose;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		/*Build reft that holds the number the subdomain number of each triangle, and the real numbering of the elements*/
@@ -898,6 +906,13 @@
 		/*Intermediary*/
 		int  i,j;
-
-		if(bamgopts->verbose>3) _printf_("      processing metric\n");
+		int verbose=0;
+
+		/*Check pointer*/
+		_assert_(bamgopts);
+
+		/*Get options*/
+		verbose=bamgopts->verbose;
+
+		if(verbose>3) _printf_("      processing metric\n");
 		double hmin = Max(bamgopts->hmin,MinimalHmin());
 		double hmax = Min(bamgopts->hmax,MaximalHmax());
@@ -933,4 +948,5 @@
 	void Mesh::WriteMetric(BamgOpts* bamgopts) {/*{{{*/
 		int i;
+		_assert_(bamgopts);
 		xDelete<double>(bamgopts->metric);
 		bamgopts->metric=xNew<double>(3*nbv);
@@ -984,4 +1000,7 @@
 		//  Hessiantype = 0 =>  H is computed using double L2 projection
 		//  Hessiantype = 1 =>  H is computed with green formula
+
+		/*Check pointer*/
+		_assert_(bamgopts);
 
 		/*Options*/
@@ -1134,10 +1153,13 @@
 
 	}/*}}}*/
-	void Mesh::BoundAnisotropy(double anisomax,double hminaniso) {/*{{{*/
+	void Mesh::BoundAnisotropy(BamgOpts* bamgopts,double anisomax,double hminaniso) {/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/BoundAnisotropy)*/
 
-		long int verbose=0;
-		double lminaniso = 1/ (Max(hminaniso*hminaniso,1e-100));
-
+		int verbose=0;
+		double lminaniso = 1./ (Max(hminaniso*hminaniso,1e-100));
+	
+		//Get options
+		if(bamgopts) verbose=bamgopts->verbose;
+			
 		//display info
 		if (verbose > 1)  _printf_("   BoundAnisotropy by " << anisomax << "\n");
@@ -1183,7 +1205,5 @@
 
 		/*Recover options*/
-		if(bamgopts){
-			verbose=bamgopts->verbose;
-		}
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//display info
@@ -1516,5 +1536,5 @@
 
 		//Build Gh.coefIcoor
-		int MaxICoord = 1073741823; //2^30 - 1 = =111...111 (29 times one)
+		long MaxICoord = 1073741823; //2^30 - 1 = =111...111 (29 times one)
 		Gh.coefIcoor= (MaxICoord)/(Max(Gh.pmax.x-Gh.pmin.x,Gh.pmax.y-Gh.pmin.y));
 		if (Gh.coefIcoor<=0){
@@ -1622,8 +1642,11 @@
 		double* s=NULL;
 		long    nbsol;
-		int     verbose;
+		int     verbose=0;
 
 		int   i,j,k,iA,iB,iC;
 		int   iv;
+
+		/*Check pointer*/
+		_assert_(bamgopts);
 
 		/*Recover options*/
@@ -1830,4 +1853,7 @@
 		int verbose;
 
+		/*Check pointer*/
+		_assert_(bamgopts);
+		
 		/*Recover options*/
 		verbose=bamgopts->verbose;
@@ -2128,7 +2154,8 @@
 		int i1,i2;
 		int j1,j2;
+		int verbose=0;
 
 		/*Options*/
-		int verbose=bamgopts->verbose;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//  computed the number of cracked edge
@@ -2290,10 +2317,13 @@
 	}
 	/*}}}*/
-	void Mesh::ForceBoundary() {/*{{{*/
+	void Mesh::ForceBoundary(BamgOpts* bamgopts) {/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/ForceBoundary)*/
 
-		long int verbose=2;
+		int verbose=0;
 		int k=0;
 		int nbfe=0,nbswp=0,Nbswap=0;
+
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//display
@@ -2332,8 +2362,11 @@
 	}
 	/*}}}*/
-	void Mesh::FindSubDomain(int OutSide) {/*{{{*/
+	void Mesh::FindSubDomain(BamgOpts* bamgopts,int OutSide) {/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FindSubDomain)*/
 
 		int verbose=0;
+
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		if (verbose >2){
@@ -2645,5 +2678,5 @@
 	}
 	/*}}}*/
-	void Mesh::Insert(){/*{{{*/
+	void Mesh::Insert(BamgOpts* bamgopts){/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/Insert)*/
 
@@ -2652,7 +2685,8 @@
 		//Intermediary
 		int i;
+		int verbose=0;
 
 		/*Get options*/
-		long int verbose=2;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//Display info
@@ -2776,12 +2810,15 @@
 	}
 	/*}}}*/
-	long Mesh::InsertNewPoints(long nbvold,long & NbTSwap) {/*{{{*/
+	long Mesh::InsertNewPoints(long nbvold,long & NbTSwap,BamgOpts* bamgopts) {/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/InsertNewPoints)*/
 
-		long int verbose=0;
-		double seuil= 1.414/2 ;// for two close point 
+		int verbose=0;
+		double seuil= 1.414/2.;// for two close point 
 		long i;
 		long NbSwap=0;
 		long long det3[3];
+
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//number of new points
@@ -2911,8 +2948,12 @@
 	}
 	/*}}}*/
-	void  Mesh::MaxSubDivision(double maxsubdiv) {/*{{{*/
+	void  Mesh::MaxSubDivision(BamgOpts* bamgopts,double maxsubdiv) {/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/MaxSubDivision)*/
-
-		long int verbose=0;
+		
+		/*Intermediaries*/
+		int verbose=0;
+
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		const  double maxsubdiv2 = maxsubdiv*maxsubdiv;
@@ -2998,4 +3039,5 @@
 
 		int i,j,k;
+		int verbose=0;
 		long NbTSwap=0;
 		long nbtold=nbt;
@@ -3007,5 +3049,5 @@
 
 		/*Recover options*/
-		int verbose=bamgopts->verbose;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		/*First, insert old points if requested*/
@@ -3040,5 +3082,5 @@
 			//if(pointsoutside) _printf_("WARNING: One or more points of the initial mesh fall outside of the geometric boundary\n");
 			Bh.CreateSingleVertexToTriangleConnectivity();     
-			InsertNewPoints(nbvold,NbTSwap);
+			InsertNewPoints(nbvold,NbTSwap,bamgopts);
 		}
 		else Bh.CreateSingleVertexToTriangleConnectivity();     
@@ -3098,5 +3140,5 @@
 			}// for triangle   
 
-			if (!InsertNewPoints(nbvold,NbTSwap)) break;
+			if (!InsertNewPoints(nbvold,NbTSwap,bamgopts)) break;
 			for (i=nbtold;i<nbt;i++) first_np_or_next_t[i]=iter;
 			Headt = nbt; // empty list 
@@ -3255,5 +3297,5 @@
 	}                  
 	/*}}}*/
-	void Mesh::ReconstructExistingMesh(){/*{{{*/
+	void Mesh::ReconstructExistingMesh(BamgOpts* bamgopts){/*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FillHoleInMesh)*/
 
@@ -3268,4 +3310,7 @@
 		/*Intermediary*/
 		int verbose=0;
+
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		// generation of the integer coordinate
@@ -3451,5 +3496,5 @@
 		}
 
-		FindSubDomain(1);
+		FindSubDomain(bamgopts,1);
 		// remove all the hole 
 		// remove all the good sub domain
@@ -3525,5 +3570,5 @@
 			_error_("number of triangles edges alone = " << k);
 		}
-		FindSubDomain();
+		FindSubDomain(bamgopts);
 
 		delete edge4;
@@ -3648,5 +3693,5 @@
 
 		//Compute coefIcoor
-		int MaxICoord = 1073741823; //2^30 - 1 = =111...111 (29 times one)
+		long MaxICoord = 1073741823; //2^30 - 1 = =111...111 (29 times one)
 		coefIcoor= (MaxICoord)/(Max(pmax.x-pmin.x,pmax.y-pmin.y));
 		if (coefIcoor<=0){
@@ -3690,8 +3735,13 @@
 	}
 	/*}}}*/
-	void Mesh::SmoothingVertex(int nbiter,double omega ) { /*{{{*/
+	void Mesh::SmoothingVertex(BamgOpts* bamgopts,int nbiter,double omega ) { /*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/SmoothingVertex)*/
-
-		long int verbose=0;
+		
+		/*Intermediaries*/
+		int verbose=0;
+	
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
+
 		//  if quatree exist remove it end reconstruct
 		if (quadtree) delete quadtree;
@@ -3730,8 +3780,12 @@
 	}
 	/*}}}*/
-	void Mesh::SmoothMetric(double raisonmax) { /*{{{*/
+	void Mesh::SmoothMetric(BamgOpts* bamgopts,double raisonmax) { /*{{{*/
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/SmoothMetric)*/
-
-		long int verbose=0;
+		
+		/*Intermediaries*/
+		int verbose=0;
+
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		if(raisonmax<1.1) return;
@@ -4025,9 +4079,12 @@
 	}
 	/*}}}*/
-	void Mesh::Triangulate(double* x,double* y,int nods){/*{{{*/
+	void Mesh::Triangulate(double* x,double* y,int nods,BamgOpts* bamgopts){/*{{{*/
 
 		int verbose=0;
 		int i;
 		Metric M1(1);
+	
+		/*Get options*/
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		/*Initialize mesh*/
@@ -4047,5 +4104,5 @@
 
 		/*Insert Vertices*/
-		Insert();
+		Insert(bamgopts);
 	}
 	/*}}}*/
@@ -4056,4 +4113,5 @@
 		/*Intermediaries*/
 		int                i,k;
+		int					 verbose=0;
 		int                nbcurves    = 0;
 		int                NbNewPoints,NbEdgeCurve;
@@ -4070,5 +4128,5 @@
 
 		/*Get options*/
-		int verbose=bamgopts->verbose;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		//build background mesh flag (1 if background, else 0)
@@ -4348,13 +4406,13 @@
 		if (verbose>3) _printf_("      Creating initial Constrained Delaunay Triangulation...\n");
 		if (verbose>3) _printf_("         Inserting boundary points\n");
-		Insert();
+		Insert(bamgopts);
 
 		//Force the boundary
 		if (verbose>3) _printf_("         Forcing boundaries\n");
-		ForceBoundary();
+		ForceBoundary(bamgopts);
 
 		//Extract SubDomains
 		if (verbose>3) _printf_("         Extracting subdomains\n");
-		FindSubDomain();
+		FindSubDomain(bamgopts);
 
 		if (verbose>3) _printf_("      Inserting internal points\n");
@@ -4366,6 +4424,9 @@
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/GeomToTriangles1)*/
 
+		/*Intermediaries*/
+		int verbose=0;
+
 		/*Get options*/
-		int verbose=bamgopts->verbose;
+		if(bamgopts) verbose=bamgopts->verbose;
 
 		Gh.NbRef++;// add a ref to Gh
@@ -4675,13 +4736,13 @@
 		if (verbose>3) _printf_("      Creating initial Constrained Delaunay Triangulation...\n");
 		if (verbose>3) _printf_("         Inserting boundary points\n");
-		Insert();
+		Insert(bamgopts);
 
 		//Force the boundary
 		if (verbose>3) _printf_("         Forcing boundaries\n");
-		ForceBoundary();
+		ForceBoundary(bamgopts);
 
 		//Extract SubDomains
 		if (verbose>3) _printf_("         Extracting subdomains\n");
-		FindSubDomain();
+		FindSubDomain(bamgopts);
 
 		if (verbose>3) _printf_("      Inserting internal points\n");
Index: /issm/trunk-jpl/src/c/bamg/Mesh.h
===================================================================
--- /issm/trunk-jpl/src/c/bamg/Mesh.h	(revision 22251)
+++ /issm/trunk-jpl/src/c/bamg/Mesh.h	(revision 22252)
@@ -57,6 +57,6 @@
 			//Constructors/Destructors
 			Mesh(BamgGeom* bamggeom,BamgMesh* bamgmesh,BamgOpts* bamgopts);
-			Mesh(int* index,double* x,double* y,int nods,int nels);/*MeshConvert*/
-			Mesh(double* x,double* y,int nods); /*BamgTriangulate*/
+			Mesh(int* index,double* x,double* y,int nods,int nels,BamgOpts* bamgopts);/*MeshConvert*/
+			Mesh(double* x,double* y,int nods,BamgOpts* bamgopts); /*BamgTriangulate*/
 			Mesh(Mesh &,Geometry * pGh=0,Mesh* pBTh=0,long maxnbv_in=0 ); //copy operator
 			Mesh(const Mesh &,const int *flag,const int *bb,BamgOpts* bamgopts); // truncature
@@ -78,21 +78,21 @@
 			R2 I2ToR2(const I2 & P) const;
 			void AddVertex(BamgVertex & s,Triangle * t,long long *  =0) ;
-			void Insert();
+			void Insert(BamgOpts* bamgopts);
 			void Echo(void);
-			void ForceBoundary();
-			void FindSubDomain(int OutSide=0);
+			void ForceBoundary(BamgOpts* bamgopts);
+			void FindSubDomain(BamgOpts* bamgopts,int OutSide=0);
 			long TriangleReferenceList(long*) const;
 			void TriangleIntNumbering(long* renumbering);
 			void CrackMesh(BamgOpts* bamgopts);
-			void SmoothMetric(double raisonmax) ;
-			void BoundAnisotropy(double anisomax,double hminaniso= 1e-100) ;
+			void SmoothMetric(BamgOpts* bamgopts,double raisonmax) ;
+			void BoundAnisotropy(BamgOpts* bamgopts,double anisomax,double hminaniso= 1e-100) ;
 			Edge** MakeGeomEdgeToEdge();
 			long SplitInternalEdgeWithBorderVertices();
 			void MakeBamgQuadtree();
-			void MaxSubDivision(double maxsubdiv);
+			void MaxSubDivision(BamgOpts* bamgopts,double maxsubdiv);
 			void NewPoints(Mesh &,BamgOpts* bamgopts,int KeepVertices=1);
-			long InsertNewPoints(long nbvold,long & NbTSwap); 
+			long InsertNewPoints(long nbvold,long & NbTSwap,BamgOpts* bamgopts); 
 			void TrianglesRenumberBySubDomain(bool justcompress=false);
-			void SmoothingVertex(int =3,double=0.3);
+			void SmoothingVertex(BamgOpts* bamgopts,int =3,double=0.3);
 			Metric MetricAt (const R2 &);
 			GeomEdge* ProjectOnCurve( Edge & AB, BamgVertex &  A, BamgVertex & B,double theta, BamgVertex & R,VertexOnEdge & BR,VertexOnGeom & GR);
@@ -105,5 +105,5 @@
 			BamgVertex* NearestVertex(int i,int j) ;
 			Triangle* TriangleFindFromCoord(const I2 & ,long long [3],Triangle *tstart=0);
-			void ReadMesh(int* index,double* x,double* y,int nods,int nels);
+			void ReadMesh(int* index,double* x,double* y,int nods,int nels,BamgOpts* bamgopts);
 			void ReadMesh(BamgMesh* bamgmesh, BamgOpts* bamgopts);
 			void WriteMesh(BamgMesh* bamgmesh,BamgOpts* bamgopts);
@@ -115,6 +115,6 @@
 			void BuildMetric1(BamgOpts* bamgopts);
 			void BuildGeometryFromMesh(BamgOpts* bamgopts=NULL);
-			long  RandomNumber(long max);
-			void ReconstructExistingMesh();
+			long RandomNumber(long max);
+			void ReconstructExistingMesh(BamgOpts* bamgopts);
 
 			//Inline methods
@@ -142,5 +142,5 @@
 			void TriangulateFromGeom1(BamgOpts* bamgopts,int KeepVertices=1);// the real constructor mesh adaption
 			void TriangulateFromGeom0(BamgOpts* bamgopts);// the real constructor mesh generator
-			void Triangulate(double* x,double* y,int nods);
+			void Triangulate(double* x,double* y,int nods,BamgOpts* bamgopts);
 			void Init(long);
 			int ForceEdge(BamgVertex &a, BamgVertex & b,AdjacentTriangle & taret) ;
Index: /issm/trunk-jpl/src/c/classes/AmrBamg.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/AmrBamg.cpp	(revision 22251)
+++ /issm/trunk-jpl/src/c/classes/AmrBamg.cpp	(revision 22252)
@@ -83,5 +83,5 @@
 
 	/*Read father mesh and create geometry*/
-	Mesh* Th=new Mesh(elements,x,y,numberofvertices,numberofelements);
+	Mesh* Th=new Mesh(elements,x,y,numberofvertices,numberofelements,this->options);
 
 	/*Write geometry*/
Index: /issm/trunk-jpl/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp	(revision 22251)
+++ /issm/trunk-jpl/src/c/modules/BamgConvertMeshx/BamgConvertMeshx.cpp	(revision 22252)
@@ -17,5 +17,5 @@
 
 	/*read mesh*/
-	Mesh Th(index,x,y,nods,nels); 
+	Mesh Th(index,x,y,nods,nels,bamgopts); 
 
 	/*write mesh and geometry*/
Index: /issm/trunk-jpl/src/c/modules/BamgTriangulatex/BamgTriangulatex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/BamgTriangulatex/BamgTriangulatex.cpp	(revision 22251)
+++ /issm/trunk-jpl/src/c/modules/BamgTriangulatex/BamgTriangulatex.cpp	(revision 22252)
@@ -14,8 +14,9 @@
 int BamgTriangulatex(int** pindex,int* pnels,double* x,double* y,int nods){
 
-	Mesh Th(x,y,nods);
+	BamgOpts* bamgopts=new BamgOpts();//use bamgopts->verbose>5 to debug bamg::Mesh()
+	Mesh Th(x,y,nods,bamgopts);
 	Th.WriteIndex(pindex,pnels);
+	delete bamgopts;
 	//delete &Th;
 	return 0;
-
 }
Index: /issm/trunk-jpl/src/c/modules/Bamgx/Bamgx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Bamgx/Bamgx.cpp	(revision 22251)
+++ /issm/trunk-jpl/src/c/modules/Bamgx/Bamgx.cpp	(revision 22252)
@@ -150,11 +150,11 @@
 
 		//Smoothe metric
-		BTh.SmoothMetric(bamgopts->gradation);
+		BTh.SmoothMetric(bamgopts,bamgopts->gradation);
 
 		//Control element subdivision
-		BTh.MaxSubDivision(bamgopts->maxsubdiv);
+		BTh.MaxSubDivision(bamgopts,bamgopts->maxsubdiv);
 
 		//Bound anisotropy
-		BTh.BoundAnisotropy(bamgopts->anisomax,hminaniso);
+		BTh.BoundAnisotropy(bamgopts,bamgopts->anisomax,hminaniso);
 
 		//Build new mesh
@@ -171,5 +171,5 @@
 
 		//Smooth vertices
-		if(nbsmooth>0) Th.SmoothingVertex(nbsmooth,bamgopts->omega);
+		if(nbsmooth>0) Th.SmoothingVertex(bamgopts,nbsmooth,bamgopts->omega);
 
 		//display info
Index: /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	(revision 22251)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	(revision 22252)
@@ -30,4 +30,5 @@
 	double aa,bb;
 	long long dete[3];
+	BamgOpts* bamgopts=new BamgOpts();//if necessary debug bamg::Mesh, set bamgopts->verbose>5
 
 	/*Checks*/
@@ -49,5 +50,6 @@
 
 	/*read background mesh*/
-	Mesh* Th=new Mesh(index_data,x_data,y_data,nods_data,nels_data); 
+	bamgopts->verbose=0;
+	Mesh* Th=new Mesh(index_data,x_data,y_data,nods_data,nels_data,bamgopts); 
 
 	/*Get reference number (for subdomains)*/
@@ -166,4 +168,5 @@
 	/*clean-up and return*/
 	delete Th;
+	delete bamgopts;
 	xDelete<long>(reft);
 	xDelete<int>(connectivity);
