r46478 - in /packages/mmg3d/trunk/debian: changelog compat control libmmg3dlib4.0-4.0-dev.install patches/freefem++.patch patches/install.patch patches/series rules

trophime-guest at users.alioth.debian.org trophime-guest at users.alioth.debian.org
Mon Jan 27 18:02:22 UTC 2014


Author: trophime-guest
Date: Mon Jan 27 18:02:22 2014
New Revision: 46478

URL: http://svn.debian.org/wsvn/debian-science/?sc=1&rev=46478
Log:
Add freefem++.patch

Added:
    packages/mmg3d/trunk/debian/patches/freefem++.patch
Modified:
    packages/mmg3d/trunk/debian/changelog
    packages/mmg3d/trunk/debian/compat
    packages/mmg3d/trunk/debian/control
    packages/mmg3d/trunk/debian/libmmg3dlib4.0-4.0-dev.install
    packages/mmg3d/trunk/debian/patches/install.patch
    packages/mmg3d/trunk/debian/patches/series
    packages/mmg3d/trunk/debian/rules

Modified: packages/mmg3d/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/changelog?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/changelog	(original)
+++ packages/mmg3d/trunk/debian/changelog	Mon Jan 27 18:02:22 2014
@@ -1,3 +1,9 @@
+mmg3d (4.0-2) unstable; urgency=low
+
+  * Add freefem++.patch to enable mmg3d within freefem++
+
+ -- Christophe Trophime <christophe.trophime at lncmi.cnrs.fr>  Thu, 07 Feb 2013 15:37:28 +0100
+
 mmg3d (4.0-1) unstable; urgency=low
 
   * New upstream release

Modified: packages/mmg3d/trunk/debian/compat
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/compat?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/compat	(original)
+++ packages/mmg3d/trunk/debian/compat	Mon Jan 27 18:02:22 2014
@@ -1 +1 @@
-7
+9

Modified: packages/mmg3d/trunk/debian/control
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/control?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/control	(original)
+++ packages/mmg3d/trunk/debian/control	Mon Jan 27 18:02:22 2014
@@ -2,10 +2,10 @@
 Section: math
 Priority: extra
 Maintainer: Christophe Trophime <christophe.trophime at lncmi.cnrs.fr>
-Build-Depends: cdbs, debhelper (>= 7.0.50~), quilt, cmake,
+Build-Depends: debhelper (>= 9~), quilt, cmake,
  libscotch-dev
 # hardening-includes,hardening-wrapper
-Standards-Version: 3.9.2
+Standards-Version: 3.9.4
 Homepage: http://www.math.u-bordeaux1.fr/~dobj/logiciels/mmg3d.php
 Vcs-Svn: svn://svn.debian.org/svn/debian-science/packages/mmg3d/
 Vcs-Browser: http://svn.debian.org/viewsvn/debian-science/packages/mmg3d

