diff --git a/Mesh/BDS.cpp b/Mesh/BDS.cpp
index e5a0f55747bf9c612e45b8fa9c064b78fb5b2762..9b58f9ff7d9bee8b0b6839fcd84769fd822bbd98 100644
--- a/Mesh/BDS.cpp
+++ b/Mesh/BDS.cpp
@@ -2551,6 +2551,7 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
 	e->g = ((*it)->g)? get_geom  ((*it)->g->classif_tag,(*it)->g->classif_degree) : 0;
 	if (e->g->classif_degree == 1)
 	    e->g->e.push_back(e);
+	e->partition = (*it)->partition;
     }
     for (std::list<BDS_Triangle*>::const_iterator it  = other.triangles.begin();
 	 it != other.triangles.end();
@@ -2561,7 +2562,7 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
 	BDS_Triangle *t = add_triangle(n[0]->iD,n[1]->iD,n[2]->iD);
 	t->g = get_geom  ((*it)->g->classif_tag,(*it)->g->classif_degree);
 	t->g->t.push_back(t);
-	t->status = (*it)->status;
+	t->partition = (*it)->partition;
     } 
 
     for (std::list<BDS_Tet*>::const_iterator it  = other.tets.begin();
@@ -2573,7 +2574,7 @@ BDS_Mesh::BDS_Mesh (const BDS_Mesh &other)
 	BDS_Tet *t = add_tet(n[0]->iD,n[1]->iD,n[2]->iD,n[3]->iD);
 	t->g = get_geom  ((*it)->g->classif_tag,(*it)->g->classif_degree);
 	//	t->g->t.push_back(t);
-	t->status = (*it)->status;
+	t->partition = (*it)->partition;
     }
 
 }
diff --git a/Mesh/BDS.h b/Mesh/BDS.h
index 7c8a59c2819ef182fba996c9f07979467f9db607..6c2aa1f8987847fa3dc065b29efc2e915cbc2bf0 100644
--- a/Mesh/BDS.h
+++ b/Mesh/BDS.h
@@ -252,6 +252,7 @@ class BDS_Edge
 public:
     bool deleted;
     int status;
+    int partition;
     double target_length;
     BDS_Point *p1,*p2;
     BDS_GeomEntity *g;
@@ -309,7 +310,7 @@ public:
     inline void oppositeof (BDS_Point * oface[2]) const; 
 
     BDS_Edge ( BDS_Point *A, BDS_Point *B )
