Index: ../trunk-jpl/src/c/bamg/BamgVertex.h
===================================================================
--- ../trunk-jpl/src/c/bamg/BamgVertex.h	(revision 18454)
+++ ../trunk-jpl/src/c/bamg/BamgVertex.h	(revision 18455)
@@ -22,6 +22,7 @@
 			R2        r;                 // real coordinates
 			Metric    m;
 			long      ReferenceNumber;
+			long      PreviousNumber;
 			Direction DirOfSearch;
 			short     IndexInTriangle;              // the vertex number in triangle; varies between 0 and 2 in t
 
@@ -41,6 +42,7 @@
 			double operator()(R2 x) const { return m(x);} // Get x in the metric m
 
 			/*methods (No constructor and no destructors...)*/
+			BamgVertex();
 			double Smoothing(Mesh & ,const Mesh & ,Triangle  * & ,double =1);
 			void   MetricFromHessian(const double Hxx,const double Hyx, const double Hyy, const double smin,const double smax,const double s,const double err,BamgOpts* bamgopts);
 			void   Echo();
Index: ../trunk-jpl/src/c/bamg/BamgMesh.cpp
===================================================================
--- ../trunk-jpl/src/c/bamg/BamgMesh.cpp	(revision 18454)
+++ ../trunk-jpl/src/c/bamg/BamgMesh.cpp	(revision 18455)
@@ -4,7 +4,7 @@
 /*Constructors/Destructors*/
 BamgMesh::BamgMesh(){/*{{{*/
 
-	this->VerticesSize[0]=0,                  this->VerticesSize[1]=0;                 this->Vertices=NULL;
+	this->VerticesSize[0]=0,                  this->VerticesSize[1]=0;                 this->Vertices=NULL;          this->PreviousNumbering = NULL;
 	this->EdgesSize[0]=0,                     this->EdgesSize[1]=0;                    this->Edges=NULL;
 	this->TrianglesSize[0]=0,                 this->TrianglesSize[1]=0;                this->Triangles=NULL;
 	this->QuadrilateralsSize[0]=0,            this->QuadrilateralsSize[1]=0;           this->Quadrilaterals=NULL;
@@ -29,6 +29,7 @@
 BamgMesh::~BamgMesh(){/*{{{*/
 
 	xDelete<double>(this->Vertices);
+	xDelete<double>(this->PreviousNumbering);
 	xDelete<double>(this->Edges);
 	xDelete<double>(this->Triangles);
 	xDelete<double>(this->Quadrilaterals);
Index: ../trunk-jpl/src/c/bamg/BamgVertex.cpp
===================================================================
--- ../trunk-jpl/src/c/bamg/BamgVertex.cpp	(revision 18454)
+++ ../trunk-jpl/src/c/bamg/BamgVertex.cpp	(revision 18455)
@@ -9,6 +9,11 @@
 
 namespace bamg {
 
+	/*Constructor/Destructor*/
+	BamgVertex::BamgVertex(){ /*{{{*/
+		this->PreviousNumber = 0;
+	}/*}}}*/
+
 	/*Methods*/
 	void BamgVertex::Echo(void){/*{{{*/
 
@@ -16,6 +21,7 @@
 		_printf_("  integer   coordinates i.x: " << i.x << ", i.y: " << i.y << "\n");
 		_printf_("  Euclidean coordinates r.x: " << r.x << ", r.y: " << r.y << "\n");
 		_printf_("  ReferenceNumber = " << ReferenceNumber << "\n");
+		_printf_("  PreviousNumber  = " << PreviousNumber << "\n");
 		m.Echo();
 
 		return;
Index: ../trunk-jpl/src/c/bamg/BamgMesh.h
===================================================================
--- ../trunk-jpl/src/c/bamg/BamgMesh.h	(revision 18454)
+++ ../trunk-jpl/src/c/bamg/BamgMesh.h	(revision 18455)
@@ -10,6 +10,7 @@
 
 		int     VerticesSize[2];
 		double* Vertices;
+		double* PreviousNumbering;
 		int     EdgesSize[2];
 		double* Edges;
 		int     TrianglesSize[2];
Index: ../trunk-jpl/src/c/bamg/Mesh.cpp
===================================================================
--- ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 18454)
+++ ../trunk-jpl/src/c/bamg/Mesh.cpp	(revision 18455)
@@ -570,12 +570,14 @@
 		if(verbose>5) _printf_("      writing Vertices\n");
 		bamgmesh->VerticesSize[0]=nbv;
 		bamgmesh->VerticesSize[1]=3;
-		if (nbv){
+		if(nbv){
 			bamgmesh->Vertices=xNew<double>(3*nbv);
+			bamgmesh->PreviousNumbering=xNew<double>(nbv);
 			for (i=0;i<nbv;i++){
 				bamgmesh->Vertices[i*3+0]=vertices[i].r.x;
 				bamgmesh->Vertices[i*3+1]=vertices[i].r.y;
 				bamgmesh->Vertices[i*3+2]=vertices[i].GetReferenceNumber();
+				bamgmesh->PreviousNumbering[i]=vertices[i].PreviousNumber;
 			}
 		}
 
@@ -3145,7 +3147,8 @@
 			for (i=0;i<Bh.nbv;i++){ 
 				BamgVertex &bv=Bh[i];
 				if (!bv.GeomEdgeHook){
-					vertices[nbv].r   = bv.r;
+					vertices[nbv].r              = bv.r;
+					vertices[nbv].PreviousNumber = i+1;
 					vertices[nbv++].m = bv.m;
 				}
 			}
Index: ../trunk-jpl/src/m/classes/bamgmesh.m
===================================================================
--- ../trunk-jpl/src/m/classes/bamgmesh.m	(revision 18454)
+++ ../trunk-jpl/src/m/classes/bamgmesh.m	(revision 18455)
@@ -22,6 +22,7 @@
 		NodalElementConnectivity=[];
 		CrackedVertices=[];
 		CrackedEdges=[];
+		PreviousNumbering=[];
 		% }}}
 	end
 	methods