Modified: packages/mmg3d/trunk/debian/libmmg3dlib4.0-4.0-dev.install
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/libmmg3dlib4.0-4.0-dev.install?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/libmmg3dlib4.0-4.0-dev.install	(original)
+++ packages/mmg3d/trunk/debian/libmmg3dlib4.0-4.0-dev.install	Mon Jan 27 18:02:22 2014
@@ -1,2 +1,3 @@
 debian/tmp/usr/lib/libmmg3dlib4.0.so usr/lib
 debian/tmp/usr/include/* usr/include
+build/sources/dataff.h usr/include

Added: packages/mmg3d/trunk/debian/patches/freefem++.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/patches/freefem%2B%2B.patch?rev=46478&op=file
==============================================================================
--- packages/mmg3d/trunk/debian/patches/freefem++.patch	(added)
+++ packages/mmg3d/trunk/debian/patches/freefem++.patch	Mon Jan 27 18:02:22 2014
@@ -0,0 +1,2222 @@
+Index: mmg3d-4.0/build/sources/analarcutting.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/analarcutting.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/analarcutting.c	2013-02-08 16:10:00.000000000 +0100
+@@ -307,7 +307,7 @@
+   printf("6 cut : %8d\n",n6);
+   printf("---------------------------\n"); */  
+ 	if ( !na )  return(na);
+-#warning check memory allocation
++	// #warning check memory allocation
+   
+   //printf("%d cut init --- nb tet %d\n",na,mesh->ne);
+   return(na);
+Index: mmg3d-4.0/build/sources/dataff.h
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ mmg3d-4.0/build/sources/dataff.h	2013-02-08 16:10:00.000000000 +0100
+@@ -0,0 +1,58 @@
++/*
++ *  dataff.h
++ *
++ *
++ *  Created by Fr\E9d\E9ric Hecht on 19/06/11.
++ *  Copyright 2011 UPMC. All rights reserved.
++ *
++ */
++
++enum ff_data_type {
++    ff_id_vertex =0,
++    ff_id_seg =1,
++    ff_id_tria=2,
++    ff_id_tet =3,
++
++    ff_id_prism =5,
++    ff_id_hex =6,
++    ff_id_quad =7,
++    ff_id_corner=8
++} ;
++
++
++typedef struct  DataFF
++{
++  const char  * meshname;
++  const char  * movename;
++  const char  * solname;
++  int imprim;
++  int memory;
++  int   np; //  nb of vertices  in/out
++  int   typesol; //  1 iso , 6 : m11; m12,m13,m22,m23,m33
++  void * mesh;
++  double * sol; /* metric :size typesol*np  */
++  double * mov; /* displac. size :3*np  */
++  void (*set_mesh)(void *dataff,int *data,int ldata);
++  void (*end_mesh)(void *dataff);
++  void (*set_v)(void *dataff,int i,double *xyz,int lab);
++  void (*set_elmt)(void *dataff,int ff_id,int i,int *k,int lab);
++  void (*get_mesh)(void *dataff,int *data,int ldata);
++  void (*get_v3)(void *dataff,int i,double *xyz,int *lab);
++  void (*get_elmt)(void *dataff,int ff_id,int i,int *k,int *lab);
++} DataFF;
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++    int mainmmg3d(int argc,char *argv[],DataFF *dataff);
++#ifdef __cplusplus
++}
++#endif
++/*
++ m11 = met[0]
++ m12 = met[1]
++ m13 = met[2]
++ m22 = met[3]
++ m23 = met[4]
++ m33 = met[5]
++*/
+Index: mmg3d-4.0/build/sources/delaunay.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/delaunay.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/delaunay.c	2013-02-08 16:10:00.000000000 +0100
+@@ -728,7 +728,7 @@
+   if ( ppt->tag & M_UNUSED )  return(0);
+ 
+   tref = mesh->tetra[list->tetra[1]/6].ref;
+-#warning remove this test
++  // #warning remove this test
+   for (k=1; k<=lon; k++)
+     if(tref!=mesh->tetra[list->tetra[k]/6].ref) 
+        printf("pbs coquil %d %d tet %d\n",tref,mesh->tetra[list->tetra[k]/6].ref,list->tetra[k]/6);
+Index: mmg3d-4.0/build/sources/inout.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/inout.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/inout.c	2013-02-08 16:10:00.000000000 +0100
+@@ -44,7 +44,7 @@
+ along with MMG3D. If not, see <http://www.gnu.org/licenses/>.  
+ ****************************************************************************/
+ #include "mesh.h"
+-
++#include "dataff.h"
+ 
+ extern short	       MMG_imprim;
+ #define sw 4
+@@ -52,79 +52,463 @@
+ 
+ int MMG_swapbin(int sbin)
+ {
+-	int inv; 
++  int inv;
+   char *p_in = (char *) &sbin;
+   char *p = (char *)&inv;
+ 
+- 
++
+   p[0] = p_in[3];
+   p[1] = p_in[2];
+   p[2] = p_in[1];
+-  p[3] = p_in[0]; 
+-  
++  p[3] = p_in[0];
++
+   return(inv);
+   /*unsigned char c1, c2, c3, c4;
+ 
+-  c1 = sbin & 255;
+-  c2 = (sbin >> 8) & 255;
+-  c3 = (sbin >> 16) & 255;
+-  c4 = (sbin >> 24) & 255;
+-  
+-  return ((int)c1 << 24) + ((int)c2 << 16) + ((int)c3 << 8) + c4;   */
++    c1 = sbin & 255;
++    c2 = (sbin >> 8) & 255;
++    c3 = (sbin >> 16) & 255;
++    c4 = (sbin >> 24) & 255;
++
++    return ((int)c1 << 24) + ((int)c2 << 16) + ((int)c3 << 8) + c4;   */
+ 
+ }
+ float MMG_swapf(float sbin)
+-{ 
++{
+   float out;
+-  char *p_in = (char *) &sbin; 
+-  char *p_out = (char *) &out; 
+-  p_out[0] = p_in[3]; 
+-  p_out[1] = p_in[2]; 
+-  p_out[2] = p_in[1]; 
++  char *p_in = (char *) &sbin;
++  char *p_out = (char *) &out;
++  p_out[0] = p_in[3];
++  p_out[1] = p_in[2];
++  p_out[2] = p_in[1];
+   p_out[3] = p_in[0];
+-  
++
+   return(out);
+ }
+ double MMG_swapd(double sbin)
+ {
+   float out;
+-  char *p_in = (char *) &sbin; 
+-  char *p_out = (char *) &out; 
++  char *p_in = (char *) &sbin;
++  char *p_out = (char *) &out;
+   int i;
+-  
++
+   for(i=0;i<8;i++)
+-  {
+-    p_out[i] = p_in[7-i];
+-  }          
++    {
++      p_out[i] = p_in[7-i];
++    }
+   //printf("CONVERTION DOUBLE\n");
+   return(out);
+ }
+ 
++/* Modified by F. Hecht*/
++
++int MMG_loadMeshff(pMesh mesh,char *filename,DataFF *dataff) {
++
++  Hedge	  hed,hed2;
++  pPoint  ppt;
++  pTetra  pt;
++  pTria	  pt1;
++  int i,j,k;
++  int nhex=0, npris=0, netmp=0,nq=0, pp[10] , ned=0, ncor=0;
++  int p0,p1,p2,p3,p4,p5,p6,ref ;
++  int data[10],ldata=10;
++  dataff->get_mesh(dataff,data,10);
++  mesh->np = data[ff_id_vertex];
++  ned = data[ff_id_seg];
++  mesh->nt = data[ff_id_tria];
++  mesh->ne = data[ff_id_tet];
++  netmp=mesh->ne;
++  nhex=data[ff_id_hex];
++  npris=data[ff_id_prism];
++  nq=data[ff_id_quad];
++  ncor= data[ff_id_corner];
++
++  if( nhex || npris) {
++    printf("mmg3d ff interface , hex or prism NOT SUPPORTED  to day (sorry  FH) \n");
++    goto L0;
++  }
++
++  mesh->ncor = 0;
++  mesh->ver =1;
++  if ( abs(mesh->info.option)==10 ) {
++    fprintf(stdout,"  -- READING %8d HEXA %8d PRISMS\n",nhex,npris);
++    if(!mesh->ne) netmp = 0;
++    mesh->ne += 6*nhex + 3*npris;
++  }
++
++  if ( abs(mesh->info.imprim) > 5 )
++    fprintf(stdout,"  -- READING DATA for ff interface ");
++
++  if ( !mesh->np || !mesh->ne ) {
++    fprintf(stdout,"  ** MISSING DATA yy\n");
++    goto L0; ;
++  }
++  if ( !MMG_zaldy(mesh) )  goto L0;
++
++  /* read mesh vertices */
++  mesh->npfixe = mesh->np;
++
++  for (k=1; k<=mesh->np; k++) {
++    ppt = &mesh->point[k];
++    dataff->get_v3(dataff,k,ppt->c,&ppt->ref);
++    ppt->tag  = M_UNUSED;
++  }
++
++  /* read mesh triangles */
++  mesh->ntfixe = mesh->nt;
++
++  for (k=1; k<=mesh->nt; k++) {
++    pt1 = &mesh->tria[k];
++    dataff->get_elmt(dataff,ff_id_tria,k,pt1->v,&pt1->ref);
++
++  }
++
++  /* read mesh quads (option 10)*/
++  if(abs(mesh->info.option)==10) {
++    fprintf(stdout,"     QUADS READING %d\n",nq);
++    mesh->ntfixe += 4*nq;
++    for (k=1; k<=nq; k++) {
++      dataff->get_elmt(dataff, ff_id_quad ,k,pp,&ref);
++
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = pp[0];
++      pt1->v[1] = pp[1];
++      pt1->v[2] = pp[2];
++      pt1->ref  = ref;
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = pp[0];
++      pt1->v[1] = pp[2];
++      pt1->v[2] = pp[3];
++      pt1->ref  = ref;
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = pp[0];
++      pt1->v[1] = pp[1];
++      pt1->v[2] = pp[3];
++      pt1->ref  = ref;
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = pp[1];
++      pt1->v[1] = pp[2];
++      pt1->v[2] = pp[3];
++      pt1->ref  = ref;
++    }
++  }
++
++  /*read and store edges*/
++  if (ned) {
++    if ( !MMG_zaldy4(&hed,ned) ) {
++      if ( mesh->info.ddebug )
++         fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n");
++      ned = 0;
++    }
++    mesh->ned = ned;
++
++    for (k=1; k<=ned; k++) {
++      dataff->get_elmt(dataff, ff_id_seg ,k,pp,&ref);
++      if(MMG_edgePut(&hed,pp[0],pp[1],2)>1) {
++	fprintf(stdout,"  ## WARNING DOUBLE EDGE : %d %d\n",pp[0],pp[1]);
++      }
++    }
++  }
++
++  /* read mesh tetrahedra */
++  mesh->nefixe = mesh->ne;
++
++
++  for (k=1; k<=netmp; k++) {
++    pt = &mesh->tetra[k];
++    dataff->get_elmt(dataff,ff_id_tet,k,pt->v,&ref);
++    pt->ref  = ref;//0;//ref ;
++    for(i=0 ; i<4 ; i++)
++      pt->bdryref[i] = -1;
++
++    if (ned) { int nu1,nu2;
++      for(i=0 ; i<6 ; i++) {
++	nu1 = pt->v[MMG_iare[i][0]];
++	nu2 = pt->v[MMG_iare[i][1]];
++	pt->bdryinfo[i] = MMG_edgePoint(&hed,nu1,nu2);
++      }
++    } else {
++      for(i=0 ; i<6 ; i++)
++	pt->bdryinfo[i] = 0;
++    }
++  }
++  if (ned) M_free(hed.item);
++
++  /*read corners*/
++  if (ncor) {
++
++    mesh->ncor = ncor;
++    for (k=1; k<=ncor; k++) {
++      dataff->get_elmt(dataff,ff_id_corner,k,&ref,0);
++
++      ppt = &mesh->point[ref];
++      ppt->geom = M_CORNER;
++    }
++  }
++#ifdef XXXXXXXXXXXXXXX
++  if ( abs(mesh->info.option)==10 ) {
++    if(bin) {
++      printf("NOT SUPPORTED\n");
++      exit(0);
++    }
++    if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
++      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n");
++      npris = 0;
++      nhex  = 0;
++    }
++
++    /*read hexa and transform to tetra*/
++    rewind(inm);
++    fseek(inm,posnhex,SEEK_SET);
++    for (k=1; k<=nhex; k++) {
++      fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&p6,&p7,&ref);
++      //fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p4,&p2,&p1,&p3,&p5,&p6,&p7,&ref);
++      //printf("hex %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7);
++      MMG_cuthex(mesh,&hed2,netmp+(k-1)*6,p0,p1,p2,p3,p4,p5,p6,p7,ref);
++    }
++
++    /*read prism and transform to tetra
++      ---> compatibility pbs ==> hash edge and switch case*/
++    rewind(inm);
++    fseek(inm,posnpris,SEEK_SET);
++    nimp = 0;
++    ne = netmp+6*nhex;
++    for (k=1; k<=npris; k++) {
++      fscanf(inm,"%d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&ref);
++      if(!MMG_cutprism(mesh,&hed2,ne,p0,p1,p2,p3,p4,p5,ref))
++	{
++	  if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n");
++	  mesh->ne += 5;
++	  ne += 8;
++	  nimp++;
++	  continue;
++	}
++      ne += 3;
++    }
++    if(abs(mesh->info.imprim) > 3 )fprintf(stdout,"     %d INVALID DECOMPOSITION\n\n",nimp);
++  }
++#endif
++  if ( abs(mesh->info.imprim) > 3 ) {
++    fprintf(stdout,"     NUMBER OF GIVEN VERTICES   %8d\n",mesh->npfixe);
++    if ( mesh->ntfixe )
++      fprintf(stdout,"	NUMBER OF GIVEN TRIANGLES  %8d\n",mesh->ntfixe);
++    fprintf(stdout,"     NUMBER OF GIVEN TETRAHEDRA %8d\n",mesh->nefixe);
++    if ( ncor )
++      fprintf(stdout,"	NUMBER OF GIVEN CORNERS    %8d\n",ncor);
++    if ( ned )
++      fprintf(stdout,"	NUMBER OF GIVEN EDGES	   %8d\n",ned);
++  }
++  //    MMG_saveMesh(mesh,"XXXXX.mesh",0);
++  dataff->mesh=0; // used
++  return 1;
++ L0:
++  dataff->mesh=0;// used
++  return 1;
++}
++
++int MMG_loadSolff(pSol sol,char *filename,int npmax,DataFF *dataff) {
++
++  double	tmp , *dsol ;
++  int 	binch,bdim,iswp;
++  int 	k,i,isol,type,bin,dim,btyp,bpos;
++  long	posnp;
++  char	*ptr,data[128],chaine[128];
++  if( ! dataff->sol){
++    fprintf(stdout,"  ** MISSING DATA metrix ff \n");
++    return(1);
++  }
++  dsol = dataff->sol;
++  dataff->sol=0;// used
++
++
++  btyp = (dataff->typesol== 6)  ?  3: dataff->typesol ;
++  sol->np= dataff->np;
++
++  if ( !sol->np ) {
++    fprintf(stdout,"  ** MISSING DATA zz\n");
++    return(1);
++  }
++
++  if ( btyp!= 1 && btyp!=3 ) {
++    fprintf(stdout,"  ** DATA IGNORED (ff) btyp=%d\n",btyp);
++    sol->np = 0;
++    return(1);
++  }
++
++  sol->offset = (btyp==1) ? 1 : 6;
++
++  if ( abs(MMG_imprim) > 5 )
++    fprintf(stdout,"  -- READING DATA FILE(ff) %s\n",data);
++
++  if ( !sol->np ) {
++    fprintf(stdout,"  ** MISSING DATA  no metrix  \n");
++    return(0);
++  }
++  sol->npfixe = sol->np;
++  sol->npmax  = npmax;
++  if ( !MMG_zaldy3(sol) )  return(0);
++
++  /* read mesh solutions */
++  sol->npfixe = sol->np;
++
++  for (k=1; k<=sol->np; k++) {
++    isol = (k-1) * sol->offset + 1;
++    for (i=0; i<sol->offset; i++)
++      sol->met[isol + i] = *dsol++;
++
++  }
++
++  if ( abs(MMG_imprim) > 3 )
++    fprintf(stdout,"     NUMBER OF GIVEN DATA       %8d\n",sol->npfixe);
++
++  return(1);
++
++}
++/* load solution (metric) */
++int MMG_loadVectff(pMesh mesh,char *filename,int npmax,DataFF *dataff) {
++
++  pDispl	 pd;
++  int 	binch,bdim,iswp;
++  int 	k,i,type,bin,dim,btyp,bpos,iadr;
++  long	posnp;
++  char	*ptr,data[128],chaine[128];
++  double *fsol = dataff->mov;
++  dataff->mov=0;// used
++
++  pd = mesh->disp;
++  pd->np =mesh->np ;
++
++  if ( !pd->np || !fsol  ) {
++    fprintf(stdout,"  ** MISSING DATA dep ff %d %p\n",pd->np, fsol);
++    return(0);
++  }
++
++
++  if ( abs(mesh->info.imprim) > 5 )
++    fprintf(stdout,"  -- COPY DATA form ff interface  %s\n",data);
++
++  /* read mesh solutions */
++  for (k=1; k<=pd->np; k++) {
++    iadr = (k - 1) * 3 + 1;
++
++    for (i=0; i<3; i++) {
++      pd->mv[iadr + i] =  *fsol++;
++    }
++  }
++
++
++
++  if ( abs(mesh->info.imprim) > 3 )
++    fprintf(stdout,"     NUMBER OF GIVEN DATA       %8d\n",pd->np);
++  return(1);
++
++
++}
++int MMG_saveMeshff(pMesh mesh,char *filename,DataFF *dataff) {
++
++  pPoint		  ppt;
++  pTetra	     pt;
++  pTria	     pt1;
++  int j,k,np,nc,k0;
++  int data[10],ldata=10;
++  int kn[10];
++  np = 0;
++  nc = 0;
++  for (k=1; k<=mesh->np; k++) {
++    ppt = &mesh->point[k];
++    if ( ppt->tag & M_UNUSED )  continue;
++    ppt->tmp = ++np;
++    /*      if ( ppt->geom & M_CORNER )  cor[nc++] = ppt->tmp; */
++  }
++  mesh->nt=0;
++  if(! MMG_markBdry(mesh))
++    mesh->nt=0;
++  data[ff_id_vertex]=np ;
++  //data[ff_id_seg]=ned ;
++  data[ff_id_tria]=mesh->nt ;
++  int ne=0;
++  for ( k=1; k<=mesh->ne; k++)
++    {
++      pt = &mesh->tetra[k];
++      if ( !pt->v[0] )  continue;
++      ne++;
++    }
++
++  data[ff_id_tet]=ne  ;
++  //data[ff_id_hex]=nhex;
++  //data[ff_id_prism]=npris;
++  //data[ff_id_quad]=nq;
++  // data[ff_id_corner]=ncor;
++
++  dataff->set_mesh(dataff,data,10);
++
++
++  for ( k=1; k<=mesh->np; k++)
++    {
++      ppt = &mesh->point[k];
++      if ( ppt->tag & M_UNUSED )  continue;
++      dataff->set_v(dataff, ppt->tmp,ppt->c,ppt->ref);
++    }
++
++
++  for (k=1; k<=mesh->nt; k++)
++    {
++      pt1 = &mesh->tria[k];
++      for(j=0;j<3;++j)
++	kn[j] = mesh->point[pt1->v[j]].tmp;
++      dataff->set_elmt(dataff,ff_id_tria,k,kn,pt1->ref);
++
++    }
++  k0=0;
++  for ( k=1; k<=mesh->ne; k++)
++    {
++
++      pt = &mesh->tetra[k];
++      if ( !pt->v[0] )  continue;
++      k0++;
++      for(j=0;j<4;++j)
++	kn[j] = mesh->point[pt->v[j]].tmp;
++      dataff->set_elmt(dataff,ff_id_tet,k0,kn,pt->ref);
++
++    }
++  dataff->end_mesh(dataff);
++  return 1;
++}
++int MMG_saveSolff (pMesh mesh,pSol sol,char *filename,DataFF *dataff) {
++  return 1;
++}
++/*save the node speed : coornew-coorold/dt*/
++int MMG_saveVectff(pMesh mesh,char *filename,DataFF *dataff) {
++  return 1;
++}
++
+ /* read mesh data */
+-int MMG_loadMesh(pMesh mesh,char *filename) {  
++int MMG_loadMesh(pMesh mesh,char *filename,void *dataff) {
+   FILE*            inm;
+   Hedge    				 hed,hed2;
+   pPoint       	   ppt;
+   pTetra           pt;
+   pTria            pt1;
+-  int              k,dim,ref,bin,bpos,i,tmp;   
++  int              k,dim,ref,bin,bpos,i,tmp;
+   long             posnp,posnt,posne,posnhex,posnpris,posncor,posned,posnq;
+   char            *ptr,data[128],chaine[128];
+   int              nhex,npris,netmp,ncor,ned,nq;
+-  int              p0,p1,p2,p3,p4,p5,p6,p7;  
+-  int              binch,bdim,iswp,nu1,nu2,nimp,ne;       
++  int              p0,p1,p2,p3,p4,p5,p6,p7;
++  int              binch,bdim,iswp,nu1,nu2,nimp,ne;
+   float            fc;
+-  
++
++  if(dataff)
++    return MMG_loadMeshff( mesh,filename,(DataFF*) dataff);
+ 
+   posnp = posnt = posne = posnhex = posnpris = 0;
+   netmp = ncor = ned = 0;
+   bin = 0;
+   iswp = 0;
+-  mesh->np = mesh->nt = mesh->ne = mesh->ncor = 0; 
++  mesh->np = mesh->nt = mesh->ne = mesh->ncor = 0;
+   npris = nhex = nq = 0;
+-  
++
+   strcpy(data,filename);
+-  ptr = strstr(data,".mesh");  
++  ptr = strstr(data,".mesh");
+   if ( !ptr ) {
+     strcat(data,".meshb");
+     if( !(inm = fopen(data,"rb")) ) {
+@@ -145,88 +529,88 @@
+       if( !(inm = fopen(data,"r")) ) {
+         fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
+         return(0);
+-      }      
++      }
+     } else {
+       bin = 1;
+       if( !(inm = fopen(data,"rb")) ) {
+         fprintf(stderr,"  ** %s  NOT FOUND.\n",data);
+         return(0);
+       }
+-      
+-    }  
++
++    }
+   }
+ 
+   fprintf(stdout,"  %%%% %s OPENED\n",data);
+   if (!bin) {
+-    strcpy(chaine,"D");     
+-    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) { 
++    strcpy(chaine,"D");
++    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
+       if(!strncmp(chaine,"MeshVersionFormatted",strlen("MeshVersionFormatted"))) {
+-          fscanf(inm,"%d",&mesh->ver);
+-          continue;
++	fscanf(inm,"%d",&mesh->ver);
++	continue;
+       } else if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
+-          fscanf(inm,"%d",&dim);
+-          if(dim!=3) {
+-            fprintf(stdout,"BAD DIMENSION : %d\n",dim);
+-            return(0);
+-          }
+-          continue;
++	fscanf(inm,"%d",&dim);
++	if(dim!=3) {
++	  fprintf(stdout,"BAD DIMENSION : %d\n",dim);
++	  return(0);
++	}
++	continue;
+       } else if(!strncmp(chaine,"Vertices",strlen("Vertices"))) {
+-        fscanf(inm,"%d",&mesh->np); 
++        fscanf(inm,"%d",&mesh->np);
+         posnp = ftell(inm);
+         continue;
+       } else if(!strncmp(chaine,"Triangles",strlen("Triangles"))) {
+-        fscanf(inm,"%d",&mesh->nt); 
++        fscanf(inm,"%d",&mesh->nt);
+         posnt = ftell(inm);
+         continue;
+       } else if(!strncmp(chaine,"Tetrahedra",strlen("Tetrahedra"))) {
+-        fscanf(inm,"%d",&mesh->ne); 
++        fscanf(inm,"%d",&mesh->ne);
+         netmp = mesh->ne;
+         posne = ftell(inm);
+         continue;
+-      } else if(!strncmp(chaine,"Hexahedra",strlen("Hexahedra"))) { 
+-        assert(abs(mesh->info.option)==10);  
+-        fscanf(inm,"%d",&nhex); 
+-				//nhex=0;
++      } else if(!strncmp(chaine,"Hexahedra",strlen("Hexahedra"))) {
++        assert(abs(mesh->info.option)==10);
++        fscanf(inm,"%d",&nhex);
++	//nhex=0;
+         posnhex = ftell(inm);
+         continue;
+-      } else if(!strncmp(chaine,"Pentahedra",strlen("Pentahedra"))) { 
+-        assert(abs(mesh->info.option)==10); 
++      } else if(!strncmp(chaine,"Pentahedra",strlen("Pentahedra"))) {
++        assert(abs(mesh->info.option)==10);
+         fscanf(inm,"%d",&npris);
+-				//npris=0;
++	//npris=0;
+         posnpris = ftell(inm);
+         continue;
+-      } else if(!strncmp(chaine,"Corners",strlen("Corners"))) { 
+-        fscanf(inm,"%d",&ncor); 
++      } else if(!strncmp(chaine,"Corners",strlen("Corners"))) {
++        fscanf(inm,"%d",&ncor);
+         posncor = ftell(inm);
+         continue;
+-      } else if(!strncmp(chaine,"Edges",strlen("Edges"))) { 
+-	      fscanf(inm,"%d",&ned); 
+-	      posned = ftell(inm);
+-	      continue;
+-	    } else if(abs(mesh->info.option)==10 && !strncmp(chaine,"Quadrilaterals",strlen("Quadrilaterals"))) {
+-		    fscanf(inm,"%d",&nq); 
+-		    posnq = ftell(inm);
+-		    continue;
+-		  }
+-    }  
++      } else if(!strncmp(chaine,"Edges",strlen("Edges"))) {
++	fscanf(inm,"%d",&ned);
++	posned = ftell(inm);
++	continue;
++      } else if(abs(mesh->info.option)==10 && !strncmp(chaine,"Quadrilaterals",strlen("Quadrilaterals"))) {
++	fscanf(inm,"%d",&nq);
++	posnq = ftell(inm);
++	continue;
++      }
++    }
+   } else {
+     bdim = 0;
+     fread(&mesh->ver,sw,1,inm);
+-    iswp=0;   
+-    if(mesh->ver==16777216) 
+-      iswp=1;    
++    iswp=0;
++    if(mesh->ver==16777216)
++      iswp=1;
+     else if(mesh->ver!=1) {
+       fprintf(stdout,"BAD FILE ENCODING\n");
+-    } 
+-    fread(&mesh->ver,sw,1,inm); 
+-    if(iswp) mesh->ver = MMG_swapbin(mesh->ver); 
+-    while(fread(&binch,sw,1,inm)!=0 && binch!=54 ) {  
+-      if(iswp) binch=MMG_swapbin(binch);      
+-      if(binch==54) break;  
++    }
++    fread(&mesh->ver,sw,1,inm);
++    if(iswp) mesh->ver = MMG_swapbin(mesh->ver);
++    while(fread(&binch,sw,1,inm)!=0 && binch!=54 ) {
++      if(iswp) binch=MMG_swapbin(binch);
++      if(binch==54) break;
+       if(!bdim && binch==3) {  //Dimension
+         fread(&bdim,sw,1,inm);  //NulPos=>20
+         if(iswp) bdim=MMG_swapbin(bdim);
+-        fread(&bdim,sw,1,inm);  
++        fread(&bdim,sw,1,inm);
+         if(iswp) bdim=MMG_swapbin(bdim);
+         if(bdim!=3) {
+           fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
+@@ -235,87 +619,87 @@
+         }
+         continue;
+       } else if(!mesh->np && binch==4) {  //Vertices
+-        fread(&bpos,sw,1,inm); //NulPos 
++        fread(&bpos,sw,1,inm); //NulPos
+         if(iswp) bpos=MMG_swapbin(bpos);
+-        fread(&mesh->np,sw,1,inm); 
++        fread(&mesh->np,sw,1,inm);
+         if(iswp) mesh->np=MMG_swapbin(mesh->np);
+-        posnp = ftell(inm);     
++        posnp = ftell(inm);
+         rewind(inm);
+-        fseek(inm,bpos,SEEK_SET);        
++        fseek(inm,bpos,SEEK_SET);
+         continue;
+       }  else if(!mesh->nt && binch==6) {//Triangles
+-        fread(&bpos,sw,1,inm); //NulPos 
++        fread(&bpos,sw,1,inm); //NulPos
+         if(iswp) bpos=MMG_swapbin(bpos);
+-        fread(&mesh->nt,sw,1,inm); 
++        fread(&mesh->nt,sw,1,inm);
+         if(iswp) mesh->nt=MMG_swapbin(mesh->nt);
+-        posnt = ftell(inm); 
++        posnt = ftell(inm);
+         rewind(inm);
+-        fseek(inm,bpos,SEEK_SET);        
++        fseek(inm,bpos,SEEK_SET);
+         continue;
+-       } else if(!mesh->ne && binch==8) {  
+-         fread(&bpos,sw,1,inm); //NulPos 
+-         if(iswp) bpos=MMG_swapbin(bpos);
+-         fread(&mesh->ne,sw,1,inm); 
+-         if(iswp) mesh->ne=MMG_swapbin(mesh->ne);
+-         netmp = mesh->ne;
+-         posne = ftell(inm);
+-         rewind(inm);
+-         fseek(inm,bpos,SEEK_SET);        
+-         continue;
+-       } else if(!nhex && binch==10) { 
+-         assert(abs(mesh->info.option)==10);
+-         fread(&bpos,sw,1,inm); //NulPos 
+-         if(iswp) bpos=MMG_swapbin(bpos);
+-         fread(&nhex,sw,1,inm); 
+-         if(iswp) nhex=MMG_swapbin(nhex);
+-         posnhex = ftell(inm);
+-         rewind(inm);
+-         fseek(inm,bpos,SEEK_SET);        
+-         continue;
+-       } else if(!npris && binch==9) { 
+-         assert(abs(mesh->info.option)==10);
+-         fread(&bpos,sw,1,inm); //NulPos 
+-         if(iswp) bpos=MMG_swapbin(bpos);
+-         fread(&npris,sw,1,inm); 
+-         if(iswp) npris=MMG_swapbin(npris);
+-         posnpris = ftell(inm);
+-         rewind(inm);
+-         fseek(inm,bpos,SEEK_SET);        
+-         continue;
+-       } else if(!ncor && binch==13) { 
+-         fread(&bpos,sw,1,inm); //NulPos 
+-         if(iswp) bpos=MMG_swapbin(bpos);
+-         fread(&ncor,sw,1,inm);          
+-         if(iswp) ncor=MMG_swapbin(ncor);
+-         posncor = ftell(inm);
+-         rewind(inm);
+-         fseek(inm,bpos,SEEK_SET);        
+-         continue;
+-        } else if(!ned && binch==5) { //Edges
+-	       fread(&bpos,sw,1,inm); //NulPos 
+-	       if(iswp) bpos=MMG_swapbin(bpos);
+-	       fread(&ned,sw,1,inm); 
+-	       if(iswp) ned=MMG_swapbin(ned);
+-	       posned = ftell(inm);
+-	       rewind(inm);
+-	       fseek(inm,bpos,SEEK_SET);        
+-	       continue;
+-	      } else {
+-         //printf("on traite ? %d\n",binch);
+-         fread(&bpos,sw,1,inm); //NulPos 
+-         if(iswp) bpos=MMG_swapbin(bpos);
+-         //printf("on avance... Nulpos %d\n",bpos);         
+-         rewind(inm);
+-         fseek(inm,bpos,SEEK_SET);        
+-       }     
+-    }            
+-    
++      } else if(!mesh->ne && binch==8) {
++	fread(&bpos,sw,1,inm); //NulPos
++	if(iswp) bpos=MMG_swapbin(bpos);
++	fread(&mesh->ne,sw,1,inm);
++	if(iswp) mesh->ne=MMG_swapbin(mesh->ne);
++	netmp = mesh->ne;
++	posne = ftell(inm);
++	rewind(inm);
++	fseek(inm,bpos,SEEK_SET);
++	continue;
++      } else if(!nhex && binch==10) {
++	assert(abs(mesh->info.option)==10);
++	fread(&bpos,sw,1,inm); //NulPos
++	if(iswp) bpos=MMG_swapbin(bpos);
++	fread(&nhex,sw,1,inm);
++	if(iswp) nhex=MMG_swapbin(nhex);
++	posnhex = ftell(inm);
++	rewind(inm);
++	fseek(inm,bpos,SEEK_SET);
++	continue;
++      } else if(!npris && binch==9) {
++	assert(abs(mesh->info.option)==10);
++	fread(&bpos,sw,1,inm); //NulPos
++	if(iswp) bpos=MMG_swapbin(bpos);
++	fread(&npris,sw,1,inm);
++	if(iswp) npris=MMG_swapbin(npris);
++	posnpris = ftell(inm);
++	rewind(inm);
++	fseek(inm,bpos,SEEK_SET);
++	continue;
++      } else if(!ncor && binch==13) {
++	fread(&bpos,sw,1,inm); //NulPos
++	if(iswp) bpos=MMG_swapbin(bpos);
++	fread(&ncor,sw,1,inm);
++	if(iswp) ncor=MMG_swapbin(ncor);
++	posncor = ftell(inm);
++	rewind(inm);
++	fseek(inm,bpos,SEEK_SET);
++	continue;
++      } else if(!ned && binch==5) { //Edges
++	fread(&bpos,sw,1,inm); //NulPos
++	if(iswp) bpos=MMG_swapbin(bpos);
++	fread(&ned,sw,1,inm);
++	if(iswp) ned=MMG_swapbin(ned);
++	posned = ftell(inm);
++	rewind(inm);
++	fseek(inm,bpos,SEEK_SET);
++	continue;
++      } else {
++	//printf("on traite ? %d\n",binch);
++	fread(&bpos,sw,1,inm); //NulPos
++	if(iswp) bpos=MMG_swapbin(bpos);
++	//printf("on avance... Nulpos %d\n",bpos);
++	rewind(inm);
++	fseek(inm,bpos,SEEK_SET);
++      }
++    }
++
+   }
+ 
+   if ( abs(mesh->info.option)==10 ) {
+-    fprintf(stdout,"  -- READING %8d HEXA %8d PRISMS\n",nhex,npris);  
+-    if(!mesh->ne) netmp = 0;  
+-    mesh->ne += 6*nhex + 3*npris; 
++    fprintf(stdout,"  -- READING %8d HEXA %8d PRISMS\n",nhex,npris);
++    if(!mesh->ne) netmp = 0;
++    mesh->ne += 6*nhex + 3*npris;
+   }
+ 
+   if ( abs(mesh->info.imprim) > 5 )
+@@ -333,35 +717,35 @@
+   fseek(inm,posnp,SEEK_SET);
+   for (k=1; k<=mesh->np; k++) {
+     ppt = &mesh->point[k];
+-    if (mesh->ver < 2) { /*float*/ 
++    if (mesh->ver < 2) { /*float*/
+       if (!bin) {
+         for (i=0 ; i<3 ; i++) {
+           fscanf(inm,"%f",&fc);
+           ppt->c[i] = (double) fc;
+-        } 
++        }
+         fscanf(inm,"%d",&ppt->ref);
+       } else {
+         for (i=0 ; i<3 ; i++) {
+-          fread(&fc,sw,1,inm); 
+-          if(iswp) fc=MMG_swapf(fc);    
++          fread(&fc,sw,1,inm);
++          if(iswp) fc=MMG_swapf(fc);
+           ppt->c[i] = (double) fc;
+-        }     
+-        fread(&ppt->ref,sw,1,inm);         
+-        if(iswp) ppt->ref=MMG_swapbin(ppt->ref);    
++        }
++        fread(&ppt->ref,sw,1,inm);
++        if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
+       }
+     } else {
+-      if (!bin) 
+-        fscanf(inm,"%lf %lf %lf %d",&ppt->c[0],&ppt->c[1],&ppt->c[2],&ppt->ref); 
++      if (!bin)
++        fscanf(inm,"%lf %lf %lf %d",&ppt->c[0],&ppt->c[1],&ppt->c[2],&ppt->ref);
+       else {
+-        for (i=0 ; i<3 ; i++) { 
++        for (i=0 ; i<3 ; i++) {
+           fread(&ppt->c[i],sd,1,inm);
+-          if(iswp) ppt->c[i]=MMG_swapd(ppt->c[i]); 
+-        }   
+-        fread(&ppt->ref,sw,1,inm);         
+-        if(iswp) ppt->ref=MMG_swapbin(ppt->ref);    
+-      }  
+-    }             
+-    ppt->tag  = M_UNUSED;    
++          if(iswp) ppt->c[i]=MMG_swapd(ppt->c[i]);
++        }
++        fread(&ppt->ref,sw,1,inm);
++        if(iswp) ppt->ref=MMG_swapbin(ppt->ref);
++      }
++    }
++    ppt->tag  = M_UNUSED;
+   }
+ 
+   /* read mesh triangles */
+@@ -369,21 +753,21 @@
+   rewind(inm);
+   fseek(inm,posnt,SEEK_SET);
+   for (k=1; k<=mesh->nt; k++) {
+-    pt1 = &mesh->tria[k]; 
++    pt1 = &mesh->tria[k];
+     if (!bin)
+       fscanf(inm,"%d %d %d %d",&pt1->v[0],&pt1->v[1],&pt1->v[2],&pt1->ref);
+     else {
+-      for (i=0 ; i<3 ; i++) { 
+-        fread(&pt1->v[i],sw,1,inm); 
+-        if(iswp) pt1->v[i]=MMG_swapbin(pt1->v[i]);    
+-      }
+-      fread(&pt1->ref,sw,1,inm); 
+-      if(iswp) pt1->ref=MMG_swapbin(pt1->ref);           
+-    }  
+-  }
+-  /* read mesh quads (option 10)*/ 
+-	if(abs(mesh->info.option)==10) { 
+-		fprintf(stdout,"     QUADS READING %d\n",nq);
++      for (i=0 ; i<3 ; i++) {
++        fread(&pt1->v[i],sw,1,inm);
++        if(iswp) pt1->v[i]=MMG_swapbin(pt1->v[i]);
++      }
++      fread(&pt1->ref,sw,1,inm);
++      if(iswp) pt1->ref=MMG_swapbin(pt1->ref);
++    }
++  }
++  /* read mesh quads (option 10)*/
++  if(abs(mesh->info.option)==10) {
++    fprintf(stdout,"     QUADS READING %d\n",nq);
+     mesh->ntfixe += 4*nq;
+     rewind(inm);
+     fseek(inm,posnq,SEEK_SET);
+@@ -391,64 +775,64 @@
+       if (!bin)
+         fscanf(inm,"%d %d %d %d %d",&p0,&p1,&p2,&p3,&ref);
+       else {
+-        fread(&p0,sw,1,inm); 
+-        if(iswp) p0=MMG_swapbin(p0);    
+-        fread(&p1,sw,1,inm); 
+-        if(iswp) p1=MMG_swapbin(p1);    
+-        fread(&p2,sw,1,inm); 
+-        if(iswp) p2=MMG_swapbin(p2);    
+-        fread(&p3,sw,1,inm); 
+-        if(iswp) p3=MMG_swapbin(p3);    
+-	      fread(&pt1->ref,sw,1,inm); 
+-	      if(iswp) ref=MMG_swapbin(ref);           
+-      } 
+-      pt1 = &mesh->tria[++mesh->nt]; 
+-			pt1->v[0] = p0;
+-			pt1->v[1] = p1;
+-			pt1->v[2] = p2;
+-			pt1->ref  = ref;
+-      pt1 = &mesh->tria[++mesh->nt]; 
+-			pt1->v[0] = p0;
+-			pt1->v[1] = p2;
+-			pt1->v[2] = p3;
+-			pt1->ref  = ref;
+-      pt1 = &mesh->tria[++mesh->nt]; 
+-			pt1->v[0] = p0;
+-			pt1->v[1] = p1;
+-			pt1->v[2] = p3;
+-			pt1->ref  = ref;
+-      pt1 = &mesh->tria[++mesh->nt]; 
+-			pt1->v[0] = p1;
+-			pt1->v[1] = p2;
+-			pt1->v[2] = p3;
+-			pt1->ref  = ref;
+- 
++        fread(&p0,sw,1,inm);
++        if(iswp) p0=MMG_swapbin(p0);
++        fread(&p1,sw,1,inm);
++        if(iswp) p1=MMG_swapbin(p1);
++        fread(&p2,sw,1,inm);
++        if(iswp) p2=MMG_swapbin(p2);
++        fread(&p3,sw,1,inm);
++        if(iswp) p3=MMG_swapbin(p3);
++	fread(&pt1->ref,sw,1,inm);
++	if(iswp) ref=MMG_swapbin(ref);
++      }
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = p0;
++      pt1->v[1] = p1;
++      pt1->v[2] = p2;
++      pt1->ref  = ref;
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = p0;
++      pt1->v[1] = p2;
++      pt1->v[2] = p3;
++      pt1->ref  = ref;
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = p0;
++      pt1->v[1] = p1;
++      pt1->v[2] = p3;
++      pt1->ref  = ref;
++      pt1 = &mesh->tria[++mesh->nt];
++      pt1->v[0] = p1;
++      pt1->v[1] = p2;
++      pt1->v[2] = p3;
++      pt1->ref  = ref;
++
+     }
+   }
+ 
+-	/*read and store edges*/
+-  if (ned) {         
+-	  if ( !MMG_zaldy4(&hed,ned) ) {
+-      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n"); 
+-			ned = 0;
+-    }   
+-		mesh->ned = ned;
++  /*read and store edges*/
++  if (ned) {
++    if ( !MMG_zaldy4(&hed,ned) ) {
++      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES IGNORED\n");
++      ned = 0;
++    }
++    mesh->ned = ned;
+     rewind(inm);
+-    fseek(inm,posned,SEEK_SET); 
+-    for (k=1; k<=ned; k++) { 
++    fseek(inm,posned,SEEK_SET);
++    for (k=1; k<=ned; k++) {
+       if (!bin)
+         fscanf(inm,"%d %d %d",&nu1,&nu2,&ref);
+       else {
+-        fread(&nu1,sw,1,inm); 
+-        if(iswp) nu1=MMG_swapbin(nu1);    
+-        fread(&nu2,sw,1,inm); 
+-        if(iswp) nu2=MMG_swapbin(nu2);    
+-        fread(&ref,sw,1,inm); 
+-        if(iswp) ref=MMG_swapbin(ref);    
+-      }  
+-			if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
+-				fprintf(stdout,"  ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
+-			}
++        fread(&nu1,sw,1,inm);
++        if(iswp) nu1=MMG_swapbin(nu1);
++        fread(&nu2,sw,1,inm);
++        if(iswp) nu2=MMG_swapbin(nu2);
++        fread(&ref,sw,1,inm);
++        if(iswp) ref=MMG_swapbin(ref);
++      }
++      if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
++	fprintf(stdout,"  ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
++      }
+     }
+   }
+ 
+@@ -456,97 +840,94 @@
+   mesh->nefixe = mesh->ne;
+   rewind(inm);
+   fseek(inm,posne,SEEK_SET);
+-  for (k=1; k<=netmp; k++) { 
++  for (k=1; k<=netmp; k++) {
+     pt = &mesh->tetra[k];
+-    if (!bin) 
+-      fscanf(inm,"%d %d %d %d %d",&pt->v[0],&pt->v[1],&pt->v[2],&pt->v[3],&ref); 
+-    else {                                                                        
+-	
+-      for (i=0 ; i<4 ; i++) { 
+-        fread(&pt->v[i],sw,1,inm); 
+-        if(iswp) pt->v[i]=MMG_swapbin(pt->v[i]);    
+-      }
+-      fread(&ref,sw,1,inm);         
+-      if(iswp) ref=MMG_swapbin(ref);           
+-    }  
+-    pt->ref  = ref;//0;//ref ;  
++    if (!bin)
++      fscanf(inm,"%d %d %d %d %d",&pt->v[0],&pt->v[1],&pt->v[2],&pt->v[3],&ref);
++    else {
++      for (i=0 ; i<4 ; i++) {
++        fread(&pt->v[i],sw,1,inm);
++        if(iswp) pt->v[i]=MMG_swapbin(pt->v[i]);
++      }
++      fread(&ref,sw,1,inm);
++      if(iswp) ref=MMG_swapbin(ref);
++    }
++    pt->ref  = ref;//0;//ref ;
+     for(i=0 ; i<4 ; i++)
+-      pt->bdryref[i] = -1;  
+-    
+-		if (ned) {
+-	    for(i=0 ; i<6 ; i++) {                         
+-				nu1 = pt->v[MMG_iare[i][0]];
+-				nu2 = pt->v[MMG_iare[i][1]];
+-	      pt->bdryinfo[i] = MMG_edgePoint(&hed,nu1,nu2);
+-			}  			
+-			
+-		} else {
+-	    for(i=0 ; i<6 ; i++)
+-	      pt->bdryinfo[i] = 0;  			
+-		}
++      pt->bdryref[i] = -1;
++    if (ned) {
++      for(i=0 ; i<6 ; i++) {
++	nu1 = pt->v[MMG_iare[i][0]];
++	nu2 = pt->v[MMG_iare[i][1]];
++	pt->bdryinfo[i] = MMG_edgePoint(&hed,nu1,nu2);
++      }
++
++    } else {
++      for(i=0 ; i<6 ; i++)
++	pt->bdryinfo[i] = 0;
++    }
+   }
+-  if (ned) M_free(hed.item); 
++  if (ned) M_free(hed.item);
+ 
+-  /*read corners*/ 
++  /*read corners*/
+   if (ncor) {
+     rewind(inm);
+-    fseek(inm,posncor,SEEK_SET); 
++    fseek(inm,posncor,SEEK_SET);
+     mesh->ncor = ncor;
+-    for (k=1; k<=ncor; k++) { 
++    for (k=1; k<=ncor; k++) {
+       if (!bin)
+         fscanf(inm,"%d",&ref);
+       else {
+-        fread(&ref,sw,1,inm); 
+-        if(iswp) ref=MMG_swapbin(ref);    
+-      }  
++        fread(&ref,sw,1,inm);
++        if(iswp) ref=MMG_swapbin(ref);
++      }
+       ppt = &mesh->point[ref];
+-      ppt->geom = M_CORNER; 
+-    } 
++      ppt->geom = M_CORNER;
++    }
+   }
+-   
+-	
+-  if ( abs(mesh->info.option)==10 ) { 
++
++  if ( abs(mesh->info.option)==10 ) {
+     if(bin) {
+       printf("NOT SUPPORTED\n");
+       exit(0);
+-    } 
+-	  if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
+-      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n"); 
+-			npris = 0;
+-			nhex  = 0;
+-    }   
++    }
++    if ( !MMG_zaldy4(&hed2,3*npris+6*nhex) ) {
++      if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : PRISM IGNORED\n");
++      npris = 0;
++      nhex  = 0;
++    }
+ 
+     /*read hexa and transform to tetra*/
+     rewind(inm);
+     fseek(inm,posnhex,SEEK_SET);
+-    for (k=1; k<=nhex; k++) {   
+-      fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&p6,&p7,&ref); 
+-      //fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p4,&p2,&p1,&p3,&p5,&p6,&p7,&ref); 
+-      //printf("hex %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7);   
+-			MMG_cuthex(mesh,&hed2,netmp+(k-1)*6,p0,p1,p2,p3,p4,p5,p6,p7,ref);
+-    }  
+-    
++    for (k=1; k<=nhex; k++) {
++      fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&p6,&p7,&ref);
++      //fscanf(inm,"%d %d %d %d %d %d %d %d %d",&p0,&p4,&p2,&p1,&p3,&p5,&p6,&p7,&ref);
++      //printf("hex %d : %d %d %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p6,p7);
++      MMG_cuthex(mesh,&hed2,netmp+(k-1)*6,p0,p1,p2,p3,p4,p5,p6,p7,ref);
++    }
++
+     /*read prism and transform to tetra
+-		---> compatibility pbs ==> hash edge and switch case*/  
++      ---> compatibility pbs ==> hash edge and switch case*/
+     rewind(inm);
+-    fseek(inm,posnpris,SEEK_SET); 
+-		nimp = 0; 
+-		ne = netmp+6*nhex;
++    fseek(inm,posnpris,SEEK_SET);
++    nimp = 0;
++    ne = netmp+6*nhex;
+     for (k=1; k<=npris; k++) {
+-      fscanf(inm,"%d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&ref); 
+-			if(!MMG_cutprism(mesh,&hed2,ne,p0,p1,p2,p3,p4,p5,ref))
+-			{
+-				if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n"); 
+-				mesh->ne += 5;
+-				ne += 8;
+-				nimp++; 
+-				continue;
+-			}
+-			ne += 3;
++      fscanf(inm,"%d %d %d %d %d %d %d",&p0,&p1,&p2,&p3,&p4,&p5,&ref);
++      if(!MMG_cutprism(mesh,&hed2,ne,p0,p1,p2,p3,p4,p5,ref))
++	{
++	  if(mesh->info.imprim < 0 ) fprintf(stdout,"DECOMPOSITION PRISM INVALID \n\n");
++	  mesh->ne += 5;
++	  ne += 8;
++	  nimp++;
++	  continue;
++	}
++      ne += 3;
+     }
+-		if(abs(mesh->info.imprim) > 3 )fprintf(stdout,"     %d INVALID DECOMPOSITION\n\n",nimp);
++    if(abs(mesh->info.imprim) > 3 )fprintf(stdout,"     %d INVALID DECOMPOSITION\n\n",nimp);
+   }
+-  
++
+   if ( abs(mesh->info.imprim) > 3 ) {
+     fprintf(stdout,"     NUMBER OF GIVEN VERTICES   %8d\n",mesh->npfixe);
+     if ( mesh->ntfixe )
+@@ -557,24 +938,27 @@
+     if ( ned )
+       fprintf(stdout,"     NUMBER OF GIVEN EDGES      %8d\n",ned);
+   }
+- fclose(inm);
+- return(1);
++  fclose(inm);
++  return(1);
+ }
+ 
+ 
+ /* load solution (metric) */
+-int MMG_loadSol(pSol sol,char *filename,int npmax) { 
+-  FILE       *inm;   
++int MMG_loadSol(pSol sol,char *filename,int npmax,void *dataff) {
++  FILE       *inm;
+   float       fsol;
+-  double      tmp;       
++  double      tmp;
+   int         binch,bdim,iswp;
+   int         k,i,isol,type,bin,dim,btyp,bpos;
+   long        posnp;
+   char        *ptr,data[128],chaine[128];
+-  
+-  posnp = 0; 
++
++  if(dataff)
++    return MMG_loadSolff( sol,filename,npmax,(DataFF*) dataff);
++
++  posnp = 0;
+   bin   = 0;
+-  iswp  = 0; 
++  iswp  = 0;
+ 
+   strcpy(data,filename);
+   ptr = strstr(data,".mesh");
+@@ -593,20 +977,20 @@
+   }
+   fprintf(stdout,"  %%%% %s OPENED\n",data);
+ 
+-   
+-  if(!bin) {   
++
++  if(!bin) {
+     strcpy(chaine,"DDD");
+-    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) { 
++    while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
+       if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
+-          fscanf(inm,"%d",&dim);
+-          if(dim!=3) {
+-            fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim); 
+-            return(1);
+-          }
+-          continue;
++	fscanf(inm,"%d",&dim);
++	if(dim!=3) {
++	  fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
++	  return(1);
++	}
++	continue;
+       } else if(!strncmp(chaine,"SolAtVertices",strlen("SolAtVertices"))) {
+-        fscanf(inm,"%d",&sol->np); 
+-        fscanf(inm,"%d",&type); 
++        fscanf(inm,"%d",&sol->np);
++        fscanf(inm,"%d",&type);
+         if(type!=1) {
+           fprintf(stdout,"SEVERAL SOLUTION => IGNORED : %d\n",type);
+           return(1);
+@@ -614,20 +998,20 @@
+         fscanf(inm,"%d",&btyp);
+         posnp = ftell(inm);
+         break;
+-      } 
+-    }            
+-  } else {     
+-    fread(&binch,sw,1,inm); 
+-    iswp=0;   
+-    if(binch==16777216) iswp=1;    
++      }
++    }
++  } else {
++    fread(&binch,sw,1,inm);
++    iswp=0;
++    if(binch==16777216) iswp=1;
+     else if(binch!=1) {
+       fprintf(stdout,"BAD FILE ENCODING\n");
+-    } 
+-    fread(&sol->ver,sw,1,inm); 
+-    if(iswp) sol->ver = MMG_swapbin(sol->ver); 
++    }
++    fread(&sol->ver,sw,1,inm);
++    if(iswp) sol->ver = MMG_swapbin(sol->ver);
+     while(fread(&binch,sw,1,inm)!=EOF && binch!=54 ) {
+-      if(iswp) binch=MMG_swapbin(binch);      
+-      if(binch==54) break;  
++      if(iswp) binch=MMG_swapbin(binch);
++      if(binch==54) break;
+       if(binch==3) {  //Dimension
+         fread(&bdim,sw,1,inm);  //NulPos=>20
+         if(iswp) bdim=MMG_swapbin(bdim);
+@@ -642,7 +1026,7 @@
+       } else if(binch==62) {  //SolAtVertices
+         fread(&binch,sw,1,inm); //NulPos
+         if(iswp) binch=MMG_swapbin(binch);
+-        fread(&sol->np,sw,1,inm); 
++        fread(&sol->np,sw,1,inm);
+         if(iswp) sol->np=MMG_swapbin(sol->np);
+         fread(&binch,sw,1,inm); //nb sol
+         if(iswp) binch=MMG_swapbin(binch);
+@@ -655,25 +1039,25 @@
+         posnp = ftell(inm);
+         break;
+       } else {
+-        fread(&bpos,sw,1,inm); //Pos 
++        fread(&bpos,sw,1,inm); //Pos
+         if(iswp) bpos=MMG_swapbin(bpos);
+         rewind(inm);
+-        fseek(inm,bpos,SEEK_SET);        
+-      } 
+-    }            
+-    
+-  }       
++        fseek(inm,bpos,SEEK_SET);
++      }
++    }
++
++  }
+   if ( !sol->np ) {
+     fprintf(stdout,"  ** MISSING DATA\n");
+     return(1);
+   }
+ 
+   if ( btyp!= 1 && btyp!=3 ) {
+-    fprintf(stdout,"  ** DATA IGNORED\n");
++    fprintf(stdout,"  ** DATA IGNORED %d\n",btyp);
+     sol->np = 0;
+     return(1);
+   }
+-  
++
+   sol->offset = (btyp==1) ? 1 : 6;
+ 
+   if ( abs(MMG_imprim) > 5 )
+@@ -690,31 +1074,31 @@
+   /* read mesh solutions */
+   sol->npfixe = sol->np;
+   rewind(inm);
+-  fseek(inm,posnp,SEEK_SET);  
++  fseek(inm,posnp,SEEK_SET);
+   for (k=1; k<=sol->np; k++) {
+     isol = (k-1) * sol->offset + 1;
+-    if (sol->ver == 1) { 
++    if (sol->ver == 1) {
+       for (i=0; i<sol->offset; i++) {
+         if(!bin){
+-          fscanf(inm,"%f",&fsol);    
++          fscanf(inm,"%f",&fsol);
+           sol->met[isol + i] = (double) fsol;
+         } else {
+-          fread(&fsol,sw,1,inm);             
++          fread(&fsol,sw,1,inm);
+           if(iswp) fsol=MMG_swapf(fsol);
+           sol->met[isol + i] = (double) fsol;
+         }
+-      } 
++      }
+     } else {
+       for (i=0; i<sol->offset; i++) {
+         if(!bin){
+-          fscanf(inm,"%lf",&sol->met[isol + i]); 
++          fscanf(inm,"%lf",&sol->met[isol + i]);
+ 
+         } else {
+-          fread(&sol->met[isol + i],sd,1,inm);       
++          fread(&sol->met[isol + i],sd,1,inm);
+           if(iswp) sol->met[isol + i]=MMG_swapd(sol->met[isol + i]);
+-        } 
+-      } 
+-    }             
++        }
++      }
++    }
+     /* MMG_swap data */
+     if ( sol->offset == 6 ) {
+       tmp                = sol->met[isol + 2];
+@@ -731,7 +1115,7 @@
+ }
+ 
+ 
+-int MMG_loadVect(pMesh mesh,char *filename,int npmax) {
++int MMG_loadVect(pMesh mesh,char *filename,int npmax,void *dataff) {
+   FILE       *inm;   
+   pDispl       pd;
+   float       fsol;
+@@ -739,7 +1123,11 @@
+   int         k,i,type,bin,dim,btyp,bpos,iadr;
+   long        posnp;
+   char        *ptr,data[128],chaine[128];
+-  
++
++
++  if(dataff)
++    return MMG_loadVectff( mesh, filename,npmax,(DataFF*) dataff);
++
+   pd = mesh->disp;
+   
+   posnp = 0; 
+@@ -768,12 +1156,12 @@
+     strcpy(chaine,"DDD");
+     while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) { 
+       if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
+-          fscanf(inm,"%d",&dim);
+-          if(dim!=3) {
+-            fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim); 
+-            return(1);
+-          }
+-          continue;
++	fscanf(inm,"%d",&dim);
++	if(dim!=3) {
++	  fprintf(stdout,"BAD SOL DIMENSION : %d\n",dim);
++	  return(1);
++	}
++	continue;
+       } else if(!strncmp(chaine,"SolAtVertices",strlen("SolAtVertices"))) {
+         fscanf(inm,"%d",&pd->np); 
+         fscanf(inm,"%d",&type); 
+@@ -881,21 +1269,25 @@
+   if ( abs(mesh->info.imprim) > 3 )
+     fprintf(stdout,"     NUMBER OF GIVEN DATA       %8d\n",pd->np);
+ 
+-  fclose(inm); 
++  fclose(inm);
+   return(1);
+ }
+ 
+ 
+ /* save mesh to disk */
+-int MMG_saveMesh(pMesh mesh,char *filename) {  
+-  FILE*        inm; 
+-	Hedge				 hed;
++int MMG_saveMesh(pMesh mesh,char *filename,void *dataff) {
++  FILE*        inm;
++  Hedge		hed;
+   pPoint       ppt;
+   pTria        pt1;
+   pTetra       pt;
+   int          i,k,np,ne,nc,ned,*cor,*ed,ref,bin,bpos;
+-  char        *ptr,data[128],chaine[128]; 
++  char        *ptr,data[128],chaine[128];
+   int          binch,nu1,nu2;
++
++  if(dataff)
++    return MMG_saveMeshff( mesh, filename,(DataFF*)  dataff);
++
+   mesh->ver = 2; //double precision
+   bin = 0;
+   strcpy(data,filename);
+@@ -950,22 +1342,22 @@
+     assert(cor);   
+   }
+   if(mesh->ned) {   
+-	  if ( !MMG_zaldy4(&hed,mesh->ned) ) {
++    if ( !MMG_zaldy4(&hed,mesh->ned) ) {
+       if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EXPORT EDGES IGNORED\n"); 
+-			mesh->ned = 0;
++      mesh->ned = 0;
+     }   
+     ed = (int*)M_calloc(2*mesh->ned,sizeof(int),"MMG_savemesh");
+-    assert(ed);   
++    assert(ed);
+   }
+-  np = 0; 
++  np = 0;
+   nc = 0;
+   for (k=1; k<=mesh->np; k++) {
+     ppt = &mesh->point[k];
+-    if ( ppt->tag & M_UNUSED )  continue;  
+-		ppt->tmp = ++np;  
++    if ( ppt->tag & M_UNUSED )  continue;
++    ppt->tmp = ++np;
+     if ( ppt->geom & M_CORNER )  cor[nc++] = ppt->tmp;
+   } 
+-	assert(mesh->ncor==nc);
++  assert(mesh->ncor==nc);
+   if(!bin) {
+     strcpy(&chaine[0],"\n\nVertices\n"); 
+     fprintf(inm,"%s",chaine);
+@@ -979,15 +1371,15 @@
+   }
+   for(k=1; k<=mesh->np; k++) {
+     ppt = &mesh->point[k];
+-    if ( ppt->tag & M_UNUSED )  continue;  
+-		//if(ppt->tmp==52453) printf("point %d --> %d\n",ppt->tmp,k);
++    if ( ppt->tag & M_UNUSED )  continue;
++    //if(ppt->tmp==52453) printf("point %d --> %d\n",ppt->tmp,k);
+     if(!bin) {
+       fprintf(inm,"%.15lg %.15lg %.15lg %d\n",ppt->c[0],ppt->c[1],ppt->c[2],ppt->ref);
+     } else {
+-      fwrite((unsigned char*)&ppt->c[0],sd,1,inm);    
+-      fwrite((unsigned char*)&ppt->c[1],sd,1,inm);    
+-      fwrite((unsigned char*)&ppt->c[2],sd,1,inm);    
+-      fwrite((unsigned char*)&ppt->ref,sw,1,inm);    
++      fwrite((unsigned char*)&ppt->c[0],sd,1,inm);
++      fwrite((unsigned char*)&ppt->c[1],sd,1,inm);
++      fwrite((unsigned char*)&ppt->c[2],sd,1,inm);
++      fwrite((unsigned char*)&ppt->ref,sw,1,inm);
+     }
+   }
+ 
+@@ -995,7 +1387,7 @@
+   mesh->nt = 0;
+   if(MMG_markBdry(mesh)) {
+     if(!bin) {
+-      strcpy(&chaine[0],"\n\nTriangles\n"); 
++      strcpy(&chaine[0],"\n\nTriangles\n");
+       fprintf(inm,"%s",chaine);
+       fprintf(inm,"%d \n",mesh->nt);
+     } else {
+@@ -1003,48 +1395,48 @@
+       fwrite(&binch,sw,1,inm);
+       bpos += 12+16*mesh->nt; //Pos
+       fwrite(&bpos,sw,1,inm);
+-      fwrite(&mesh->nt,sw,1,inm);    
++      fwrite(&mesh->nt,sw,1,inm);
+     }
+     for (k=1; k<=mesh->nt; k++) {
+       pt1  = &mesh->tria[k];
+-  	    ref  = pt1->ref;    
++      ref  = pt1->ref;
+       if(!bin) {
+         fprintf(inm,"%d %d %d %d\n",mesh->point[pt1->v[0]].tmp,mesh->point[pt1->v[1]].tmp
+-    							  ,mesh->point[pt1->v[2]].tmp,ref);
++		,mesh->point[pt1->v[2]].tmp,ref);
+       } else {
+         fwrite(&mesh->point[pt1->v[0]].tmp,sw,1,inm);    
+         fwrite(&mesh->point[pt1->v[1]].tmp,sw,1,inm);    
+         fwrite(&mesh->point[pt1->v[2]].tmp,sw,1,inm);    
+-        fwrite(&ref,sw,1,inm);    
++        fwrite(&ref,sw,1,inm);
+       }
+     }
+-  }   
++  }
+  
+   /* write tetrahedra */
+-  ne = 0; 
+-	ned = 0;  
+-	//printf("avt %d\n",mesh->ned);
++  ne = 0;
++  ned = 0;
++  //printf("avt %d\n",mesh->ned);
+   for (k=1; k<=mesh->ne; k++) {
+     pt = &mesh->tetra[k];
+     if ( !pt->v[0] )  continue;
+-		if(mesh->ned) {
+-		  for (i=0 ; i<6 ; i++) {
+-		  	if (pt->bdryinfo[i]) {
+-		  		nu1 = pt->v[MMG_iare[i][0]];
+-		  		nu2 = pt->v[MMG_iare[i][1]];
+-		  		if (MMG_edgePut(&hed,nu1,nu2,2)<=1) {
+-		  			ed[2*ned] = (mesh->point[nu1]).tmp;
+-		  			ed[2*ned + 1] = (mesh->point[nu2]).tmp;
+-		  			ned++;
+-		  		} 
+-		  	}
+-		  } 
+-		}
+-	  ne++;  
++    if(mesh->ned) {
++      for (i=0 ; i<6 ; i++) {
++	if (pt->bdryinfo[i]) {
++	  nu1 = pt->v[MMG_iare[i][0]];
++	  nu2 = pt->v[MMG_iare[i][1]];
++	  if (MMG_edgePut(&hed,nu1,nu2,2)<=1) {
++	    ed[2*ned] = (mesh->point[nu1]).tmp;
++	    ed[2*ned + 1] = (mesh->point[nu2]).tmp;
++	    ned++;
++	  }
++	}
++      }
++    }
++    ne++;
+   }
+-	//printf("ned %d\n",ned);
++  //printf("ned %d\n",ned);
+   if(!bin) {
+-    strcpy(&chaine[0],"\n\nTetrahedra\n"); 
++    strcpy(&chaine[0],"\n\nTetrahedra\n");
+     fprintf(inm,"%s",chaine);
+     fprintf(inm,"%d\n",ne);
+   } else {
+@@ -1052,17 +1444,17 @@
+     fwrite(&binch,sw,1,inm);
+     bpos += 12 + 20*ne;//Pos
+     fwrite(&bpos,sw,1,inm);
+-    fwrite((unsigned char*)&ne,sw,1,inm);    
+-  } 
+-	ne=0;
++    fwrite((unsigned char*)&ne,sw,1,inm);
++  }
++  ne=0;
+   for (k=1; k<=mesh->ne; k++) {
+     pt = &mesh->tetra[k];
+-    if ( !pt->v[0] )  continue;  
+-		ne++; 
++    if ( !pt->v[0] )  continue;
++    ne++;
+     ref = pt->ref;    
+     if(!bin) {
+       fprintf(inm,"%d %d %d %d %d\n",mesh->point[pt->v[0]].tmp,mesh->point[pt->v[1]].tmp
+-  							   ,mesh->point[pt->v[2]].tmp,mesh->point[pt->v[3]].tmp,ref);
++	      ,mesh->point[pt->v[2]].tmp,mesh->point[pt->v[3]].tmp,ref);
+     } else {
+       fwrite(&mesh->point[pt->v[0]].tmp,sw,1,inm);    
+       fwrite(&mesh->point[pt->v[1]].tmp,sw,1,inm);    
+@@ -1084,17 +1476,17 @@
+       fwrite(&bpos,sw,1,inm);
+       fwrite((unsigned char*)&ned,sw,1,inm);    
+     } 
+-  	  for (k=0; k<ned; k++) {
+-   	    ref = 0;    
+-  	    if(!bin) {
+-  	      fprintf(inm,"%d %d %d \n",ed[2*k],ed[2*k+1],ref);
+-  	    } else {
+-  	      fwrite(&ed[2*k],sw,1,inm);    
+-  	      fwrite(&ed[2*k+1],sw,1,inm);    
+-  	      fwrite(&ref,sw,1,inm);    
+-  	    }
+-  	  }
+-  	  M_free(hed.item);
++    for (k=0; k<ned; k++) {
++      ref = 0;
++      if(!bin) {
++	fprintf(inm,"%d %d %d \n",ed[2*k],ed[2*k+1],ref);
++      } else {
++	fwrite(&ed[2*k],sw,1,inm);
++	fwrite(&ed[2*k+1],sw,1,inm);
++	fwrite(&ref,sw,1,inm);
++      }
++    }
++    M_free(hed.item);
+   }
+   
+   /* write corners */
+@@ -1139,13 +1531,13 @@
+     if ( mesh->ned )
+       fprintf(stdout,"     TOTAL NUMBER OF EDGES      %8d\n",ned);
+   }
+-	//if(ned!=mesh->ned) exit(0);
++  //if(ned!=mesh->ned) exit(0);
+   return(1);
+ 
+ }
+ 
+ 
+-int MMG_saveSol(pMesh mesh,pSol sol,char *filename) {
++int MMG_saveSol(pMesh mesh,pSol sol,char *filename,void *dataff) {
+   FILE*        inm;
+   pPoint       ppt;
+   float        fsol;
+@@ -1154,6 +1546,9 @@
+   char        *ptr,data[128],chaine[128]; 
+   int          binch;
+ 
++  if(dataff)
++    return MMG_saveSolff( mesh, sol, filename,(DataFF*) dataff);
++
+   if ( !sol->np )  return(1);
+   bin = 1;
+   strcpy(data,filename);
+@@ -1165,17 +1560,17 @@
+       *ptr = '\0';
+       bin  = 0;
+     } else {
+-	    ptr = strstr(data,".solb");
+-	    if ( ptr ) {
+-	      *ptr = '\0';
+-	      bin  = 1;	
++      ptr = strstr(data,".solb");
++      if ( ptr ) {
++	*ptr = '\0';
++	bin  = 1;
+       } else {
+-			  ptr = strstr(data,".sol");
+-			  if ( ptr ) {
+-			    *ptr = '\0';
+-			    bin  = 0;	
+-			  }
+-			}
++	ptr = strstr(data,".sol");
++	if ( ptr ) {
++	  *ptr = '\0';
++	  bin  = 0;
++	}
++      }
+     } 
+   }
+   if ( bin ) 
+@@ -1218,13 +1613,13 @@
+ 
+   switch(sol->offset) {
+   case 1:
+-	 typ = 1;
+-   break;
++    typ = 1;
++    break;
+   case 6:
+-	  typ = 3;
++    typ = 3;
+     break;
+   default:
+-    fprintf(stdout,"  ** DATA IGNORED\n");
++    fprintf(stdout,"  ** DATA IGNORED not 1 ou 6 == %d\n",sol->offset);
+     return(0);
+   }
+ 
+@@ -1233,7 +1628,7 @@
+   for (k=1; k<=mesh->np; k++) {
+     ppt = &mesh->point[k];
+     if ( ppt->tag & M_UNUSED )  continue;
+-	nbl++;
++    nbl++;
+   }
+   
+   if(!bin) {
+@@ -1301,7 +1696,7 @@
+ }
+ 
+ /*save the node speed : coornew-coorold/dt*/
+-int MMG_saveVect(pMesh mesh,char *filename) {
++int MMG_saveVect(pMesh mesh,char *filename,void *dataff) {
+   FILE*        inm;  
+   pDispl        pd;
+   pPoint       ppt;
+@@ -1310,6 +1705,9 @@
+   char        *ptr,data[128],chaine[128]; 
+   unsigned char binch;
+ 
++  if(dataff)
++    return MMG_saveVectff( mesh, filename,(DataFF*) dataff);
++
+   pd      = mesh->disp;
+   pd->ver = 2;
+ 
+@@ -1358,14 +1756,14 @@
+     fwrite(&binch,sw,1,inm);
+     
+   }
+-	typ = 2;
++  typ = 2;
+ 
+   /* write data */
+   nbl = 0;
+   for (k=1; k<=mesh->np; k++) {
+     ppt = &mesh->point[k];
+     if ( ppt->tag & M_UNUSED )  continue;
+-	nbl++;
++    nbl++;
+   }
+   
+   if(!bin) {
+Index: mmg3d-4.0/build/sources/libmmg3d.h
+===================================================================
+--- mmg3d-4.0.orig/build/sources/libmmg3d.h	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/libmmg3d.h	2013-02-08 16:10:00.000000000 +0100
+@@ -111,12 +111,12 @@
+ typedef MMG_Sol * MMG_pSol;
+ 
+ /* inout */
+-int  MMG_loadMesh(MMG_pMesh ,char *);
+-int  MMG_loadSol(MMG_pSol ,char *,int );
+-int  MMG_loadVect(MMG_pMesh ,char *,int );
+-int  MMG_saveMesh(MMG_pMesh ,char *);
+-int  MMG_saveSol(MMG_pMesh ,MMG_pSol ,char *);
+-int  MMG_saveVect(MMG_pMesh ,char *);
++int  MMG_loadMesh(MMG_pMesh ,char *,void *);
++int  MMG_loadSol(MMG_pSol ,char *,int ,void *);
++int  MMG_loadVect(MMG_pMesh ,char *,int ,void *);
++int  MMG_saveMesh(MMG_pMesh ,char *,void *);
++int  MMG_saveSol(MMG_pMesh ,MMG_pSol ,char *,void *);
++int  MMG_saveVect(MMG_pMesh ,char *,void *);
+ 
+ #ifdef  __cplusplus
+ namespace mmg3d{
+Index: mmg3d-4.0/build/sources/mesh.h
+===================================================================
+--- mmg3d-4.0.orig/build/sources/mesh.h	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/mesh.h	2013-02-08 16:10:00.000000000 +0100
+@@ -394,17 +394,17 @@
+ 
+ /* function pointers */
+ typedef int (*MMG_Swap)(pMesh ,pSol ,pList );
+-MMG_Swap MMG_swpptr;
+-double (*MMG_length)(double *,double *,double *,double *);
+-double (*MMG_caltet)(pMesh ,pSol ,int );
+-double (*MMG_calte1)(pMesh ,pSol ,int );
+-int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
+-int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
+-int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
+-int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
+-int    (*MMG_interp)(double *,double *,double *,double );
+-int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
+-int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
++extern MMG_Swap MMG_swpptr;
++extern double (*MMG_length)(double *,double *,double *,double *);
++extern double (*MMG_caltet)(pMesh ,pSol ,int );
++extern double (*MMG_calte1)(pMesh ,pSol ,int );
++extern int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
++extern int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
++extern int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
++extern int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
++extern int    (*MMG_interp)(double *,double *,double *,double );
++extern int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
++extern int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
+ 
+ 
+ #endif
+Index: mmg3d-4.0/build/sources/mmg3d4.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/mmg3d4.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/mmg3d4.c	2013-02-08 16:10:00.000000000 +0100
+@@ -45,11 +45,11 @@
+ ****************************************************************************/
+ #include "mesh.h"
+ 
+-int MMG_npuiss,MMG_nvol,MMG_npres;
+-int MMG_nlen,MMG_ncal,MMG_ntopo,MMG_nex;
+-int MMG_npuisstot,MMG_nvoltot,MMG_nprestot;
+-int MMG_npdtot;
+-int MMG_nplen,MMG_npref,MMG_bouffe;
++extern int MMG_npuiss,MMG_nvol,MMG_npres;
++extern int MMG_nlen,MMG_ncal,MMG_ntopo,MMG_nex;
++extern int MMG_npuisstot,MMG_nvoltot,MMG_nprestot;
++extern int MMG_npdtot;
++extern int MMG_nplen,MMG_npref,MMG_bouffe;
+ 
+ int ddebug;
+ 
+@@ -117,8 +117,8 @@
+       if ( *alert ) {
+         fprintf(stdout," \n\n ** UNABLE TO CUT (analarcutting)\n");
+         fprintf(stdout," ** RETRY WITH -m > %6d \n\n",mesh->info.memory);
+-        MMG_saveMesh(mesh,"crash.meshb");
+-        MMG_saveSol(mesh,sol,"crash.solb"); 
++        MMG_saveMesh(mesh,"crash.meshb",0);
++        MMG_saveSol(mesh,sol,"crash.solb",0);
+         exit(0);
+       }
+       M_free(hash.item);        
+@@ -131,7 +131,7 @@
+       if ( !MMG_markBdry(mesh) )   return(0);
+     }
+     // printf("chkmsh\n");
+-    // MMG_saveMesh(mesh,"chk.mesh");
++    // MMG_saveMesh(mesh,"chk.mesh",0);
+     //MMG_chkmsh(mesh,1,-1);
+ 		//if(it==1)exit(0);		
+      /* delaunization */
+@@ -159,7 +159,7 @@
+   }
+ 
+ 	//return(1);
+-	//MMG_saveMesh(mesh,"aprescut.mesh");
++	//MMG_saveMesh(mesh,"aprescut.mesh",0);
+ 	fprintf(stdout,"    ---\n");
+   
+   /*analyze standard*/
+@@ -201,7 +201,7 @@
+       }
+       if ( na+nd && abs(mesh->info.imprim) > 3 )
+         fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);    
+-			// MMG_saveMesh(mesh,"chk.mesh");
++			// MMG_saveMesh(mesh,"chk.mesh",0);
+ 			// //if(it==1) exit(0);
+     }
+     while ( na+nd > 0 && ++it < maxtou );
+Index: mmg3d-4.0/build/sources/mmg3dConfig.h
+===================================================================
+--- mmg3d-4.0.orig/build/sources/mmg3dConfig.h	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/mmg3dConfig.h	2013-02-08 16:10:00.000000000 +0100
+@@ -2,4 +2,4 @@
+ #define Tutorial_VERSION_MAJOR 
+ #define Tutorial_VERSION_MINOR 
+ 
+-#define USE_SCOTCH
++/* #undef USE_SCOTCH */
+Index: mmg3d-4.0/build/sources/mmg3dlib.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/mmg3dlib.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/mmg3dlib.c	2013-02-08 16:10:00.000000000 +0100
+@@ -332,7 +332,7 @@
+   if ( !MMG_hashTetra(mesh) )    return(1);
+   if ( !MMG_markBdry(mesh) )     return(1);
+   if (abs(mesh->info.option)==10) {
+-    MMG_saveMesh(mesh,"tetra.mesh");
++    MMG_saveMesh(mesh,"tetra.mesh",0);
+     return(0);
+   }           
+   if ( !sol->np) {
+@@ -378,7 +378,7 @@
+     if ( abs(info->option) == 9 ) {  
+       if(!MMG_mmg3d9(mesh,sol,&alert)) {
+         if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
+-        MMG_saveMesh(mesh,"errormoving.mesh");
++        MMG_saveMesh(mesh,"errormoving.mesh",0);
+ 	      //MMG_saveSol(mesh,sol,mesh->outf);
+ 	      return(1);
+       }
+Index: mmg3d-4.0/build/sources/mmg3d.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/mmg3d.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/mmg3d.c	2013-02-08 16:10:41.000000000 +0100
+@@ -46,6 +46,7 @@
+ #include "compil.date"
+ #include "mesh.h"
+ #include "eigenv.h"
++#include "dataff.h"
+ 
+ TIM_mytime         MMG_ctim[TIMEMAX];
+ short	             MMG_imprim;
+@@ -395,6 +396,7 @@
+ 	    100.*ttot/ttim[0],call[0],ttot/(float)call[0]);
+   }
+   fprintf(stdout,"\n   ELAPSED TIME  %.2f SEC.  (%.2f)\n",ttim[0],ttot);
++  fflush(stdout);
+ }
+ 
+ 
+@@ -432,7 +434,7 @@
+ }
+ 
+ 
+-int main(int argc,char *argv[]) {
++int mainmmg3d(int argc,char *argv[],DataFF *dataff) {
+   pMesh      	mesh;
+   pSol       	sol;
+   Info     	*info;
+@@ -450,7 +452,7 @@
+   signal(SIGSEGV,excfun);
+   signal(SIGTERM,excfun);
+   signal(SIGINT,excfun);
+-  atexit(endcod);
++  if(dataff==0) atexit(endcod);
+ 
+   TIM_tminit(MMG_ctim,TIMEMAX);
+   TIM_chrono(ON,&MMG_ctim[0]);
+@@ -478,14 +480,27 @@
+   info->dt       = 1.;
+   info->bdry     = 0;
+ 
++   /* modif F. Hecht ..*/
++   if(dataff)
++     {
++       mesh->name=dataff->meshname;
++       mesh->move=dataff->movename;
++       sol->name=dataff->solname;
++       /*      printf(" #### %p %p %p --- \n",mesh->name,mesh->move,sol->name); */
++       info->imprim=dataff->imprim;
++       info->memory=dataff->memory;
++     }
++   /* end modf */
++
+   if ( !parsar(argc,argv,mesh,sol) )  return(1);
+   MMG_imprim = info->imprim;
+   
+   /* load data */
+   if ( MMG_imprim )   fprintf(stdout,"\n  -- INPUT DATA\n");
+   TIM_chrono(ON,&MMG_ctim[1]);
+-  if ( !MMG_loadMesh(mesh,mesh->name) )  return(1); 
+-  if ( !MMG_loadSol(sol,sol->name,mesh->npmax) )  return(1);
++  /* modif FH. for interface with ff++ add dataff param     */
++  if ( !MMG_loadMesh(mesh,mesh->name,dataff) )  return(1);
++  if ( !MMG_loadSol(sol,sol->name,mesh->npmax,dataff ) )  return(1);
+   if ( sol->np && sol->np != mesh->np ) {
+     fprintf(stdout,"  ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n");
+     sol->np = 0;
+@@ -493,7 +508,7 @@
+ 
+   if ( !parsop(mesh) )  return(1);
+ 
+-  if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np) )  return(0);
++  if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np,dataff) )  return(0);
+ 
+   if ( !MMG_setfunc(sol->offset) ) return(1);
+   if ( !MMG_scaleMesh(mesh,sol) )  return(1);
+@@ -523,7 +538,7 @@
+   if ( !MMG_hashTetra(mesh) )    return(1);
+   if ( !MMG_markBdry(mesh) )     return(1);
+   if (abs(mesh->info.option)==10) {
+-    MMG_saveMesh(mesh,"tetra.mesh");
++    MMG_saveMesh(mesh,"tetra.mesh",dataff);
+     return(0);
+   }           
+ 
+@@ -566,8 +581,8 @@
+     if ( abs(info->option) == 9 ) {
+       if(!MMG_mmg3d9(mesh,sol,&alert)) {
+         if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
+-        MMG_saveMesh(mesh,mesh->outf);
+-	    MMG_saveSol(mesh,sol,mesh->outf);
++        MMG_saveMesh(mesh,mesh->outf,dataff);
++	    MMG_saveSol(mesh,sol,mesh->outf,dataff);
+ 	    return(1);
+       }
+       /*puts("appel 1");
+@@ -669,16 +684,16 @@
+     fprintf(stdout,"\n  ## WARNING: INCOMPLETE MESH  %d , %d\n",
+             mesh->np,mesh->ne);
+ 
+-  if ( MMG_imprim )  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf);
++  if ( MMG_imprim && !dataff )  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf);
+   TIM_chrono(ON,&MMG_ctim[1]);
+   if ( !MMG_unscaleMesh(mesh,sol) )  return(1);
+-  MMG_saveMesh(mesh,mesh->outf);
++  MMG_saveMesh(mesh,mesh->outf,dataff);
+   if ( info->option == 9 ) {
+-    MMG_saveSol(mesh,sol,mesh->outf);
+-    MMG_saveVect(mesh,mesh->move);    
++    MMG_saveSol(mesh,sol,mesh->outf,dataff);
++    MMG_saveVect(mesh,mesh->move,dataff);
+   }
+   else
+-    MMG_saveSol(mesh,sol,mesh->outf);
++    MMG_saveSol(mesh,sol,mesh->outf,dataff);
+   TIM_chrono(OFF,&MMG_ctim[1]);
+   if ( MMG_imprim )  fprintf(stdout,"  -- WRITING COMPLETED\n");
+ 
+@@ -697,5 +712,25 @@
+ 
+   if ( MMG_imprim < -4 || info->ddebug )  M_memDump();
+   M_free(mesh);
++  if(MMG_imprim && dataff ) endcod();
+   return(0);
+ }
++
++int main(int argc,char *argv[])  {
++    return  mainmmg3d( argc,argv,0);
++}
++/*
++ def
++ */
++ MMG_Swap MMG_swpptr;
++ double (*MMG_length)(double *,double *,double *,double *);
++ double (*MMG_caltet)(pMesh ,pSol ,int );
++ double (*MMG_calte1)(pMesh ,pSol ,int );
++ int    (*MMG_caltet2)(pMesh ,pSol ,int ,int ,double ,double *);
++ int    (*MMG_cavity)(pMesh ,pSol ,int ,int ,pList ,int );
++ int    (*MMG_buckin)(pMesh ,pSol ,pBucket ,int );
++ int    (*MMG_optlen)(pMesh ,pSol ,double ,int );
++ int    (*MMG_interp)(double *,double *,double *,double );
++ int    (*MMG_optlentet)(pMesh ,pSol ,pQueue ,double ,int ,int );
++ int    (*MMG_movevertex)(pMesh ,pSol ,int ,int );
++
+Index: mmg3d-4.0/build/sources/optlen.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/optlen.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/optlen.c	2013-02-08 16:10:00.000000000 +0100
+@@ -48,7 +48,7 @@
+ #define  HQCOEF    0.9 
+ #define  HCRIT     0.98
+ 
+-double MMG_rao(pMesh mesh,int k,int inm);
++double MMG_rao(pMesh mesh,int k,FILE* );
+ int MMG_optlen_ani(pMesh mesh,pSol sol,double declic,int base) {
+   pTetra    pt,pt1;
+   pPoint    ppa,ppb;
+Index: mmg3d-4.0/build/sources/pattern.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/pattern.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/pattern.c	2013-02-08 16:10:00.000000000 +0100
+@@ -47,7 +47,7 @@
+ 
+ 
+ unsigned char MMG_arfa[3][4] = { {2,0,1,3}, {1,2,0,3}, {0,1,2,3} }; 
+-extern int MMG_permar[10][4];
++extern int MMG_permar[12][4];
+ extern int MMG_pointar[64][2];
+ extern int ddebug;
+ //insert ip on ia-ib
+Index: mmg3d-4.0/build/sources/quality.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/quality.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/quality.c	2013-02-08 16:10:00.000000000 +0100
+@@ -46,7 +46,7 @@
+ #include "mesh.h"  
+ 
+ 
+-double MMG_rao(pMesh mesh,int k,int inm);
++double MMG_rao(pMesh mesh,int k,FILE* inm) ;
+ double MMG_caltetrao(pMesh mesh,pSol sol,int iel) {
+ 	return(MMG_rao(mesh,iel,0));
+ }
+Index: mmg3d-4.0/build/sources/ratio.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/ratio.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/ratio.c	2013-02-08 16:10:00.000000000 +0100
+@@ -365,7 +365,7 @@
+   fprintf(stdout,"           ELEMENT   %d (%d)   %d %d %d %d\n",
+ 	  iel,ielreal,pt->v[0],pt->v[1],pt->v[2],pt->v[3]);
+ 
+-  if ( abs(mesh->info.imprim) < 5 )  return;
++  if ( abs(mesh->info.imprim) < 5 )  return (1) ;
+ 
+   fprintf(stdout,"\n     HISTOGRAMM\n");
+   for (k=1; k<9; k++) {
+Index: mmg3d-4.0/build/sources/sproto.h
+===================================================================
+--- mmg3d-4.0.orig/build/sources/sproto.h	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/sproto.h	2013-02-08 16:10:00.000000000 +0100
+@@ -67,13 +67,13 @@
+ int  MMG_inEdge(pHedge ,int *,int *,int *);
+ int  MMG_markBdry(pMesh );
+ 
+-/* inout */
+-int  MMG_loadMesh(pMesh ,char *);
+-int  MMG_loadSol(pSol ,char *,int );
+-int  MMG_loadVect(pMesh ,char *,int );
+-int  MMG_saveMesh(pMesh ,char *);
+-int  MMG_saveSol(pMesh ,pSol ,char *);
+-int  MMG_saveVect(pMesh ,char *);
++/* inout add param  F.H. june 2011 (dataff) */
++int  MMG_loadMesh(pMesh ,char *,void *);
++int  MMG_loadSol(pSol ,char *,int ,void *);
++int  MMG_loadVect(pMesh ,char *,int ,void *);
++int  MMG_saveMesh(pMesh ,char *,void *);
++int  MMG_saveSol(pMesh ,pSol ,char *,void *);
++int  MMG_saveVect(pMesh ,char *,void *);
+ 
+ int  MMG_loctet(pMesh ,int ,int ,double *,double *);
+ int  MMG_computeMetric(pMesh ,pSol ,int ,double * );
+Index: mmg3d-4.0/build/sources/swapar.c
+===================================================================
+--- mmg3d-4.0.orig/build/sources/swapar.c	2013-02-08 16:09:57.000000000 +0100
++++ mmg3d-4.0/build/sources/swapar.c	2013-02-08 16:10:00.000000000 +0100
+@@ -77,7 +77,7 @@
+   }
+ 
+   if ( ncas && MMG_swpptr ) {
+-		if(ddebug) MMG_saveMesh(mesh,"avt.mesh");
++		if(ddebug) MMG_saveMesh(mesh,"avt.mesh",0);
+     for (l=1; l<=lon; l++) {
+       jel = list->tetra[l]/6;
+       pt  = &mesh->tetra[jel]; 
+@@ -97,7 +97,7 @@
+       if ( pt->qual >= declic )  MMG_kiuput(q,jel);
+       for (i=0; i<4; i++)  mesh->point[pt->v[i]].flag = mesh->flag; 
+     }
+-		if(ddebug) MMG_saveMesh(mesh,"sw.mesh");
++		if(ddebug) MMG_saveMesh(mesh,"sw.mesh",0);
+     return(1);
+   }
+ 
+Index: mmg3d-4.0/build/libexamples/main.c
+===================================================================
+--- mmg3d-4.0.orig/build/libexamples/main.c	2011-04-15 15:35:37.000000000 +0200
++++ mmg3d-4.0/build/libexamples/main.c	2013-02-08 16:12:37.000000000 +0100
+@@ -108,10 +108,10 @@
+   }
+ 
+   /*save result*/
+-	MMG_saveMesh(mmgMesh,"result.mesh");
++	MMG_saveMesh(mmgMesh,"result.mesh", NULL);
+ 
+   /*save metric*/
+-	MMG_saveSol(mmgMesh,mmgSol,"result.sol");
++	MMG_saveSol(mmgMesh,mmgSol,"result.sol", NULL);
+ 
+   /* free mem */
+   free(mmgMesh->point);

Modified: packages/mmg3d/trunk/debian/patches/install.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/patches/install.patch?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/patches/install.patch	(original)
+++ packages/mmg3d/trunk/debian/patches/install.patch	Mon Jan 27 18:02:22 2014
@@ -1,7 +1,7 @@
 Index: mmg3d-4.0/build/CMakeLists.txt
 ===================================================================
---- mmg3d-4.0.orig/build/CMakeLists.txt	2011-11-21 17:57:16.000000000 +0100
-+++ mmg3d-4.0/build/CMakeLists.txt	2011-11-22 11:09:49.000000000 +0100
+--- mmg3d-4.0.orig/build/CMakeLists.txt	2011-08-26 15:08:14.000000000 +0200
++++ mmg3d-4.0/build/CMakeLists.txt	2013-03-27 11:27:19.000000000 +0100
 @@ -57,43 +57,43 @@
  
  add_executable(mmg3d4.0 ${source_files})                                    
@@ -23,6 +23,7 @@
 +  SET(MMG3_LIBRARY_TYPE STATIC)
  endif (COMPIL_SHARED_LIBRARY)   
  
+ find_library(M_LIB m)
 +add_library(mmg3dlib4.0 ${MMG3_LIBRARY_TYPE} ${source_files})
 +target_link_libraries(mmg3dlib4.0 ${M_LIB} ${LIBS_SCOTCH} ${LIBS_SCOTCHERR})
 +
@@ -32,7 +33,6 @@
 +                         SOVERSION 4.0)
 +
 +