-      : deleted(false), status(0),target_length(1.0),g(0)
+      : deleted(false), status(0),partition(0),target_length(1.0),g(0)
 	{	    
 	    if (*A < *B) 
 	    {
@@ -331,6 +332,7 @@ class BDS_Triangle
 public:
     bool deleted;
     int status;
+    int partition;
     BDS_Tet  *t1,*t2;
     BDS_Edge *e1,*e2,*e3;
     BDS_Vector NORMAL;
@@ -402,7 +404,7 @@ public:
 	}
 
     BDS_Triangle ( BDS_Edge *A, BDS_Edge *B, BDS_Edge *C)
-	: deleted (false) , status(0), t1(0),t2(0),e1(A),e2(B),e3(C),g(0)
+	: deleted (false) , status(0), partition(0),t1(0),t2(0),e1(A),e2(B),e3(C),g(0)
 	{	
 	    e1->addface(this);
 	    e2->addface(this);
@@ -416,6 +418,7 @@ class BDS_Tet
 public:
     bool deleted;
     int status;
+    int partition;
     BDS_Triangle  *f1,*f2,*f3,*f4;
     double volume;
     inline double V() const {return volume;}
@@ -445,7 +448,7 @@ public:
 	}
 
     BDS_Tet ( BDS_Triangle *A, BDS_Triangle *B, BDS_Triangle *C, BDS_Triangle *D)
-	: deleted (false) , status(0), f1(A),f2(B),f3(C),f4(D),g(0)
+	: deleted (false) , status(0), partition(0),f1(A),f2(B),f3(C),f4(D),g(0)
 	{	
 	    f1->addtet(this);
 	    f2->addtet(this);
diff --git a/Mesh/DiscreteSurface.cpp b/Mesh/DiscreteSurface.cpp
index 47d05cc7278c3f6146613e59a1789903f8a2530c..a3804cfebec620e02d8cfc70957974370f82e5ba 100644
--- a/Mesh/DiscreteSurface.cpp
+++ b/Mesh/DiscreteSurface.cpp
@@ -1,4 +1,4 @@
-// $Id: DiscreteSurface.cpp,v 1.24 2005-09-07 14:36:45 remacle Exp $
+// $Id: DiscreteSurface.cpp,v 1.25 2005-09-07 17:12:16 remacle Exp $
 //
 // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
 //
@@ -233,7 +233,7 @@ void BDS_To_Mesh_2(Mesh *m)
 	    if(s)
 	      {
 		simp->iEnt = g->classif_tag;
-		simp->iPart = addMeshPartition((*it)->status, m);
+		simp->iPart = addMeshPartition((*it)->partition, m);
 	      }
 	    else
 	      printf("impossible to find surface %d\n",g->classif_tag);
@@ -258,7 +258,7 @@ void BDS_To_Mesh_2(Mesh *m)
       if(v)
 	{
 	  simp->iEnt = g->classif_tag;
-	  simp->iPart = addMeshPartition((*it)->status, m);
+	  simp->iPart = addMeshPartition((*it)->partition, m);
 	}
       else
 	printf("argh\n");
diff --git a/Mesh/PartitionMesh.cpp b/Mesh/PartitionMesh.cpp
index d9c509be3b222073cf9bcd85a8f6799c05bbfe15..29a658cd3b2200c0f64b6274d4ec5f840c7db31a 100644
--- a/Mesh/PartitionMesh.cpp
+++ b/Mesh/PartitionMesh.cpp
@@ -67,9 +67,9 @@ void PartitionMesh ( Mesh *M , int NP)
   M->bds_mesh = new BDS_Mesh (*M->bds);
   BDS_To_Mesh_2(M);
   delete M->bds;
-  delete M->bds_mesh;
+  //  delete M->bds_mesh;
   M->bds = 0;
-  M->bds_mesh = 0;
+  //M->bds_mesh = 0;
   SetBoundingBox();
 }
 
@@ -98,7 +98,7 @@ void PartitionMesh ( BDS_Mesh *m , int NP)
       if (dim == 2)
 	{
 	  BDS_Triangle *t = *it2;
-	  t->status = i;
+	  t->partition = i;
 	  ++it2;
 	  nbAdj = (t->e1->numfaces() + t->e2->numfaces() + t->e3->numfaces() - 3);
 	  totCount += nbAdj;
@@ -106,7 +106,7 @@ void PartitionMesh ( BDS_Mesh *m , int NP)
       else if (dim == 3)
 	{
 	  BDS_Tet *t = *it3;
-	  t->status = i;
+	  t->partition = i;
 	  ++it3;
 	  nbAdj =(t->f1->numtets() + t->f2->numtets() + t->f3->numtets() + t->f4->numtets() - 4); 
 	  totCount += nbAdj;
@@ -131,17 +131,17 @@ void PartitionMesh ( BDS_Mesh *m , int NP)
 	  for (int j=0;j<t->e1->numfaces();j++)
 	    {
 	      BDS_Triangle *f = t->e1->faces(j);
-	      if (f != t) adjncy[count++] = f->status;
+	      if (f != t) adjncy[count++] = f->partition;
 	    }
 	  for (int j=0;j<t->e2->numfaces();j++)
 	    {
 	      BDS_Triangle *f = t->e2->faces(j);
-	      if (f != t) adjncy[count++] = f->status;
+	      if (f != t) adjncy[count++] = f->partition;
 	    }
 	  for (int j=0;j<t->e3->numfaces();j++)
 	    {
 	      BDS_Triangle *f = t->e3->faces(j);
-	      if (f != t) adjncy[count++] = f->status;
+	      if (f != t) adjncy[count++] = f->partition;
 	    }
 	  ++it2;
 	}
@@ -149,13 +149,13 @@ void PartitionMesh ( BDS_Mesh *m , int NP)
 	{
 	  BDS_Tet *t = *it3;
 	  BDS_Tet *o = t->f1->opposite_tet (t);
-	  if (o) adjncy[count++] = o->status;
+	  if (o) adjncy[count++] = o->partition;
 	  o = t->f2->opposite_tet (t);
-	  if (o) adjncy[count++] = o->status;
+	  if (o) adjncy[count++] = o->partition;
 	  o = t->f3->opposite_tet (t);
-	  if (o) adjncy[count++] = o->status;
+	  if (o) adjncy[count++] = o->partition;
 	  o = t->f4->opposite_tet (t);
-	  if (o) adjncy[count++] = o->status;
+	  if (o) adjncy[count++] = o->partition;
 	  ++it3;
 	}
     }
@@ -179,13 +179,13 @@ void PartitionMesh ( BDS_Mesh *m , int NP)
       if (dim == 2)
 	{
 	  BDS_Triangle *t = *it2;
-	  t->status = partitionVector[i];
+	  t->partition = partitionVector[i];
 	  ++it2;
 	}
       else if (dim == 3)
 	{
 	  BDS_Tet *t = *it3;
-	  t->status = partitionVector[i];
+	  t->partition = partitionVector[i];
 	  ++it3;
 	}
     }
