Index: /issm/trunk/src/c/Bamgx/BamgObjects.h
===================================================================
--- /issm/trunk/src/c/Bamgx/BamgObjects.h	(revision 3253)
+++ /issm/trunk/src/c/Bamgx/BamgObjects.h	(revision 3254)
@@ -33,39 +33,4 @@
 namespace bamg {
 	
-	/*INLINE functions{{{1*/
-	inline  TriangleAdjacent Adj(const TriangleAdjacent & a)
-	  { return  a.Adj();}
-
-	inline TriangleAdjacent Next(const TriangleAdjacent & ta) 
-	  { return TriangleAdjacent(ta.t,NextEdge[ta.a]);}
-
-	inline TriangleAdjacent Previous(const TriangleAdjacent & ta) 
-	  { return TriangleAdjacent(ta.t,PreviousEdge[ta.a]);}
-	inline void Adj(GeometricalEdge * & on,int &i) 
-	  {int j=i;i=on->DirAdj[i];on=on->Adj[j];}
-	inline double qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)
-	  {
-		double ret; 
-		I2 ia=va,ib=vb,ic=vc;
-		I2 ab=ib-ia,bc=ic-ib,ac=ic-ia;
-		Icoor2 deta=Det(ab,ac);
-		if (deta <=0) ret = -1;
-		else {
-			double a = sqrt((double) (ac,ac)),
-					b = sqrt((double) (bc,bc)),
-					c = sqrt((double) (ab,ab)),
-					p = a+b+c;
-			double h= Max(Max(a,b),c),ro=deta/p;
-			ret = ro/h;}
-			return ret;
-	  }
-	Icoor2 inline det(const Vertex & a,const Vertex & b,const Vertex & c){
-		register  Icoor2 bax = b.i.x - a.i.x ,bay = b.i.y - a.i.y; 
-		register  Icoor2 cax = c.i.x - a.i.x ,cay = c.i.y - a.i.y; 
-		return  bax*cay - bay*cax;
-	}
-
-	/*}}}1*/
-
 	/*INLINE functions of CLASS VertexOnVertex{{{1*/
 	inline void VertexOnVertex::Set(const Triangles & Th ,long i,Triangles & ThNew) { 
Index: /issm/trunk/src/c/Bamgx/shared/Adj.h
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/Adj.h	(revision 3254)
+++ /issm/trunk/src/c/Bamgx/shared/Adj.h	(revision 3254)
@@ -0,0 +1,19 @@
+#ifndef _ADJ_H_
+#define _ADJ_H_
+
+#include "../meshtype.h"
+#include "../objects/TriangleAdjacent.h"
+#include "../objects/GeometricalEdge.h"
+
+namespace bamg {
+
+	inline  TriangleAdjacent Adj(const TriangleAdjacent & a){
+		return  a.Adj();
+	}
+
+	inline void Adj(GeometricalEdge * & on,int &i){
+		int j=i;i=on->DirAdj[i];on=on->Adj[j];
+	}
+
+}
+#endif
Index: /issm/trunk/src/c/Bamgx/shared/BigPrimeNumber.cpp
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/BigPrimeNumber.cpp	(revision 3254)
+++ /issm/trunk/src/c/Bamgx/shared/BigPrimeNumber.cpp	(revision 3254)
@@ -0,0 +1,36 @@
+#undef __FUNCT__ 
+#define __FUNCT__ "BigPrimeNumber"
+
+#include "./BigPrimeNumber.h"
+
+namespace bamg {
+
+	long BigPrimeNumber(long n){
+		/*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/AGoodNumberPrimeWith)*/
+
+		//list of big prime numbers
+		const long BigPrimeNumber[] ={ 567890359L,
+			567890431L,  567890437L,  567890461L,  567890471L,
+			567890483L,  567890489L,  567890497L,  567890507L,
+			567890591L,  567890599L,  567890621L,  567890629L , 0};
+
+		//initialize o and pi
+		long o =0;
+		long pi=BigPrimeNumber[1];
+
+		//loop until BigPrimeNumber[i]==0 (end of BigPrimeNumber)
+		for (int i=0; BigPrimeNumber[i]; i++){
+
+			//compute r, rest of the remainder of the division of BigPrimeNumber[i] by n
+			long r = BigPrimeNumber[i] % n;
+
+			/*compute oo = min ( r , n-r , |n - 2r|, |n-3r|)*/
+			long oo = Min(Min(r,n-r),Min(Abs(n-2*r),Abs(n-3*r)));
+			if ( o < oo){
+				o=oo;
+				pi=BigPrimeNumber[i];
+			}
+		}
+		return pi; 
+	}
+}
Index: /issm/trunk/src/c/Bamgx/shared/BigPrimeNumber.h
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/BigPrimeNumber.h	(revision 3254)
+++ /issm/trunk/src/c/Bamgx/shared/BigPrimeNumber.h	(revision 3254)
@@ -0,0 +1,11 @@
+#ifndef _BIGPRIMENUMBER_H_
+#define _BIGPRIMENUMBER_H_
+
+#include "../meshtype.h"
+
+namespace bamg {
+
+	long BigPrimeNumber(long n);
+
+}
+#endif
Index: /issm/trunk/src/c/Bamgx/shared/Next.h
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/Next.h	(revision 3254)
+++ /issm/trunk/src/c/Bamgx/shared/Next.h	(revision 3254)
@@ -0,0 +1,14 @@
+#ifndef _NEXT_H_
+#define _NEXT_H_
+
+#include "../meshtype.h"
+#include "../objects/TriangleAdjacent.h"
+
+namespace bamg {
+
+	inline TriangleAdjacent Next(const TriangleAdjacent & ta){
+		return TriangleAdjacent(ta.t,NextEdge[ta.a]);
+	}
+
+}
+#endif
Index: /issm/trunk/src/c/Bamgx/shared/Previous.h
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/Previous.h	(revision 3254)
+++ /issm/trunk/src/c/Bamgx/shared/Previous.h	(revision 3254)
@@ -0,0 +1,14 @@
+#ifndef _PREVIOUS_H_
+#define _PREVIOUS_H_
+
+#include "../meshtype.h"
+#include "../objects/TriangleAdjacent.h"
+
+namespace bamg {
+
+	inline TriangleAdjacent Previous(const TriangleAdjacent & ta){
+		return TriangleAdjacent(ta.t,PreviousEdge[ta.a]);
+	}
+
+}
+#endif
Index: /issm/trunk/src/c/Bamgx/shared/qualite.h
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/qualite.h	(revision 3254)
+++ /issm/trunk/src/c/Bamgx/shared/qualite.h	(revision 3254)
@@ -0,0 +1,27 @@
+#ifndef _QUALITE_H_
+#define _QUALITE_H_
+
+#include "../meshtype.h"
+#include "../objects/Vertex.h"
+
+namespace bamg {
+
+	inline double qualite(const Vertex &va,const Vertex &vb,const Vertex &vc){
+		double ret; 
+		I2 ia=va,ib=vb,ic=vc;
+		I2 ab=ib-ia,bc=ic-ib,ac=ic-ia;
+		Icoor2 deta=Det(ab,ac);
+		if (deta <=0) ret = -1;
+		else {
+			double a = sqrt((double) (ac,ac)),
+					 b = sqrt((double) (bc,bc)),
+					 c = sqrt((double) (ab,ab)),
+					 p = a+b+c;
+			double h= Max(Max(a,b),c),ro=deta/p;
+			ret = ro/h;
+		}
+		return ret;
+	}
+
+}
+#endif
Index: /issm/trunk/src/c/Bamgx/shared/shared.h
===================================================================
--- /issm/trunk/src/c/Bamgx/shared/shared.h	(revision 3253)
+++ /issm/trunk/src/c/Bamgx/shared/shared.h	(revision 3254)
@@ -8,4 +8,8 @@
 
 #include "BigPrimeNumber.h"
+#include "qualite.h"
+#include "Next.h"
+#include "Previous.h"
+#include "Adj.h"
 #include "TheVertex.h"
 #include "FindTriangleAdjacent.h"
Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 3253)
+++ /issm/trunk/src/c/Makefile.am	(revision 3254)
@@ -360,4 +360,8 @@
 					./Bamgx/shared/BigPrimeNumber.h\
 					./Bamgx/shared/BigPrimeNumber.cpp\
+					./Bamgx/shared/Adj.h\
+					./Bamgx/shared/Next.h\
+					./Bamgx/shared/Previous.h\
+					./Bamgx/shared/qualite.h\
 					./Bamgx/objects/Triangles.cpp\
 					./Bamgx/objects/Triangles.h\
@@ -728,4 +732,8 @@
 					./Bamgx/shared/BigPrimeNumber.h\
 					./Bamgx/shared/BigPrimeNumber.cpp\
+					./Bamgx/shared/Adj.h\
+					./Bamgx/shared/Next.h\
+					./Bamgx/shared/Previous.h\
+					./Bamgx/shared/qualite.h\
 					./Bamgx/objects/Triangles.cpp\
 					./Bamgx/objects/Triangles.h\