- find_library(M_LIB m)
  target_link_libraries(mmg3d4.0 ${M_LIB} ${LIBS_SCOTCH} ${LIBS_SCOTCHERR})    
  
  #add testlib   

Modified: packages/mmg3d/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/patches/series?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/patches/series	(original)
+++ packages/mmg3d/trunk/debian/patches/series	Mon Jan 27 18:02:22 2014
@@ -1 +1,2 @@
 install.patch
+freefem++.patch

Modified: packages/mmg3d/trunk/debian/rules
URL: http://svn.debian.org/wsvn/debian-science/packages/mmg3d/trunk/debian/rules?rev=46478&op=diff
==============================================================================
--- packages/mmg3d/trunk/debian/rules	(original)
+++ packages/mmg3d/trunk/debian/rules	Mon Jan 27 18:02:22 2014
@@ -4,22 +4,22 @@
 SOVERSION = 4.0
 VERSION = 4
 
-include /usr/share/cdbs/1/rules/debhelper.mk
-include /usr/share/cdbs/1/class/cmake.mk
-#include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
 
-#include /usr/share/hardening-includes/hardening.make
+CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
+CXFLAGS=$(shell dpkg-buildflags --get CXFLAGS)
+LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
+#LDFLAGS+=-lm
 
-#CFLAGS=$(shell dpkg-buildflags --get CFLAGS)
-#CXFLAGS=$(shell dpkg-buildflags --get CXFLAGS)
-#LDFLAGS=$(shell dpkg-buildflags --get LDFLAGS)
-#CFLAGS+=$(HARDENING_CFLAGS)
-#CXXFLAGS+=$(HARDENING_CFLAGS)
-#LDFLAGS+=$(HARDENING_LDFLAGS)
+%:
+	dh $@ --buildsystem=cmake --sourcedirectory=build
 
-# no check for this software
-DEB_MAKE_CHECK_TARGET := 
-
-DEB_CMAKE_EXTRA_FLAGS= -DCOMPIL_SHARED_LIBRARY="ON" \
+extra_flags += \
+	-DCOMPIL_SHARED_LIBRARY="ON" \
 	-DINCLUDE_SCOTCH:PATH="/usr/include/scotch"
 
+override_dh_auto_configure:
+	dh_auto_configure -- $(extra_flags)
+	
+#override_dh_auto_test:




More information about the debian-science-commits mailing list