Index: /issm/trunk/src/c/objects/Bamg/GeometricalEdge.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/GeometricalEdge.cpp	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/GeometricalEdge.cpp	(revision 5151)
@@ -16,4 +16,53 @@
 
 	/*Methods*/
+	/*FUNCTION GeometricalEdge::Cracked{{{1*/
+	int    GeometricalEdge::Cracked() const  {
+		return type &1;  
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::F{{{1*/
+	R2 GeometricalEdge::F(double theta) const{
+		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/F)*/
+		// parametrization of the curve edge
+
+	   R2 A=v[0]->r,B=v[1]->r;
+		double ca,cb,cta,ctb;
+		if ( theta<-1e-12){
+			ISSMERROR("theta<-1e-12");
+		}
+		if ( theta>1+1e-12){
+			ISSMERROR("theta>1+1e-12");
+		}
+		if (TgA()) 
+		 if (TgB()) // interpolation d'hermite
+			{ cb =  theta*theta*(3-2*theta);
+			 ca =  1-cb;     
+			 cta = (1-theta)*(1-theta)*theta;
+			 ctb = (theta-1)*theta*theta ;
+			}
+		 else { // 1-t*t, t-t*t, t*t
+			 double t = theta;
+			 cb = t*t;
+			 ca = 1-cb;
+			 cta= t-cb;
+			 ctb=0;    
+		 }    
+		else
+		 if (TgB()){
+			 double t = 1-theta;
+			 ca = t*t;
+			 cb = 1-ca;
+			 ctb= -t+ca;
+			 cta=0;    
+		 }
+		 else {
+			 ca =(1-theta),cb = theta,cta=ctb=0; // lagrange P1
+		 }
+		return A*ca + B*cb + tg[0]* cta + tg[1] * ctb;
+	  }
+	/*}}}1*/
+	/*FUNCTION GeometricalEdge::Mark{{{1*/
+	int    GeometricalEdge::Mark()    const  {
+		return type &16; 
+	}/*}}}*/
 	/*FUNCTION GeometricalEdge::R1tg{{{1*/
 	double GeometricalEdge::R1tg(double theta,R2 & t) const{
@@ -88,45 +137,8 @@
 	}
 	/*}}}1*/
-	/*FUNCTION GeometricalEdge::F{{{1*/
-	R2 GeometricalEdge::F(double theta) const{
-		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/F)*/
-		// parametrization of the curve edge
-
-	   R2 A=v[0]->r,B=v[1]->r;
-		double ca,cb,cta,ctb;
-		if ( theta<-1e-12){
-			ISSMERROR("theta<-1e-12");
-		}
-		if ( theta>1+1e-12){
-			ISSMERROR("theta>1+1e-12");
-		}
-		if (TgA()) 
-		 if (TgB()) // interpolation d'hermite
-			{ cb =  theta*theta*(3-2*theta);
-			 ca =  1-cb;     
-			 cta = (1-theta)*(1-theta)*theta;
-			 ctb = (theta-1)*theta*theta ;
-			}
-		 else { // 1-t*t, t-t*t, t*t
-			 double t = theta;
-			 cb = t*t;
-			 ca = 1-cb;
-			 cta= t-cb;
-			 ctb=0;    
-		 }    
-		else
-		 if (TgB()){
-			 double t = 1-theta;
-			 ca = t*t;
-			 cb = 1-ca;
-			 ctb= -t+ca;
-			 cta=0;    
-		 }
-		 else {
-			 ca =(1-theta),cb = theta,cta=ctb=0; // lagrange P1
-		 }
-		return A*ca + B*cb + tg[0]* cta + tg[1] * ctb;
-	  }
-	/*}}}1*/
+	/*FUNCTION GeometricalEdge::Required{{{1*/
+	int    GeometricalEdge::Required()       {
+		return type &64; 
+	}/*}}}*/
 	/*FUNCTION GeometricalEdge::Set {{{1*/
 	void GeometricalEdge::Set(const GeometricalEdge & rec,const Geometry & Gh ,Geometry & GhNew){ 
@@ -138,4 +150,39 @@
 	}
 	/*}}}*/
-
+	/*FUNCTION GeometricalEdge::SetCracked{{{1*/
+	void   GeometricalEdge::SetCracked()     { 
+		type |= 1;
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::SetTgA{{{1*/
+	void   GeometricalEdge::SetTgA()         { 
+		type |=4; 
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::SetTgB{{{1*/
+	void   GeometricalEdge::SetTgB()         { 
+		type |=8; 
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::SetMark{{{1*/
+	void   GeometricalEdge::SetMark()        { 
+		type |=16;
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::SetUnMark{{{1*/
+	void   GeometricalEdge::SetUnMark()      { 
+		type &= 1007 /* 1023-16*/;
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::SetRequired{{{1*/
+	void   GeometricalEdge::SetRequired()    { 
+		type |= 64; 
+	}/*}}}*/
+	  /*FUNCTION GeometricalEdge::Tg{{{1*/
+	int    GeometricalEdge::Tg(int i) const  {
+		return i==0 ? TgA() : TgB();
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::TgA{{{1*/
+	int    GeometricalEdge::TgA()     const  {
+		return type &4;  
+	}/*}}}*/
+	/*FUNCTION GeometricalEdge::TgB{{{1*/
+	int    GeometricalEdge::TgB()     const  {
+		return type &8;  
+	}/*}}}*/
 }
Index: /issm/trunk/src/c/objects/Bamg/GeometricalEdge.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/GeometricalEdge.h	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/GeometricalEdge.h	(revision 5151)
@@ -29,16 +29,16 @@
 			R2     F(double theta) const ; // parametrization of the curve edge
 			double R1tg(double theta,R2 &t) const ; // 1/radius of curvature + tangente
-			int    Tg(int i) const  {return i==0 ? TgA() : TgB(); }
-			int    Cracked() const  {return type &1;  }
-			int    TgA()     const  {return type &4;  }
-			int    TgB()     const  {return type &8;  }
-			int    Mark()    const  {return type &16; }
-			int    Required()       {return type &64; }
-			void   SetCracked()     { type |= 1;}
-			void   SetTgA()         { type |=4; }
-			void   SetTgB()         { type |=8; }
-			void   SetMark()        { type |=16;}
-			void   SetUnMark()      { type &= 1007 /* 1023-16*/;}
-			void   SetRequired()    { type |= 64; }
+			int    Tg(int i) const;
+			int    Cracked() const;
+			int    TgA()     const;
+			int    TgB()     const;
+			int    Mark()    const;
+			int    Required();
+			void   SetCracked();
+			void   SetTgA();
+			void   SetTgB();
+			void   SetMark();
+			void   SetUnMark();
+			void   SetRequired();
 			void   Set(const GeometricalEdge & rec,const Geometry & Th ,Geometry & ThNew);
 	};
Index: /issm/trunk/src/c/objects/Bamg/MatVVP2x2.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/MatVVP2x2.cpp	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/MatVVP2x2.cpp	(revision 5151)
@@ -41,6 +41,26 @@
 	}
 	/*}}}1*/
+	/*FUNCTION MatVVP2x2::MatVVP2x2(double r1,double r2,const D2 vp1){{{1*/
+	MatVVP2x2::MatVVP2x2(double r1,double r2,const D2 vp1): lambda1(r1),lambda2(r2),v(vp1){
+
+	}/*}}}*/
 
 	/*Methods*/
+	/*FUNCTION MatVVP2x2::Abs{{{1*/
+	void   MatVVP2x2::Abs(){
+		lambda1=bamg::Abs(lambda1),lambda2=bamg::Abs(lambda2);
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Aniso{{{1*/
+	double MatVVP2x2::Aniso() const  { 
+		return sqrt( Aniso2());
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Aniso2{{{1*/
+	double MatVVP2x2::Aniso2() const  { 
+		return lmax()/lmin();
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::BoundAniso{{{1*/
+	void   MatVVP2x2::BoundAniso(const double c){ 
+		BoundAniso2(1/(c*c));
+	}/*}}}*/
 	/*FUNCTION MatVVP2x2::Echo {{{1*/
 	void MatVVP2x2::Echo(void){
@@ -55,4 +75,44 @@
 	}
 	/*}}}*/
+	/*FUNCTION MatVVP2x2::hmin{{{1*/
+	double MatVVP2x2::hmin() const {
+		return sqrt(1/bamg::Max3(lambda1,lambda2,1e-30));
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::hmax{{{1*/
+	double MatVVP2x2::hmax() const {
+		return sqrt(1/bamg::Max(bamg::Min(lambda1,lambda2),1e-30));
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Isotrope{{{1*/
+	void   MatVVP2x2::Isotrope() {
+		lambda1=lambda2=bamg::Max(lambda1,lambda2);
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::lmax{{{1*/
+	double MatVVP2x2::lmax() const {
+		return bamg::Max3(lambda1,lambda2,1e-30);
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::lmin{{{1*/
+	double MatVVP2x2::lmin() const {
+		return bamg::Max(bamg::Min(lambda1,lambda2),1e-30);
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Min{{{1*/
+	void   MatVVP2x2::Min(double a) { 
+		lambda1=bamg::Min(a,lambda1); lambda2=bamg::Min(a,lambda2) ;
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Max{{{1*/
+	void   MatVVP2x2::Max(double a) { 
+		lambda1=bamg::Max(a,lambda1); lambda2=bamg::Max(a,lambda2) ;
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Minh{{{1*/
+	void   MatVVP2x2::Minh(double h) {
+		Min(1.0/(h*h));
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::Maxh{{{1*/
+	void   MatVVP2x2::Maxh(double h) {
+		Max(1.0/(h*h));
+	}/*}}}*/
+	/*FUNCTION MatVVP2x2::pow{{{1*/
+	void   MatVVP2x2::pow(double p){
+		lambda1=::pow(lambda1,p);lambda2=::pow(lambda2,p);
+	}/*}}}*/
 
 } 
Index: /issm/trunk/src/c/objects/Bamg/Metric.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Metric.cpp	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/Metric.cpp	(revision 5151)
@@ -14,4 +14,16 @@
 
 	/*Constructor/Destructor*/
+	/*FUNCTION Metric::Metric(){{{1*/
+	Metric::Metric(){
+
+	}/*}}}*/
+	/*FUNCTION Metric::Metric(double a){{{1*/
+	Metric::Metric(double a): a11(1/(a*a)),a21(0),a22(1/(a*a)){
+	
+	}/*}}}*/
+	/*FUNCTION Metric::Metric(double a,double b,double c){{{1*/
+	Metric::Metric(double a,double b,double c) :a11(a),a21(b),a22(c){
+	
+	}/*}}}*/
 	/*FUNCTION Metric::Metric(const double  a[3],const  Metric m0, const  Metric m1,const  Metric  m2 ){{{1*/ 
 	Metric::Metric(const double  a[3],const  Metric m0, const  Metric m1,const  Metric m2 ){
@@ -35,6 +47,6 @@
 	}
 	/*}}}1*/
-	/*FUNCTION Metric::Metric( double  a,const  Metric ma, double  b,const  Metric mb){{{1*/
-	Metric::Metric( double  a,const  Metric ma, double  b,const  Metric mb) { 
+	/*FUNCTION Metric::Metric(double  a,const  Metric ma, double  b,const  Metric mb){{{1*/
+	Metric::Metric(double  a,const  Metric ma, double  b,const  Metric mb) { 
 		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/MatVVP2x2)*/
 
@@ -55,4 +67,8 @@
 
 	/*Methods*/
+	/*FUNCTION Metric::det{{{1*/
+	double Metric::det() const {
+		return a11*a22-a21*a21;
+	}  /*}}}*/
 	/*FUNCTION Metric::Echo {{{1*/
 	void Metric::Echo(void){
@@ -117,4 +133,8 @@
 	}
 	/*}}}1*/
+	/*FUNCTION Metric::mul{{{1*/
+	R2     Metric::mul(const R2 x)const {
+		return R2(a11*x.x+a21*x.y,a21*x.x+a22*x.y);
+	}/*}}}*/
 
 	/*Intermediary*/
Index: /issm/trunk/src/c/objects/Bamg/Metric.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Metric.h	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/Metric.h	(revision 5151)
@@ -17,22 +17,29 @@
 
 		public:
+
 			//fields
 			double a11,a21,a22;
+
 			//friends
 			friend class MatVVP2x2;
+
 			//functions
-			Metric(){};
+			Metric();
 			Metric(const MatVVP2x2);
-			Metric(double a): a11(1/(a*a)),a21(0),a22(1/(a*a)){}
-			Metric(double a,double b,double c) :a11(a),a21(b),a22(c){}
+			Metric(double a);
+			Metric(double a,double b,double c);
 			Metric( double  a,const  Metric ma, double  b,const  Metric mb);
 			Metric(const double  a[3],const  Metric m0,const  Metric m1,const  Metric m2 );
-			void  Echo();
-			R2    mul(const R2 x)const {return R2(a11*x.x+a21*x.y,a21*x.x+a22*x.y);}
-			double det() const {return a11*a22-a21*a21;}  
-			R2    Orthogonal(const R2 x){return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y);}
-			R2    Orthogonal(const I2 x){return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y);}
-			int   IntersectWith(const Metric M2);
-			inline void Box(double &hx,double &hy) const ;  
+			void        Echo();
+			R2          mul(const R2 x)const;
+			double      det() const;
+			int         IntersectWith(const  Metric M2);
+			inline void Box(double &hx,double &hy) const;
+
+			/*The following functions must remain the the header file because it is called before Metric
+			 * is compiled by other classes*/
+			R2 Orthogonal(const R2 x){ return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y); }
+			R2 Orthogonal(const I2 x){ return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y); }
+
 			//operators
 			Metric operator*(double c) const {double c2=c*c;return  Metric(a11*c2,a21*c2,a22*c2);} 
@@ -46,28 +53,32 @@
 	class MatVVP2x2{
 		public:
+
 			//fields
 			double lambda1,lambda2;
 			D2     v;
+
 			//friends
 			friend  class Metric;
+
 			//functions
 			MatVVP2x2(const Metric );
-			MatVVP2x2(double r1,double r2,const D2 vp1): lambda1(r1),lambda2(r2),v(vp1){}
-			void  Echo();
-			void  Abs(){lambda1=bamg::Abs(lambda1),lambda2=bamg::Abs(lambda2);}
-			void  pow(double p){lambda1=::pow(lambda1,p);lambda2=::pow(lambda2,p);}
-			void  Min(double a) { lambda1=bamg::Min(a,lambda1); lambda2=bamg::Min(a,lambda2) ;}
-			void  Max(double a) { lambda1=bamg::Max(a,lambda1); lambda2=bamg::Max(a,lambda2) ;}
-			void Minh(double h) {Min(1.0/(h*h));}
-			void Maxh(double h) {Max(1.0/(h*h));}
-			void Isotrope() {lambda1=lambda2=bamg::Max(lambda1,lambda2);}
-			double hmin() const {return sqrt(1/bamg::Max3(lambda1,lambda2,1e-30));}
-			double hmax() const {return sqrt(1/bamg::Max(bamg::Min(lambda1,lambda2),1e-30));}
-			double lmax() const {return bamg::Max3(lambda1,lambda2,1e-30);}
-			double lmin() const {return bamg::Max(bamg::Min(lambda1,lambda2),1e-30);}
-			double Aniso2() const  { return lmax()/lmin();}
-			double Aniso() const  { return sqrt( Aniso2());}
-			void BoundAniso(const double c){ BoundAniso2(1/(c*c));}
+			MatVVP2x2(double r1,double r2,const D2 vp1);
+			void   Echo();
+			void   Abs();
+			void   pow(double  p);
+			void   Min(double  a);
+			void   Max(double  a);
+			void   Minh(double h);
+			void   Maxh(double h);
+			void   Isotrope();
+			double hmin()   const;
+			double hmax()   const;
+			double lmax()   const;
+			double lmin()   const;
+			double Aniso2() const;
+			double Aniso()  const;
+			void   BoundAniso(const  double c);
 			inline void BoundAniso2(const double coef);
+
 			//operators
 			void operator *=(double coef){ lambda1*=coef;lambda2*=coef;}
Index: /issm/trunk/src/c/objects/Bamg/Triangle.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Triangle.cpp	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/Triangle.cpp	(revision 5151)
@@ -42,4 +42,8 @@
 
 	/*Methods*/
+	/*FUNCTION Triangle::Adj{{{1*/
+	AdjacentTriangle Triangle::Adj(int i)  const {
+		return AdjacentTriangle(adj[i],AdjEdgeNumber[i]&3);
+	};/*}}}*/
 	/*FUNCTION Triangle::Echo {{{1*/
 	void Triangle::Echo(void){
@@ -120,4 +124,21 @@
 	}
 	/*}}}1*/
+	/*FUNCTION Triangle::GetAllflag{{{1*/
+	int    Triangle::GetAllflag(int a){
+		return AdjEdgeNumber[a] & 1020;
+	}/*}}}*/
+	/*FUNCTION Triangle::Hidden{{{1*/
+	int    Triangle::Hidden(int a)const {
+		return AdjEdgeNumber[a]&16;
+	} /*}}}*/
+	/*FUNCTION Triangle::Locked{{{1*/
+	int    Triangle::Locked(int a)const {
+		return AdjEdgeNumber[a]&4;
+	} /*}}}*/
+	/*FUNCTION Triangle::NuEdgeTriangleAdj{{{1*/
+	short  Triangle::NuEdgeTriangleAdj(int i) const {
+		// Number of the  adjacent edge in adj tria  
+		return AdjEdgeNumber[i&3]&3;
+	}/*}}}*/
 	/*FUNCTION Triangle::Optim{{{1*/
 	long  Triangle::Optim(short i,int koption) {
@@ -197,4 +218,18 @@
 	}
 	/*}}}*/
+	/*FUNCTION Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){{{1*/
+	void  Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){
+
+		if (link  >=tb && link  <te) link  = tb + renu[link -tb];
+		if (adj[0] >=tb && adj[0] <te) adj[0] = tb + renu[adj[0]-tb];
+		if (adj[1] >=tb && adj[1] <te) adj[1] = tb + renu[adj[1]-tb];
+		if (adj[2] >=tb && adj[2] <te) adj[2] = tb + renu[adj[2]-tb];    
+	}/*}}}*/
+	/*FUNCTION Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){{{1*/
+	void Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){
+		if (vertices[0] >=vb && vertices[0] <ve) vertices[0] = vb + renu[vertices[0]-vb];
+		if (vertices[1] >=vb && vertices[1] <ve) vertices[1] = vb + renu[vertices[1]-vb];
+		if (vertices[2] >=vb && vertices[2] <ve) vertices[2] = vb + renu[vertices[2]-vb];    
+	}/*}}}*/
 	/*FUNCTION Triangle::Set {{{1*/
 	void Triangle::Set(const Triangle & rec,const Mesh & Th ,Mesh & ThNew){ 
@@ -210,4 +245,68 @@
 	}
 	/*}}}*/
+	/*FUNCTION Triangle::SetAdjAdj{{{1*/
+	void Triangle::SetAdjAdj(short a){
+		// Copy all the mark 
+		a &= 3;
+		register Triangle *tt=adj[a];
+		AdjEdgeNumber [a] &= 55; // remove MarkUnSwap
+		register short aatt = AdjEdgeNumber[a] & 3;
+		if(tt){ 
+			tt->adj[aatt]=this;
+			tt->AdjEdgeNumber[aatt]=a + (AdjEdgeNumber[a] & 60 ) ;
+		}
+	}/*}}}*/
+	/*FUNCTION Triangle::SetAdj2{{{1*/
+	void Triangle::SetAdj2(short a,Triangle *t,short aat){
+		adj[a]=t;    //the adjacent triangle to the edge a is t
+		AdjEdgeNumber[a]=aat; //position of the edge in the adjacent triangle
+		if(t) { //if t!=NULL add adjacent triangle to t (this)
+			t->adj[aat]=this;
+			t->AdjEdgeNumber[aat]=a;
+		}
+	}/*}}}*/
+	/*FUNCTION Triangle::SetAllFlag{{{1*/
+	void   Triangle::SetAllFlag(int a,int f){
+		AdjEdgeNumber[a] = (AdjEdgeNumber[a] &3) + (1020 & f);
+	}/*}}}*/
+	/*FUNCTION Triangle::SetDet{{{1*/
+	void Triangle::SetDet() {
+		if(vertices[0] && vertices[1] && vertices[2])    det = bamg::det(*vertices[0],*vertices[1],*vertices[2]);
+		else det = -1; 
+	}/*}}}*/
+	/*FUNCTION Triangle::SetHidden{{{1*/
+	void Triangle::SetHidden(int a){
+		//Get Adjacent Triangle number a
+		register Triangle* t = adj[a];
+		//if it exist
+		//C|=D -> C=(C|D) bitwise inclusive OR
+		if(t) t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=16;
+		AdjEdgeNumber[a] |= 16;
+	}/*}}}*/
+	/*FUNCTION Triangle::SetLocked{{{1*/
+	void Triangle::SetLocked(int a){
+		//mark the edge as on Boundary
+		register Triangle * t = adj[a];
+		t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=4;
+		AdjEdgeNumber[a] |= 4;
+	}/*}}}*/
+	/*FUNCTION Triangle::SetMarkUnSwap{{{1*/
+	void Triangle::SetMarkUnSwap(int a){
+		register Triangle * t = adj[a];
+		t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=8;
+		AdjEdgeNumber[a] |=8 ;
+	}/*}}}*/
+	/*FUNCTION Triangle::SetSingleVertexToTriangleConnectivity{{{1*/
+	void Triangle::SetSingleVertexToTriangleConnectivity() { 
+		if (vertices[0]) (vertices[0]->t=this,vertices[0]->vint=0);
+		if (vertices[1]) (vertices[1]->t=this,vertices[1]->vint=1);
+		if (vertices[2]) (vertices[2]->t=this,vertices[2]->vint=2);
+	}/*}}}*/
+	/*FUNCTION Triangle::SetUnMarkUnSwap{{{1*/
+	void Triangle::SetUnMarkUnSwap(int a){ 
+		register Triangle * t = adj[a];
+		t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] &=55; // 23 + 32 
+		AdjEdgeNumber[a] &=55 ;
+	}/*}}}*/
 	/*FUNCTION Triangle::swap{{{1*/
 	int Triangle::swap(short a,int koption){
@@ -325,4 +424,8 @@
 	}
 	/*}}}1*/
+	/*FUNCTION Triangle::TriangleAdj{{{1*/
+	Triangle* Triangle::TriangleAdj(int i) const {
+		return adj[i&3];
+	}/*}}}*/
 
 }
Index: /issm/trunk/src/c/objects/Bamg/Triangle.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/Triangle.h	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/Triangle.h	(revision 5151)
@@ -40,78 +40,27 @@
 
 			//Methods
-			void   Echo();
-			int    swap(short a1,int=0);
-			long   Optim(short a,int =0);
-			int    Locked(int a)const { return AdjEdgeNumber[a]&4;} 
-			int    Hidden(int a)const { return AdjEdgeNumber[a]&16;} 
-			int    GetAllflag(int a){return AdjEdgeNumber[a] & 1020;}
-			void   SetAllFlag(int a,int f){AdjEdgeNumber[a] = (AdjEdgeNumber[a] &3) + (1020 & f);}
-			double QualityQuad(int a,int option=1) const;
-			short  NuEdgeTriangleAdj(int i) const {return AdjEdgeNumber[i&3]&3;} // Number of the  adjacent edge in adj tria  
-			AdjacentTriangle FindBoundaryEdge(int i) const;
-			AdjacentTriangle Adj(int i)  const {return AdjacentTriangle(adj[i],AdjEdgeNumber[i]&3);};
-			Triangle* TriangleAdj(int i) const {return adj[i&3];}
-			Triangle* Quadrangle(BamgVertex * & v0,BamgVertex * & v1,BamgVertex * & v2,BamgVertex * & v3) const ;
-			void  Renumbering(Triangle *tb,Triangle *te, long *renu){
-				if (link  >=tb && link  <te) link  = tb + renu[link -tb];
-				if (adj[0] >=tb && adj[0] <te) adj[0] = tb + renu[adj[0]-tb];
-				if (adj[1] >=tb && adj[1] <te) adj[1] = tb + renu[adj[1]-tb];
-				if (adj[2] >=tb && adj[2] <te) adj[2] = tb + renu[adj[2]-tb];    
-			}
-			void Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){
-				if (vertices[0] >=vb && vertices[0] <ve) vertices[0] = vb + renu[vertices[0]-vb];
-				if (vertices[1] >=vb && vertices[1] <ve) vertices[1] = vb + renu[vertices[1]-vb];
-				if (vertices[2] >=vb && vertices[2] <ve) vertices[2] = vb + renu[vertices[2]-vb];    
-			}
-			void SetAdjAdj(short a){
-				a &= 3;
-				register Triangle *tt=adj[a];
-				AdjEdgeNumber [a] &= 55; // remove MarkUnSwap
-				register short aatt = AdjEdgeNumber[a] & 3;
-				if(tt){ 
-					tt->adj[aatt]=this;
-					tt->AdjEdgeNumber[aatt]=a + (AdjEdgeNumber[a] & 60 ) ;}// Copy all the mark 
-			  }
-			void SetAdj2(short a,Triangle *t,short aat){
-				adj[a]=t;    //the adjacent triangle to the edge a is t
-				AdjEdgeNumber[a]=aat; //position of the edge in the adjacent triangle
-				if(t) { //if t!=NULL add adjacent triangle to t (this)
-					t->adj[aat]=this;
-					t->AdjEdgeNumber[aat]=a;
-				}
-			}
-			void SetSingleVertexToTriangleConnectivity() { 
-				if (vertices[0]) (vertices[0]->t=this,vertices[0]->vint=0);
-				if (vertices[1]) (vertices[1]->t=this,vertices[1]->vint=1);
-				if (vertices[2]) (vertices[2]->t=this,vertices[2]->vint=2);
-			}
-			void SetHidden(int a){
-				//Get Adjacent Triangle number a
-				register Triangle* t = adj[a];
-				//if it exist
-				//C|=D -> C=(C|D) bitwise inclusive OR
-				if(t) t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=16;
-				AdjEdgeNumber[a] |= 16;
-			}
-
-			void SetLocked(int a){
-				//mark the edge as on Boundary
-				register Triangle * t = adj[a];
-				t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=4;
-				AdjEdgeNumber[a] |= 4;
-			}
-			void SetMarkUnSwap(int a){
-				register Triangle * t = adj[a];
-				t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=8;
-				AdjEdgeNumber[a] |=8 ;
-			}
-			void SetUnMarkUnSwap(int a){ 
-				register Triangle * t = adj[a];
-				t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] &=55; // 23 + 32 
-				AdjEdgeNumber[a] &=55 ;
-			}
-			void SetDet() {
-				if(vertices[0] && vertices[1] && vertices[2])    det = bamg::det(*vertices[0],*vertices[1],*vertices[2]);
-				else det = -1; }
+			void              Echo();
+			int               swap(short a1,int=0);
+			long              Optim(short a,int =0);
+			int               Locked(int a)const;
+			int               Hidden(int a)const;
+			int               GetAllflag(int a);
+			void              SetAllFlag(int a,int f);
+			double            QualityQuad(int a,int option=1) const;
+			short             NuEdgeTriangleAdj(int i) const;
+			AdjacentTriangle  FindBoundaryEdge(int  i) const;
+			AdjacentTriangle  Adj(int i) const;
+			Triangle         *TriangleAdj(int i) const;
+			Triangle         *Quadrangle(BamgVertex  *& v0,BamgVertex *& v1,BamgVertex *& v2,BamgVertex *& v3) const;
+			void              Renumbering(Triangle   *tb,Triangle *te, long *renu);
+			void              Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu);
+			void              SetAdjAdj(short a);
+			void              SetAdj2(short a,Triangle *t,short aat);
+			void              SetSingleVertexToTriangleConnectivity();
+			void              SetHidden(int a);
+			void              SetLocked(int a);
+			void              SetMarkUnSwap(int a);
+			void              SetUnMarkUnSwap(int a);
+			void              SetDet();
 
 			//Inline methods
Index: /issm/trunk/src/c/objects/Bamg/VertexOnVertex.cpp
===================================================================
--- /issm/trunk/src/c/objects/Bamg/VertexOnVertex.cpp	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/VertexOnVertex.cpp	(revision 5151)
@@ -10,4 +10,12 @@
 
 	/*Constructors/Destructors*/
+	/*FUNCTION VertexOnVertex::VertexOnVertex(){{{1*/
+	VertexOnVertex::VertexOnVertex() {
+	
+	};/*}}}*/
+	/*FUNCTION VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw){{{1*/
+	VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw) :v(w),bv(bw){
+	
+	}/*}}}*/
 
 	/*Methods*/
@@ -18,4 +26,8 @@
 	}
 	/*}}}*/
+	/*FUNCTION VertexOnVertex::SetOnBTh{{{1*/
+	void VertexOnVertex::SetOnBTh(){
+		v->BackgroundVertexHook=bv;v->vint=IsVertexOnVertex;
+	}/*}}}*/
 
 } 
Index: /issm/trunk/src/c/objects/Bamg/VertexOnVertex.h
===================================================================
--- /issm/trunk/src/c/objects/Bamg/VertexOnVertex.h	(revision 5150)
+++ /issm/trunk/src/c/objects/Bamg/VertexOnVertex.h	(revision 5151)
@@ -17,9 +17,9 @@
 
 			//Constructors
-			VertexOnVertex(BamgVertex * w,BamgVertex *bw) :v(w),bv(bw){}
-			VertexOnVertex() {};
+			VertexOnVertex();
+			VertexOnVertex(BamgVertex * w,BamgVertex *bw);
 
 			//Methods
-			void SetOnBTh(){v->BackgroundVertexHook=bv;v->vint=IsVertexOnVertex;}
+			void SetOnBTh();
 			void Set(const Mesh &,long,Mesh &);
 	};