diff --git a/Metis/Makefile b/Metis/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..211907d40b7fd2cb757ce336a54b3d6b79efeef6
--- /dev/null
+++ b/Metis/Makefile
@@ -0,0 +1,103 @@
+# $Id: Makefile,v 1.1 2005-09-07 17:12:16 remacle Exp $
+#
+# Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+# 
+# Please report all bugs and problems to <gmsh@geuz.org>.
+
+include ../variables
+
+LIB     = ../lib/libGmshMetis.a
+INCLUDE = -I.
+CFLAGS  = ${OPTIM} ${FLAGS} ${INCLUDE} -DNO_PARALLEL_THREADS -UWIN32
+
+SRC = balance.c \
+      fm.c        \
+      kwayfm.c    \
+      mcoarsen.c  \
+      minitpart2.c \
+      mpmetis.c   \
+      pmetis.c     \
+      subdomains.c\
+      bucketsort.c  \
+      fortran.c  \
+      kwayrefine.c\
+      memory.c  \
+      minitpart.c  \
+      mrefine2.c\
+      pqueue.c\
+      timing.c\
+      ccgraph.c \
+      frename.c \
+      kwayvolfm.c\
+      mesh.c\
+      mkmetis.c\
+      mrefine.c \
+      refine.c  \
+      util.c\
+      coarsen.c \
+      graph.c\
+      kwayvolrefine.c  \
+      meshpart.c  \
+      mkwayfmh.c \
+      mutil.c \
+      separator.c\
+      compress.c\
+      initpart.c\
+      match.c\
+      mfm2.c \
+      mkwayrefine.c\
+      myqsort.c\
+      sfm.c\
+      debug.c \
+      kmetis.c  \
+      mbalance2.c\
+      mfm.c  \
+      mmatch.c \
+      ometis.c \
+      srefine.c\
+      estmem.c \
+      kvmetis.c\
+      mbalance.c \
+      mincover.c  \
+      mmd.c  \
+      parmetis.c \
+     stat.c
+
+OBJ = ${SRC:.c=.o}
+
+.SUFFIXES: .o .c
+
+${LIB}: ${OBJ} 
+	${AR} ${LIB} ${OBJ} 
+	${RANLIB} ${LIB}
+
+.c.o:
+	${CC} ${CFLAGS} -c $< -o ${<:.c=.o}
+
+clean:
+	rm -f src/*.o
+
+depend:
+	(sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
+	${CXX} -MM ${CFLAGS} ${SRC} \
+	) >Makefile.new
+	cp Makefile Makefile.bak
+	cp Makefile.new Makefile
+	rm -f Makefile.new
+
+# DO NOT DELETE THIS LINE