r47220 - in /packages/gmsh-tetgen/trunk/debian: ./ patches/

trophime-guest at users.alioth.debian.org trophime-guest at users.alioth.debian.org
Wed Apr 13 12:57:44 UTC 2016


Author: trophime-guest
Date: Wed Apr 13 12:57:44 2016
New Revision: 47220

URL: http://svn.debian.org/wsvn/debian-science/?sc=1&rev=47220
Log:
update to 2.12.0 and later

Modified:
    packages/gmsh-tetgen/trunk/debian/changelog
    packages/gmsh-tetgen/trunk/debian/patches/add-missing-headers.patch
    packages/gmsh-tetgen/trunk/debian/patches/api_demos.patch
    packages/gmsh-tetgen/trunk/debian/patches/cgns.patch
    packages/gmsh-tetgen/trunk/debian/patches/change_shared_library_name.patch
    packages/gmsh-tetgen/trunk/debian/patches/clang.patch
    packages/gmsh-tetgen/trunk/debian/patches/delete_gl2ps_from_source.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix-cmake-hdf5.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix-cmake.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix-common-os-cpp.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix_FTBFS_linking.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix_gmshpy_import.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix_libdir.patch
    packages/gmsh-tetgen/trunk/debian/patches/fix_script_header.patch
    packages/gmsh-tetgen/trunk/debian/patches/med.patch
    packages/gmsh-tetgen/trunk/debian/patches/metis-errormsg.patch
    packages/gmsh-tetgen/trunk/debian/patches/mmg3d4.0.2.patch
    packages/gmsh-tetgen/trunk/debian/patches/petsc.patch
    packages/gmsh-tetgen/trunk/debian/patches/python-cmake.patch
    packages/gmsh-tetgen/trunk/debian/patches/series
    packages/gmsh-tetgen/trunk/debian/patches/sgeom.patch
    packages/gmsh-tetgen/trunk/debian/patches/skip_license_file.patch
    packages/gmsh-tetgen/trunk/debian/patches/tetgen.patch
    packages/gmsh-tetgen/trunk/debian/patches/texinfo.patch

Modified: packages/gmsh-tetgen/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/changelog?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/changelog	(original)
+++ packages/gmsh-tetgen/trunk/debian/changelog	Wed Apr 13 12:57:44 2016
@@ -1,3 +1,9 @@
+gmsh-tetgen (2.12.0-1) unstable; urgency=medium
+
+  * new upstream release
+
+ -- Christophe Trophime <christophe.trophime at lncmi.cnrs.fr>  Wed, 16 Mar 2016 18:38:56 +0100
+
 gmsh-tetgen (2.11.0-4) unstable; urgency=medium
 
   * Rebuild against med-fichier 3.1.0 

Modified: packages/gmsh-tetgen/trunk/debian/patches/add-missing-headers.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/add-missing-headers.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/add-missing-headers.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/add-missing-headers.patch	Wed Apr 13 12:57:44 2016
@@ -3,27 +3,19 @@
 Reviewed-by: Anton Gladky <gladky.anton at gmail.com>
 Last-Update: 2012-06-24
 
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -112,6 +112,7 @@ set(GMSH_API
-     Common/VertexArray.h Common/Octree.h Common/OctreeInternals.h
-     Common/OS.h Common/StringUtils.h Common/OpenFile.h
-     Common/onelab.h Common/GmshSocket.h Common/onelabUtils.h
-+    Common/Options.h
-   Numeric/Numeric.h Numeric/GaussIntegration.h Numeric/polynomialBasis.h
-     Numeric/JacobianBasis.h Numeric/MetricBasis.h Numeric/bezierBasis.h Numeric/fullMatrix.h
-     Numeric/FuncSpaceData.h
-@@ -134,6 +135,7 @@ set(GMSH_API
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -130,6 +130,7 @@ set(GMSH_API
      Mesh/meshGFaceElliptic.h Mesh/meshPartition.h Mesh/meshGFaceDelaunayInsertion.h
      Mesh/simple3D.h Mesh/meshPartitionOptions.h Mesh/directions3D.h Mesh/yamakawa.h
-     Mesh/Voronoi3D.h Mesh/Levy3D.h Mesh/periodical.h Mesh/meshMetric.h
+     Mesh/Voronoi3D.h Mesh/Levy3D.h Mesh/periodical.h Mesh/meshMetric.h Mesh/ThinLayer.h
 +    Mesh/Field.h
    Numeric/mathEvaluator.h
    Solver/dofManager.h Solver/femTerm.h Solver/laplaceTerm.h Solver/elasticityTerm.h
      Solver/crossConfTerm.h Solver/orthogonalTerm.h
-@@ -145,6 +147,7 @@ set(GMSH_API
+@@ -141,6 +142,7 @@ set(GMSH_API
    Post/PViewDataList.h Post/PViewDataGModel.h Post/PViewOptions.h Post/ColorTable.h
     Numeric/nodalBasis.h Post/adaptiveData.h
    Graphics/drawContext.h

Modified: packages/gmsh-tetgen/trunk/debian/patches/api_demos.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/api_demos.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/api_demos.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/api_demos.patch	Wed Apr 13 12:57:44 2016
@@ -1,7 +1,7 @@
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainAntTweakBar.cpp
-===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/utils/api_demos/mainAntTweakBar.cpp
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainAntTweakBar.cpp
+Index: gmsh-tetgen-2.12.0/utils/api_demos/mainAntTweakBar.cpp
+===================================================================
+--- gmsh-tetgen-2.12.0.orig/utils/api_demos/mainAntTweakBar.cpp
++++ gmsh-tetgen-2.12.0/utils/api_demos/mainAntTweakBar.cpp
 @@ -14,6 +14,7 @@
  #include "GModel.h"
  #include "MElement.h"
@@ -10,10 +10,10 @@
  
  static drawContext *ctx = 0;
  static mousePosition clickPos, prevPos;
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainOcc.cpp
-===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/utils/api_demos/mainOcc.cpp
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainOcc.cpp
+Index: gmsh-tetgen-2.12.0/utils/api_demos/mainOcc.cpp
+===================================================================
+--- gmsh-tetgen-2.12.0.orig/utils/api_demos/mainOcc.cpp
++++ gmsh-tetgen-2.12.0/utils/api_demos/mainOcc.cpp
 @@ -19,7 +19,7 @@
  #include "MElement.h"
  
@@ -23,15 +23,14 @@
  #endif
  #include <TopoDS_Shape.hxx>
  #include <BRep_Tool.hxx>
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/CMakeLists.txt
-===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/utils/api_demos/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/CMakeLists.txt
-@@ -12,46 +12,81 @@ endif(DEFINED CMAKE_BUILD_TYPE)
- project(api_demos CXX)
+Index: gmsh-tetgen-2.12.0/utils/api_demos/CMakeLists.txt
+===================================================================
+--- gmsh-tetgen-2.12.0.orig/utils/api_demos/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/utils/api_demos/CMakeLists.txt
+@@ -13,46 +13,81 @@ project(api_demos CXX)
  
  add_subdirectory(../.. "${CMAKE_CURRENT_BINARY_DIR}/gmsh")
--
+ 
 -include_directories(../../Common ../../Numeric ../../Geo ../../Mesh 
 -   ../../Solver ../../Post ../../Plugin ../../Graphics 
 -   ../../contrib/ANN/include ../../contrib/MathEx ../../contrib/kbipack
@@ -82,8 +81,6 @@
 -target_link_libraries(mainVertexArray shared)
 +target_link_libraries(mainVertexArray ${GMSH_EXTERNAL_LIBRARIES})
  
- add_executable(mainAntTweakBar mainAntTweakBar.cpp)
--target_link_libraries(mainAntTweakBar shared AntTweakBar ${glut})
 +FIND_PACKAGE(GLUT REQUIRED)
 +if ( ANTTWEAKBAR_FOUND AND GLUT_FOUND)
 +   INCLUDE_DIRECTORIES( ${ANTTWEAKBAR_INCLUDE_DIR} )
@@ -92,6 +89,8 @@
 +   add_executable(mainAntTweakBar mainAntTweakBar.cpp)
 +   target_link_libraries(mainAntTweakBar ${GMSH_EXTERNAL_LIBRARIES} ${ANTTWEAKBAR_LIBRARIES} ${GLUT_LIBRARY} -lX11)
 +endif()
+ #add_executable(mainAntTweakBar mainAntTweakBar.cpp)
+ #target_link_libraries(mainAntTweakBar shared AntTweakBar ${glut})
  
  add_executable(mainCartesian mainCartesian.cpp)
 -target_link_libraries(mainCartesian shared)
@@ -101,18 +100,18 @@
 -target_link_libraries(mainElasticity shared)
 +target_link_libraries(mainElasticity ${GMSH_EXTERNAL_LIBRARIES})
  
- add_executable(mainGlut mainGlut.cpp)
+-add_executable(mainGlut mainGlut.cpp)
 -target_link_libraries(mainGlut shared ${glut})
-+if ( GLUT_FOUND )
++if ( GLUT_FOUND)
 +   add_executable(mainGlut mainGlut.cpp)
 +   target_link_libraries(mainGlut  ${glut} ${GMSH_EXTERNAL_LIBRARIES} ${GLUT_LIBRARY} ${GLU_LIBRARY})
-+endif ( GLUT_FOUND )
++endif()
  
  add_executable(mainHomology mainHomology.cpp)
 -target_link_libraries(mainHomology shared)
 +target_link_libraries(mainHomology ${GMSH_EXTERNAL_LIBRARIES})
  
- add_executable(mainOcc mainOcc.cpp)
+-add_executable(mainOcc mainOcc.cpp)
 -target_link_libraries(mainOcc shared)
 +find_package(OCC)
 +if ( OCC_FOUND )
@@ -130,11 +129,13 @@
 +target_link_libraries(mainSimple ${GMSH_EXTERNAL_LIBRARIES})
  
  add_executable(mainGeoFactory mainGeoFactory.cpp)
- target_link_libraries(mainGeoFactory shared)
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainCartesian.cpp
-===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/utils/api_demos/mainCartesian.cpp
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainCartesian.cpp
+-target_link_libraries(mainGeoFactory shared)
++target_link_libraries(mainGeoFactory ${GMSH_EXTERNAL_LIBRARIES})
+ 
+Index: gmsh-tetgen-2.12.0/utils/api_demos/mainCartesian.cpp
+===================================================================
+--- gmsh-tetgen-2.12.0.orig/utils/api_demos/mainCartesian.cpp
++++ gmsh-tetgen-2.12.0/utils/api_demos/mainCartesian.cpp
 @@ -12,7 +12,7 @@
  #include "GmshMessage.h"
  #include "cartesian.h"
@@ -242,10 +243,10 @@
  
    Msg::Info("Removing cells outside the structure");
    removeOutsideCells(&box);
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainElasticity.cpp
-===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/utils/api_demos/mainElasticity.cpp
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainElasticity.cpp
+Index: gmsh-tetgen-2.12.0/utils/api_demos/mainElasticity.cpp
+===================================================================
+--- gmsh-tetgen-2.12.0.orig/utils/api_demos/mainElasticity.cpp
++++ gmsh-tetgen-2.12.0/utils/api_demos/mainElasticity.cpp
 @@ -3,6 +3,7 @@
  #include "elasticitySolver.h"
  #include "PView.h"
@@ -254,10 +255,10 @@
  
  void Info (int i, char* c){
    printf("%d %s\n",i,c);
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainHomology.cpp
-===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/utils/api_demos/mainHomology.cpp
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/mainHomology.cpp
+Index: gmsh-tetgen-2.12.0/utils/api_demos/mainHomology.cpp
+===================================================================
+--- gmsh-tetgen-2.12.0.orig/utils/api_demos/mainHomology.cpp
++++ gmsh-tetgen-2.12.0/utils/api_demos/mainHomology.cpp
 @@ -8,6 +8,7 @@
  
  #include <stdio.h>
@@ -266,10 +267,10 @@
  #include "Gmsh.h"
  #include "GModel.h"
  #include "MElement.h"
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindGmsh.cmake
+Index: gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindGmsh.cmake
 ===================================================================
 --- /dev/null
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindGmsh.cmake
++++ gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindGmsh.cmake
 @@ -0,0 +1,119 @@
 +# -*- mode: cmake -*-
 +#
@@ -390,10 +391,10 @@
 +
 +
 +
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindAnttweakbar.cmake
+Index: gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindAnttweakbar.cmake
 ===================================================================
 --- /dev/null
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindAnttweakbar.cmake
++++ gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindAnttweakbar.cmake
 @@ -0,0 +1,12 @@
 +FIND_LIBRARY(ANTTWEAKBAR_LIB AntTweakBar PATHS /usr/lib /opt/local/lib  $ENV{ANTTWEAKBAR_DIR}/lib)
 +SET(ANTTWEAKBAR_LIBRARIES ${ANTTWEAKBAR_LIB} )
@@ -407,10 +408,10 @@
 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ANTTWEAKBAR "Could not find ANTTWEAKBAR " ANTTWEAKBAR_INCLUDE_DIR ANTTWEAKBAR_LIB)
 +# show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view
 +MARK_AS_ADVANCED(ANTTWEAKBAR_INCLUDE_DIR ANTTWEAKBAR_LIBRARIES )
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindOCC.cmake
+Index: gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindOCC.cmake
 ===================================================================
 --- /dev/null
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindOCC.cmake
++++ gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindOCC.cmake
 @@ -0,0 +1,34 @@
 +set(OCC_LIBS_REQUIRED
 +    # subset of DataExchange
@@ -446,10 +447,10 @@
 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OCC "Could not find OCC " OCC_INCLUDE_DIR OCC_LIBRARIES)
 +# show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view
 +MARK_AS_ADVANCED(OCC_INCLUDE_DIR OCC_LIBRARIES )
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindGLUT.cmake
+Index: gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindGLUT.cmake
 ===================================================================
 --- /dev/null
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindGLUT.cmake
++++ gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindGLUT.cmake
 @@ -0,0 +1,20 @@
 +include (FindPackageHandleStandardArgs)
 +
@@ -471,10 +472,10 @@
 +# show the BERKELEY_DB_INCLUDE_DIR and BERKELEY_DB_LIBRARIES variables only in the advanced view
 +MARK_AS_ADVANCED(GLUT_LIBRARY )
 +MARK_AS_ADVANCED(GLU_LIBRARY )
-Index: gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindANN.cmake
+Index: gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindANN.cmake
 ===================================================================
 --- /dev/null
-+++ gmsh-tetgen-2.10.2~svn22060/utils/api_demos/cmake/modules/FindANN.cmake
++++ gmsh-tetgen-2.12.0/utils/api_demos/cmake/modules/FindANN.cmake
 @@ -0,0 +1,44 @@
 +# -*- mode: cmake -*-
 +#

Modified: packages/gmsh-tetgen/trunk/debian/patches/cgns.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/cgns.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/cgns.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/cgns.patch	Wed Apr 13 12:57:44 2016
@@ -3,10 +3,10 @@
 Reviewed-by: Anton Gladky <gladky.anton at gmail.com>
 Last-Update: 2013-04-02
 
-Index: gmsh-tetgen-2.8.5~svn19081/Geo/GModelIO_CGNS.cpp
+Index: gmsh-tetgen-2.12.0/Geo/GModelIO_CGNS.cpp
 ===================================================================
---- gmsh-tetgen-2.8.5~svn19081.orig/Geo/GModelIO_CGNS.cpp
-+++ gmsh-tetgen-2.8.5~svn19081/Geo/GModelIO_CGNS.cpp
+--- gmsh-tetgen-2.12.0.orig/Geo/GModelIO_CGNS.cpp
++++ gmsh-tetgen-2.12.0/Geo/GModelIO_CGNS.cpp
 @@ -155,24 +155,24 @@ class CGNSNameStr
  //    1D second-order elements
  //    MSH_NUM_TYPE+1 is used to place non-cgns elements last.
@@ -49,7 +49,7 @@
    {-1, MSH_NUM_TYPE+1},  // MSH_PYR_13
    {-1, MSH_NUM_TYPE+1},  // MSH_TRI_9
    {-1, MSH_NUM_TYPE+1},  // MSH_TRI_10
-@@ -587,9 +587,9 @@ int GModel::readCGNS(const std::string &
+@@ -945,9 +945,9 @@ int GModel::readCGNS(const std::string &
    for (int index_zone = 1; index_zone <= nZones; index_zone++) {
      Msg::Debug("Reading zone to compute MG level %i.", index_zone);
  
@@ -61,7 +61,7 @@
        Msg::Debug("Unstructured zone detected, skipping.");
        continue;
      }
-@@ -645,9 +645,9 @@ int GModel::readCGNS(const std::string &
+@@ -1005,9 +1005,9 @@ int GModel::readCGNS(const std::string &
  
      int offset = vnum;
  
@@ -73,7 +73,7 @@
        Msg::Debug("Unstructured zone detected, skipping.");
        continue;
      }
-@@ -681,7 +681,7 @@ int GModel::readCGNS(const std::string &
+@@ -1042,7 +1042,7 @@ int GModel::readCGNS(const std::string &
      int nCoords;
      cg_ncoords(index_file, index_base, index_zone, &nCoords);
  
@@ -82,37 +82,25 @@
      char coordName[35];
      void* coord;
      double nodes[nnodesZone][nCoords];
-@@ -696,7 +696,7 @@ int GModel::readCGNS(const std::string &
+@@ -1058,7 +1058,7 @@ int GModel::readCGNS(const std::string &
        Msg::Debug("Reading coordinate %i : %s.", iCoord+1, coordName);
- 
+       
        switch(dataType) {
--        case RealSingle:
-+        case CGNS_ENUMV(RealSingle):
- 	  Msg::Debug("        [Type is float]");
- 	  coord = new float[nnodesZone];
- 	  if ( cg_coord_read(index_file, index_base, index_zone, coordName, dataType, irmin, irmax, coord)) {
-@@ -709,7 +709,7 @@ int GModel::readCGNS(const std::string &
- 	  }
- 	  delete [] (float*)coord;
- 	  break;
--        case RealDouble:
-+        case CGNS_ENUMV(RealDouble):
- 	  Msg::Debug("        [Type is double]");
- 	  coord = new double[nnodesZone];
- 	  if ( cg_coord_read(index_file, index_base, index_zone, coordName, dataType, irmin, irmax, coord)) {
-@@ -1491,8 +1491,9 @@ struct ZoneTask
-   ZoneTask() : status(0), indexInOwner(0) { }
-   void change_status(const int _status)
-   {
--#pragma omp atomic
--    status = _status;
-+    status = 0;
-+    #pragma omp atomic
-+    status += _status;
-   }
- };
- 
-@@ -1583,7 +1584,7 @@ int write_CGNS_zones(GModel &model, cons
+-      case RealSingle:
++      case CGNS_ENUMV(RealSingle):
+         Msg::Debug("        [Type is float]");
+         coord = new float[nnodesZone];
+         if ( cg_coord_read(index_file, index_base, index_zone, 
+@@ -1072,7 +1072,7 @@ int GModel::readCGNS(const std::string &
+         }
+         delete [] (float*)coord;
+         break;
+-      case RealDouble:
++      case CGNS_ENUMV(RealDouble):
+         Msg::Debug("        [Type is double]");
+         coord = new double[nnodesZone];
+         if ( cg_coord_read(index_file, index_base, index_zone, 
+@@ -1988,7 +1988,7 @@ int write_CGNS_zones(GModel &model, cons
            cgZoneSize[2] = writeZone->numBoVert;  // Number of boundary vertices
            if(cg_zone_write(cgIndexFile, cgIndexBase,
                             writeTask->zoneName.c_str(), cgZoneSize,
@@ -121,7 +109,7 @@
            {
              return cgnsErr();
            }
-@@ -1610,7 +1611,7 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2015,7 +2015,7 @@ int write_CGNS_zones(GModel &model, cons
            for (int i = 0; i != cgZoneSize[0]; ++i) {
              dBuffer[i] = writeZone->zoneVertVec[i]->x()*scalingFactor;
            }
@@ -130,7 +118,7 @@
                              "CoordinateX", &dBuffer[0], &cgIndexCoord))
              return cgnsErr();
  
-@@ -1618,7 +1619,7 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2023,7 +2023,7 @@ int write_CGNS_zones(GModel &model, cons
            for(int i = 0; i != cgZoneSize[0]; ++i) {
              dBuffer[i] = writeZone->zoneVertVec[i]->y()*scalingFactor;
            }
@@ -139,7 +127,7 @@
                              "CoordinateY", &dBuffer[0], &cgIndexCoord))
              return cgnsErr();
  
-@@ -1627,7 +1628,7 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2032,7 +2032,7 @@ int write_CGNS_zones(GModel &model, cons
              for(int i = 0; i != cgZoneSize[0]; ++i) {
                dBuffer[i] = writeZone->zoneVertVec[i]->z()*scalingFactor;
              }
@@ -148,7 +136,7 @@
                                "CoordinateZ", &dBuffer[0], &cgIndexCoord))
                return cgnsErr();
            }
-@@ -1707,7 +1708,7 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2112,7 +2112,7 @@ int write_CGNS_zones(GModel &model, cons
                int cgIndexSection;
                if(cg_section_write
                   (cgIndexFile, cgIndexBase, cgIndexZone, elemName,
@@ -157,7 +145,7 @@
                    writeZone->zoneElemConn[typeMSHm1].numElem + iElemSection,
                    writeZone->zoneElemConn[typeMSHm1].numBoElem + iElemSection,
                    (cgsize_t*)&writeZone->zoneElemConn[typeMSHm1].connectivity[0],
-@@ -1747,9 +1748,9 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2152,9 +2152,9 @@ int write_CGNS_zones(GModel &model, cons
              // In the first zone
              if(cg_conn_write
                 (cgIndexFile, cgIndexBase, zoneInfo[gCIt->first.zone1].cgIndex,
@@ -169,7 +157,7 @@
                  &cgIndexInterface))
              {
                return cgnsErr();
-@@ -1757,9 +1758,9 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2162,9 +2162,9 @@ int write_CGNS_zones(GModel &model, cons
              // In the second zone
              if(cg_conn_write
                 (cgIndexFile, cgIndexBase, zoneInfo[gCIt->first.zone2].cgIndex,
@@ -181,7 +169,7 @@
                  &cgIndexInterface))
              {
                return cgnsErr();
-@@ -1879,7 +1880,7 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2284,7 +2284,7 @@ int write_CGNS_zones(GModel &model, cons
                }
                if(cg_boco_write(cgIndexFile, cgIndexBase,
                                 zoneInfo[zoneIndex].cgIndex, patchName.c_str(),
@@ -190,7 +178,7 @@
                                 &cgIndexBoco))
                {
                  return cgnsErr();
-@@ -1889,7 +1890,7 @@ int write_CGNS_zones(GModel &model, cons
+@@ -2294,7 +2294,7 @@ int write_CGNS_zones(GModel &model, cons
                  int normalIndex;
                  if(cg_boco_normal_write(cgIndexFile, cgIndexBase,
                                          zoneInfo[zoneIndex].cgIndex, cgIndexBoco,
@@ -199,10 +187,10 @@
                  {
                    return cgnsErr();
                  }
-Index: gmsh-tetgen-2.8.5~svn19081/Geo/CustomContainer.h
+Index: gmsh-tetgen-2.12.0/Geo/CustomContainer.h
 ===================================================================
---- gmsh-tetgen-2.8.5~svn19081.orig/Geo/CustomContainer.h
-+++ gmsh-tetgen-2.8.5~svn19081/Geo/CustomContainer.h
+--- gmsh-tetgen-2.12.0.orig/Geo/CustomContainer.h
++++ gmsh-tetgen-2.12.0/Geo/CustomContainer.h
 @@ -570,7 +570,7 @@ class FaceVector : public FaceAllocator<
    }
    

Modified: packages/gmsh-tetgen/trunk/debian/patches/change_shared_library_name.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/change_shared_library_name.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/change_shared_library_name.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/change_shared_library_name.patch	Wed Apr 13 12:57:44 2016
@@ -2,10 +2,10 @@
 Author: Anton Gladky <gladky.anton at gmail.com>
 Last-Update: 2012-11-28
 
-Index: gmsh-tetgen-2.10.2~svn22060/wrappers/java/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/wrappers/java/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/wrappers/java/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/wrappers/java/CMakeLists.txt
+--- gmsh-tetgen-2.12.0.orig/wrappers/java/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/wrappers/java/CMakeLists.txt
 @@ -34,7 +34,11 @@ if(WIN32)
    set_target_properties(WrapGmsh PROPERTIES PREFIX "")
  endif(WIN32)
@@ -19,11 +19,11 @@
  endif(UNIX)		
  add_custom_command(TARGET WrapGmsh 
  POST_BUILD # do the rest of the command after the build period
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -1437,7 +1437,7 @@ endforeach(DIR)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1442,7 +1442,7 @@ endforeach(DIR)
  # static library target
  if(ENABLE_BUILD_LIB)
    add_library(lib STATIC ${GMSH_SRC})
@@ -32,7 +32,7 @@
    if(MSVC)
      set_target_properties(lib PROPERTIES DEBUG_POSTFIX d)
      if(ENABLE_MSVC_STATIC_RUNTIME)
-@@ -1464,7 +1464,7 @@ endif(ENABLE_BUILD_ANDROID)
+@@ -1469,7 +1469,7 @@ endif(ENABLE_BUILD_ANDROID)
  if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC OR
     ENABLE_WRAP_PYTHON OR ENABLE_WRAP_JAVA)
    add_library(shared SHARED ${GMSH_SRC})

Modified: packages/gmsh-tetgen/trunk/debian/patches/clang.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/clang.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/clang.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/clang.patch	Wed Apr 13 12:57:44 2016
@@ -1,8 +1,8 @@
-Index: CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/CMakeLists.txt	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/CMakeLists.txt	(working copy)
-@@ -720,13 +720,15 @@
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -710,13 +710,15 @@ endif(ENABLE_MATHEX)
  if(ENABLE_MPI)
    find_package(MPI)
    if(MPI_FOUND)

Modified: packages/gmsh-tetgen/trunk/debian/patches/delete_gl2ps_from_source.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/delete_gl2ps_from_source.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/delete_gl2ps_from_source.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/delete_gl2ps_from_source.patch	Wed Apr 13 12:57:44 2016
@@ -2,10 +2,10 @@
 Author: Anton Gladky <gladky.anton at gmail.com>, Julian Taylor <jtaylor.debian at googlemail.com>
 Last-Update: 2011-12-09
 
-Index: gmsh-tetgen-2.10.2~svn22060/Graphics/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/Graphics/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/Graphics/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/Graphics/CMakeLists.txt
+--- gmsh-tetgen-2.12.0.orig/Graphics/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/Graphics/CMakeLists.txt
 @@ -15,7 +15,6 @@ set(SRC
    drawScales.cpp 
    drawGraph2d.cpp 
@@ -14,11 +14,11 @@
    gl2gif.cpp
    gl2jpeg.cpp
    gl2png.cpp
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -1498,7 +1498,7 @@ else(HAVE_FLTK)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1503,7 +1503,7 @@ else(HAVE_FLTK)
      add_executable(gmsh Common/Main.cpp ${GMSH_SRC})
    endif(ENABLE_BUILD_DYNAMIC)
  endif(HAVE_FLTK)

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix-cmake-hdf5.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix-cmake-hdf5.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix-cmake-hdf5.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix-cmake-hdf5.patch	Wed Apr 13 12:57:44 2016
@@ -2,11 +2,11 @@
 Author: Gilles Filippini <pini at debian.org>
 Last-Update: 2014-07-25
 
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -876,8 +876,10 @@ if(ENABLE_FOURIER_MODEL)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -828,8 +828,10 @@ if(ENABLE_FOURIER_MODEL)
  endif(ENABLE_FOURIER_MODEL)
  
  if(ENABLE_MED OR ENABLE_CGNS)
@@ -19,7 +19,7 @@
      if(ENABLE_MED)
        find_library(MED_LIB med)
        if(MED_LIB)
-@@ -912,9 +914,9 @@ if(ENABLE_MED OR ENABLE_CGNS)
+@@ -864,9 +866,9 @@ if(ENABLE_MED OR ENABLE_CGNS)
          endif(ZLIB_FOUND)
        endif(NOT HAVE_LIBZ)
      endif(MED_LIB OR CGNS_LIB)

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix-cmake.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix-cmake.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix-cmake.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix-cmake.patch	Wed Apr 13 12:57:44 2016
@@ -23,11 +23,11 @@
 Reviewed-By: <name and email of someone who approved the patch>
 Last-Update: <YYYY-MM-DD>
 
-Index: gmsh-tetgen-2.11.0/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.11.0.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.11.0/CMakeLists.txt
-@@ -1255,11 +1255,11 @@ if(HAVE_PYTHON)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1244,11 +1244,11 @@ if(HAVE_PYTHON)
    endif(ENABLE_NUMPY)
    if(HAVE_PETSC)
      if(ENABLE_PETSC4PY)
@@ -43,7 +43,7 @@
          OUTPUT_STRIP_TRAILING_WHITESPACE
        )
        if(PETSC4PY_INC)
-@@ -1320,7 +1320,7 @@ endif(WIN32 OR CYGWIN)
+@@ -1309,7 +1309,7 @@ endif(WIN32 OR CYGWIN)
  
  # force full warnings to encourage everybody to write clean(er) code
  check_cxx_compiler_flag("-Wall" WALL)

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix-common-os-cpp.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix-common-os-cpp.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix-common-os-cpp.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix-common-os-cpp.patch	Wed Apr 13 12:57:44 2016
@@ -1,8 +1,8 @@
-Index: Common/OS.cpp
+Index: gmsh-tetgen-2.12.0/Common/OS.cpp
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/Common/OS.cpp	(revision 22026)
-+++ gmsh-tetgen-2.9.4~svn21703/Common/OS.cpp	(working copy)
-@@ -405,7 +405,8 @@
+--- gmsh-tetgen-2.12.0.orig/Common/OS.cpp
++++ gmsh-tetgen-2.12.0/Common/OS.cpp
+@@ -405,7 +405,8 @@ std::string GetExecutableFileName()
    }
  #elif defined(__linux__)
    char path[4096];

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix_FTBFS_linking.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix_FTBFS_linking.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix_FTBFS_linking.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix_FTBFS_linking.patch	Wed Apr 13 12:57:44 2016
@@ -2,11 +2,11 @@
 Author: Anton Gladky <gladky.anton at gmail.com>
 Last-Update: 2012-04-08
 
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -1475,7 +1475,7 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_D
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1480,7 +1480,7 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_D
      message(STATUS "Note: By enabling ENABLE_MSVC_STATIC_RUNTIME, shared library "
              "won't link. In MSVC change /MT to /MD in the shared project properties")
    endif(MSVC AND ENABLE_MSVC_STATIC_RUNTIME)

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix_gmshpy_import.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix_gmshpy_import.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix_gmshpy_import.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix_gmshpy_import.patch	Wed Apr 13 12:57:44 2016
@@ -3,10 +3,10 @@
 Bug-Debian: http://bugs.debian.org/696420
 Last-Update: 2013-01-26
 
-Index: gmsh-tetgen-2.8.5~svn19081/wrappers/gmshpy/__init__.py.in
+Index: gmsh-tetgen-2.12.0/wrappers/gmshpy/__init__.py.in
 ===================================================================
---- gmsh-tetgen-2.8.5~svn19081.orig/wrappers/gmshpy/__init__.py.in
-+++ gmsh-tetgen-2.8.5~svn19081/wrappers/gmshpy/__init__.py.in
+--- gmsh-tetgen-2.12.0.orig/wrappers/gmshpy/__init__.py.in
++++ gmsh-tetgen-2.12.0/wrappers/gmshpy/__init__.py.in
 @@ -1,4 +1,7 @@
  # set Ctrl-C to default signal (terminates immediately)
 +from ctypes import *

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix_libdir.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix_libdir.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix_libdir.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix_libdir.patch	Wed Apr 13 12:57:44 2016
@@ -2,10 +2,10 @@
 Author: Anton Gladky <gladk at debian.org>
 Last-Update: 2013-03-15
 
-Index: gmsh-tetgen-2.10.2~svn22060/wrappers/java/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/wrappers/java/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/wrappers/java/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/wrappers/java/CMakeLists.txt
+--- gmsh-tetgen-2.12.0.orig/wrappers/java/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/wrappers/java/CMakeLists.txt
 @@ -73,6 +73,6 @@ POST_BUILD # do the rest of the command
    COMMAND ${CMAKE_COMMAND} -E copy 
      ${CMAKE_CURRENT_SOURCE_DIR}/WrappingJava/build.xml 
@@ -15,11 +15,11 @@
  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/WrappingJava/WrapGmsh.jar 
 -        DESTINATION lib)
 +  DESTINATION ${INSTALL_LIB_DIR})
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -1620,7 +1620,7 @@ endif(WIN32 OR CYGWIN)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1624,7 +1624,7 @@ endif(WIN32 OR CYGWIN)
  # (e.g. "make lib" or "make shared" followed by "make install/fast")
  install(TARGETS gmsh DESTINATION ${GMSH_BIN} OPTIONAL)
  if(ENABLE_BUILD_LIB)
@@ -28,7 +28,7 @@
  endif(ENABLE_BUILD_LIB)
  if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC)
    if(WIN32 AND NOT MSVC OR CYGWIN)
-@@ -1656,7 +1656,7 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_D
+@@ -1660,7 +1660,7 @@ if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_D
        install(FILES ${GCC_DLL} ${STDC_DLL} DESTINATION ${GMSH_LIB})
      endif(GCC_DLL AND STDC_DLL)
    else(WIN32 AND NOT MSVC OR CYGWIN)

Modified: packages/gmsh-tetgen/trunk/debian/patches/fix_script_header.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/fix_script_header.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/fix_script_header.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/fix_script_header.patch	Wed Apr 13 12:57:44 2016
@@ -2,12 +2,12 @@
 Author: Anton Gladky <gladk at debian.org>
 Last-Update: 2013-05-12
 
-Index: gmsh-tetgen-2.8.5~svn19081/contrib/onelab/python/onelab.py
+Index: gmsh-tetgen-2.12.0/contrib/onelab/python/onelab.py
 ===================================================================
---- gmsh-tetgen-2.8.5~svn19081.orig/contrib/onelab/python/onelab.py
-+++ gmsh-tetgen-2.8.5~svn19081/contrib/onelab/python/onelab.py
+--- gmsh-tetgen-2.12.0.orig/contrib/onelab/python/onelab.py
++++ gmsh-tetgen-2.12.0/contrib/onelab/python/onelab.py
 @@ -1,3 +1,4 @@
 +#!/usr/bin/env python
  """
- OneLab - Copyright (C) 2011-2014 ULg-UCL
+ OneLab - Copyright (C) 2011-2016 ULg-UCL
  

Modified: packages/gmsh-tetgen/trunk/debian/patches/med.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/med.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/med.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/med.patch	Wed Apr 13 12:57:44 2016
@@ -2,21 +2,21 @@
 ===================================================================
 --- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
 +++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -885,6 +885,10 @@ if(ENABLE_MED OR ENABLE_CGNS)
+@@ -836,6 +836,10 @@
+         set_config_option(HAVE_MED "Med")
          list(APPEND EXTERNAL_LIBRARIES ${MED_LIB})
        endif(MED_LIB)
-     endif(ENABLE_MED)
 +      find_library(MEDC_LIB medC)
 +      if(MEDC_LIB)
 +        list(APPEND EXTERNAL_LIBRARIES ${MEDC_LIB})
 +      endif(MEDC_LIB)
+     endif(ENABLE_MED)
      if(ENABLE_CGNS)
        find_library(CGNS_LIB cgns PATHS ENV CGNS_ROOT PATH_SUFFIXES lib)
-       find_path(CGNS_INC "cgnslib.h" PATHS ENV CGNS_ROOT PATH_SUFFIXES include)
-@@ -1887,7 +1891,7 @@ message(STATUS "")
+@@ -1861,7 +1865,7 @@
  mark_as_advanced(GMSH_EXTRA_VERSION
                   ACIS_LIB ANN_INC ANN_LIB CAIRO_LIB CAIRO_INC CGNS_INC GMM_INC
-                  GMP_INC GMP_LIB MMG3D_INC MMG3D_LIB TAUCS_INC TAUCS_LIB HDF5_LIB
+                  GMP_INC GMP_LIB MMG3D_INC MMG3D_LIB HDF5_LIB
 -                 MED_LIB OCC_INC OCC_CONFIG_H SZ_LIB
 +                 MED_LIB MEDC_LIB OCC_INC OCC_CONFIG_H SZ_LIB
                   PETSC_LIBS SLEPC_INC SLEPC_INC2 SLEPC_LIB

Modified: packages/gmsh-tetgen/trunk/debian/patches/metis-errormsg.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/metis-errormsg.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/metis-errormsg.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/metis-errormsg.patch	Wed Apr 13 12:57:44 2016
@@ -1,7 +1,7 @@
-Index: gmsh-tetgen-2.11.0/contrib/Metis/coarsen.c
+Index: gmsh-tetgen-2.12.0/contrib/Metis/coarsen.c
 ===================================================================
---- gmsh-tetgen-2.11.0.orig/contrib/Metis/coarsen.c
-+++ gmsh-tetgen-2.11.0/contrib/Metis/coarsen.c
+--- gmsh-tetgen-2.12.0.orig/contrib/Metis/coarsen.c
++++ gmsh-tetgen-2.12.0/contrib/Metis/coarsen.c
 @@ -60,7 +60,7 @@ GraphType *Coarsen2Way(CtrlType *ctrl, G
            Match_SHEM(ctrl, cgraph);
            break;
@@ -11,10 +11,10 @@
        }
      }
      else {
-Index: gmsh-tetgen-2.11.0/contrib/Metis/mcoarsen.c
+Index: gmsh-tetgen-2.12.0/contrib/Metis/mcoarsen.c
 ===================================================================
---- gmsh-tetgen-2.11.0.orig/contrib/Metis/mcoarsen.c
-+++ gmsh-tetgen-2.11.0/contrib/Metis/mcoarsen.c
+--- gmsh-tetgen-2.12.0.orig/contrib/Metis/mcoarsen.c
++++ gmsh-tetgen-2.12.0/contrib/Metis/mcoarsen.c
 @@ -67,7 +67,7 @@ GraphType *MCCoarsen2Way(CtrlType *ctrl,
          MCMatch_SBHEM(ctrl, cgraph, -1);
          break;

Modified: packages/gmsh-tetgen/trunk/debian/patches/mmg3d4.0.2.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/mmg3d4.0.2.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/mmg3d4.0.2.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/mmg3d4.0.2.patch	Wed Apr 13 12:57:44 2016
@@ -1,8 +1,8 @@
-Index: contrib/mmg3d/build/sources/analar.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/analar.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/analar.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/analar.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/analar.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/analar.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -37,7 +37,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -48,7 +47,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -57,7 +56,7 @@
  ****************************************************************************/
  
  
-@@ -54,11 +54,11 @@
+@@ -54,11 +54,11 @@ 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;
@@ -72,7 +71,7 @@
  
    for (i=0; i<6; i++) {
      dma[i] = ma[i];
-@@ -70,12 +70,12 @@
+@@ -70,52 +70,52 @@ int MMG_interp_ani(double *ma,double *mb
    }
    for (i=0; i<6; i++)
      mi[i] = (1.0-t)*mai[i] + t*mbi[i];
@@ -88,7 +87,6 @@
    for (i=0; i<6; i++)  mp[i] = mai[i];
  
    return(1);
-@@ -82,40 +82,40 @@
  }
  
  int MMG_interplog(double *ma,double *mb,double *mp,double *mplog,double t) {
@@ -125,8 +123,7 @@
 -    }                     
 +    puts("pbs eigen interp");
 +    return(0);
-   }
--  
++  }
 +  for (i=0; i<3; i++) lambda[i] = exp(lambda[i]);
 +  kk = 0;
 +  for (ii=0; ii<3; ii++) {
@@ -136,7 +133,8 @@
 +	lambda[2]*v[2][ii]*v[2][jj];
 +      kk = kk+1;
 +    }
-+  }
+   }
+-  
 +
    /*if ( !MMG_invmat(mi,mai) ) {
      fprintf(stderr,"  ## INTERP INVALID METRIC.\n");
@@ -150,7 +148,7 @@
    for (i=0; i<6; i++)  mp[i] = mai[i];
  
    return(1);
-@@ -126,19 +126,19 @@
+@@ -126,36 +126,36 @@ int MMG_interp_iso(double *ma,double *mb
    return(1);
  }
  //#define LLONG 1.1
@@ -179,7 +177,6 @@
    /* for Delaunay cavity */
    if ( !MMG_zaldy4(&list.hedg,3*LONMAX) ) {
      fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM.\n");
-@@ -145,17 +145,17 @@
      return(0);
    }
  
@@ -208,7 +205,7 @@
  
    npp = 0;
    nad = 0;
-@@ -167,14 +167,17 @@
+@@ -167,14 +167,17 @@ MMG_bouffe = 0;
    base  = ++mesh->flag;
  
    declic = 1.5/ALPHAD;// 60.*LLONG;
@@ -230,7 +227,7 @@
      /* mark internal edges */
      tabar  = 0;
      tagedg = 0;
-@@ -189,152 +192,152 @@
+@@ -189,152 +192,152 @@ MMG_bouffe = 0;
        ref    = mesh->tetra[adj].ref;
        tag    = mesh->tetra[adj].flag;
        if ( !adj || pt->ref != ref ) {
@@ -284,7 +281,7 @@
 -          npp++;
 -        
 -          siz=0.5;
- 
+-
 -          /* metric interpolation */
 -          if ( sol->offset==1 ) {   
 -            if(!MMG_interp(ma,mb,mp,siz) ) continue;
@@ -363,12 +360,7 @@
 -          }
 -    	    break;
 -        }
-+      /* edge length */
-+      ia  = MMG_iare[i][0];
-+      ib  = MMG_iare[i][1];
-+      ipa = pt->v[ia];
-+      ipb = pt->v[ib];
- 
+-
 -        else if ( len < LSHORT ) {
 -          npp++;
 -    	    pa = &mesh->point[ipa];
@@ -386,6 +378,13 @@
 -    	      break;
 -    	    } 
 -        } 
++
++      /* edge length */
++      ia  = MMG_iare[i][0];
++      ib  = MMG_iare[i][1];
++      ipa = pt->v[ia];
++      ipb = pt->v[ib];
++
 +      ca  = &mesh->point[ipa].c[0];
 +      cb  = &mesh->point[ipb].c[0];
 +
@@ -479,8 +478,7 @@
 +	  }
 +	}
 +	break;
-       }
--      if ( *alert == 1 )  break;
++      }
 +
 +      else if ( len < LSHORT ) {
 +	npp++;
@@ -498,7 +496,8 @@
 +	  ndd++;
 +	  break;
 +	}
-+      }
+       }
+-      if ( *alert == 1 )  break;
      }
 +    if ( *alert == 1 )  break;
 +  }
@@ -511,7 +510,7 @@
      printf("analyzed %d \n",npp);
      printf("rejected colpoi : cal %d  , len %d , topo %d , ex %d\n",MMG_ncal,MMG_nlen,MMG_ntopo,MMG_nex);
      MMG_npdtot+=npd;
-@@ -348,10 +351,8 @@
+@@ -348,10 +351,8 @@ MMG_bouffe = 0;
  
    if ( *alert == 1 ) {
      fprintf(stdout,"  ## UNABLE TO CREATE NEW ELEMENT %d , %d\n",
@@ -523,11 +522,11 @@
  }
 -
 -
-Index: contrib/mmg3d/build/sources/analarcutting.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/analarcutting.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/analarcutting.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/analarcutting.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/analarcutting.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/analarcutting.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -562,7 +561,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -573,7 +571,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,84 +41,84 @@
+@@ -41,84 +41,84 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -728,7 +726,7 @@
    double    *ca,*cb,*ma,*mb,*mip,mp[6],*mipold,mplog[6],c[3];
    //double    *malog,*mblog;
    int       iadr,ip;
-@@ -129,35 +129,35 @@
+@@ -129,63 +129,63 @@ int MMG_createPoint(pMesh mesh, pSol sol
    iadr = (ipa-1)*sol->offset + 1;
    ma  = &sol->met[iadr];
    iadr = (ipb-1)*sol->offset + 1;
@@ -743,10 +741,10 @@
 -  ip = MMG_newPt(mesh,c);  
 +  c[1] = 0.5*(ca[1] + cb[1]);
 +  c[2] = 0.5*(ca[2] + cb[2]);
- 
++
 +
 +  ip = MMG_newPt(mesh,c);
-+
+ 
    /* metric interpolation */
 -  if ( sol->offset==1 ) {   
 +  if ( sol->offset==1 ) {
@@ -778,7 +776,6 @@
  }
  
  extern int ddebug;
-@@ -164,28 +164,28 @@
  int MMG_analarcutting(pMesh mesh,pSol sol,pHedge hash,int *alert,double* lmoy,double LLLONG) {
    pTetra    pt;
    int       k,i,ia,ib,ip,ipa,ipb,iadr,na,ncut;
@@ -818,7 +815,7 @@
      for (i=0; i<6; i++) {
        ia  = MMG_iare[i][0];
        ib  = MMG_iare[i][1];
-@@ -194,127 +194,121 @@
+@@ -194,127 +194,121 @@ int MMG_analarcutting(pMesh mesh,pSol so
        /* already cutted ? */
        nb[i] = MMG_edgePoint(hash,ipa,ipb);
        if ( nb[i] ) {
@@ -1044,11 +1041,11 @@
 -
 -
 -
-Index: contrib/mmg3d/build/sources/baryct.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/baryct.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/baryct.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/baryct.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/baryct.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/baryct.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -1083,7 +1080,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -1094,7 +1090,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -1103,7 +1099,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -49,11 +49,11 @@
+@@ -49,11 +49,11 @@ along with MMG3D. If not, see <http://ww
  #define EPSR     1.e+14
  
  
@@ -1119,7 +1115,7 @@
  
    p0 = &mesh->point[pt->v[0]];
    p1 = &mesh->point[pt->v[1]];
-@@ -91,11 +91,11 @@
+@@ -91,11 +91,11 @@ int MMG_baryct(pMesh mesh,pTetra pt,doub
    vz  = bx*apy - by*apx;
    vol3 = dx*vx + dy*vy + dz*vz;
    if ( epsra > vol3 )  return(0);
@@ -1133,7 +1129,7 @@
    /* p in 1 */
    vol1 = -epsra * EPSR - vol2 - vol3 - vol4;
    if ( epsra > vol1 )  return(0);
-@@ -105,8 +105,7 @@
+@@ -105,8 +105,7 @@ int MMG_baryct(pMesh mesh,pTetra pt,doub
    cb[0] = vol1 * dd;
    cb[1] = vol2 * dd;
    cb[2] = vol3 * dd;
@@ -1143,11 +1139,11 @@
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/boulep.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/boulep.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/boulep.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/boulep.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/boulep.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/boulep.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -1182,7 +1178,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -1193,7 +1188,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,21 +41,21 @@
+@@ -41,21 +41,21 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -1225,7 +1220,7 @@
  
    if ( start < 1 )  return(0);
    pt   = &mesh->tetra[start];
-@@ -83,11 +83,11 @@
+@@ -83,11 +83,11 @@ int MMG_boulep(pMesh mesh,int start,int
      if ( adj ) {
        pt1 = &mesh->tetra[adj];
        if ( pt1->mark != base ) {
@@ -1242,7 +1237,7 @@
        }
      }
    }
-@@ -109,14 +109,14 @@
+@@ -109,14 +109,14 @@ int MMG_boulep(pMesh mesh,int start,int
        if ( pt->v[i] == nump )  continue;
        adj = vois[i];
        if ( adj ) {
@@ -1265,7 +1260,7 @@
        }
      }
      /* overflow */
-@@ -130,11 +130,11 @@
+@@ -130,11 +130,11 @@ int MMG_boulep(pMesh mesh,int start,int
  
  /* idem boulep for any vertex */
  int MMG_bouleg(pMesh mesh,int start,int ip,pList list) {
@@ -1282,7 +1277,7 @@
    if ( start < 1 )  return(0);
    pt   = &mesh->tetra[start];
    if ( !pt->v[0] )  return(0);
-@@ -163,9 +163,9 @@
+@@ -163,9 +163,9 @@ int MMG_bouleg(pMesh mesh,int start,int
        if ( pt1->mark != base ) {
  	pt1->mark = base;
  	for (j=0; j<4; j++)
@@ -1295,7 +1290,7 @@
        }
      }
    }
-@@ -187,14 +187,14 @@
+@@ -187,14 +187,14 @@ int MMG_bouleg(pMesh mesh,int start,int
        if ( pt->v[i] == nump )  continue;
        adj = vois[i];
        if ( adj ) {
@@ -1315,11 +1310,11 @@
        }
      }
      /* overflow */
-Index: contrib/mmg3d/build/sources/bucket.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/bucket.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/bucket.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/bucket.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/bucket.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/bucket.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -1354,7 +1349,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -1365,7 +1359,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,16 +41,16 @@
+@@ -41,16 +41,16 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -1388,7 +1382,7 @@
  
    /* memory alloc */
    bucket = (Bucket*)M_malloc(sizeof(Bucket),"newBucket");
-@@ -92,11 +92,11 @@
+@@ -92,11 +92,11 @@ void MMG_freeBucket(pBucket bucket) {
  
  /* check and eventually insert vertex */
  int MMG_buckin_ani(pMesh mesh,pSol sol,pBucket bucket,int ip) {
@@ -1405,7 +1399,7 @@
  
    ppt = &mesh->point[ip];
    siz = bucket->size;
-@@ -119,12 +119,12 @@
+@@ -119,12 +119,12 @@ int MMG_buckin_ani(pMesh mesh,pSol sol,p
      uy = pp1->c[1] - ppt->c[1];
      uz = pp1->c[2] - ppt->c[2];
      d2 =      ma[0]*ux*ux + ma[3]*uy*uy + ma[5]*uz*uz \
@@ -1420,7 +1414,7 @@
        if ( d2 < dmi )  return(0);
      }
  
-@@ -135,13 +135,13 @@
+@@ -135,21 +135,21 @@ int MMG_buckin_ani(pMesh mesh,pSol sol,p
        uy = pp1->c[1] - ppt->c[1];
        uz = pp1->c[2] - ppt->c[2];
        d2 =      ma[0]*ux*ux + ma[3]*uy*uy + ma[5]*uz*uz \
@@ -1440,7 +1434,6 @@
        }
      }
    }
-@@ -148,8 +148,8 @@
  
    /* bounding box */
    det = ma[0] * (ma[3]*ma[5] - ma[4]*ma[4]) \
@@ -1451,7 +1444,7 @@
    det = 1.0 / det;
    m1 = ma[3]*ma[5] - ma[4]*ma[4];
    m2 = ma[0]*ma[5] - ma[2]*ma[2];
-@@ -179,41 +179,41 @@
+@@ -179,41 +179,41 @@ int MMG_buckin_ani(pMesh mesh,pSol sol,p
  
    /* explore neighbours */
    for (k=kmin; k<=kmax; k++)
@@ -1474,6 +1467,23 @@
 -             + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 -          if ( d2 < dmi )  return(0);
 -        }
+-
+-        while ( bucket->link[ip1] ) {
+-          ip1 = bucket->link[ip1];
+-          pp1 = &mesh->point[ip1];
+-          ux = pp1->c[0] - ppt->c[0];
+-          uy = pp1->c[1] - ppt->c[1];
+-          uz = pp1->c[2] - ppt->c[2];
+-          d2 =      ma[0]*ux*ux + ma[3]*uy*uy + ma[5]*uz*uz \
+-             + 2.0*(ma[1]*ux*uy + ma[2]*ux*uz + ma[4]*uy*uz);
+-          if ( d2 < dmi ) {
+-            iadr = (ip1-1)*sol->offset + 1;
+-            mb = &sol->met[iadr];
+-            d2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
+-               + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
+-            if ( d2 < dmi )  return(0);
+-          }
+-        }
 +	icc = (k*siz + j)*siz + i;
 +	ip1 = bucket->head[icc];
 +	if ( !ip1 )  continue;
@@ -1490,23 +1500,7 @@
 +	    + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 +	  if ( d2 < dmi )  return(0);
 +	}
- 
--        while ( bucket->link[ip1] ) {
--          ip1 = bucket->link[ip1];
--          pp1 = &mesh->point[ip1];
--          ux = pp1->c[0] - ppt->c[0];
--          uy = pp1->c[1] - ppt->c[1];
--          uz = pp1->c[2] - ppt->c[2];
--          d2 =      ma[0]*ux*ux + ma[3]*uy*uy + ma[5]*uz*uz \
--             + 2.0*(ma[1]*ux*uy + ma[2]*ux*uz + ma[4]*uy*uz);
--          if ( d2 < dmi ) {
--            iadr = (ip1-1)*sol->offset + 1;
--            mb = &sol->met[iadr];
--            d2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
--               + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
--            if ( d2 < dmi )  return(0);
--          }
--        }
++
 +	while ( bucket->link[ip1] ) {
 +	  ip1 = bucket->link[ip1];
 +	  pp1 = &mesh->point[ip1];
@@ -1526,7 +1520,7 @@
        }
  
    return(1);
-@@ -221,10 +221,10 @@
+@@ -221,10 +221,10 @@ int MMG_buckin_ani(pMesh mesh,pSol sol,p
  
  
  int MMG_buckin_iso(pMesh mesh,pSol sol,pBucket bucket,int ip) {
@@ -1541,7 +1535,7 @@
  
    ppt = &mesh->point[ip];
    siz = bucket->size;
-@@ -247,7 +247,7 @@
+@@ -247,7 +247,7 @@ int MMG_buckin_iso(pMesh mesh,pSol sol,p
      uz = pp1->c[2] - ppt->c[2];
      d2 = ux*ux + uy*uy + uz*uz;
      if ( d2 < hp1 || d2 < hp2*hp2 )  {
@@ -1550,7 +1544,7 @@
        return(0);
      }
  
-@@ -260,8 +260,8 @@
+@@ -260,8 +260,8 @@ int MMG_buckin_iso(pMesh mesh,pSol sol,p
        uz = pp1->c[2] - ppt->c[2];
        d2 = ux*ux + uy*uy + uz*uz;
        if ( d2 < hp1 || d2 < hp2*hp2 )  {
@@ -1561,7 +1555,7 @@
        }
      }
    }
-@@ -283,36 +283,36 @@
+@@ -283,36 +283,36 @@ int MMG_buckin_iso(pMesh mesh,pSol sol,p
    if ( imin == imax && jmin == jmax && kmin == kmax )  return(1);
  
    for (k=kmin; k<=kmax; k++)
@@ -1623,7 +1617,7 @@
        }
  
    return(1);
-@@ -320,9 +320,9 @@
+@@ -320,9 +320,9 @@ int MMG_buckin_iso(pMesh mesh,pSol sol,p
  
  
  int MMG_addBucket(pMesh mesh,pBucket bucket,int ip) {
@@ -1636,7 +1630,7 @@
  
    ppt = &mesh->point[ip];
    siz = bucket->size;
-@@ -349,9 +349,9 @@
+@@ -349,9 +349,9 @@ int MMG_addBucket(pMesh mesh,pBucket buc
  
  
  int MMG_delBucket(pMesh mesh,pBucket bucket,int ip) {
@@ -1649,7 +1643,7 @@
  
    ppt = &mesh->point[ip];
    siz = bucket->size;
-@@ -371,11 +371,11 @@
+@@ -371,15 +371,14 @@ int MMG_delBucket(pMesh mesh,pBucket buc
      else {
        ip1 = bucket->head[ic];
        while ( ip1 && bucket->link[ip1] != ip ) {
@@ -1664,16 +1658,15 @@
        }
      }
    }
-@@ -382,4 +382,3 @@
  
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/cendel.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/cendel.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/cendel.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/cendel.c	(working copy)
-@@ -56,22 +56,22 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/cendel.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/cendel.c
+@@ -56,22 +56,22 @@ int MMG_cendel(pMesh mesh,pSol sol,doubl
    int		*adja,adj,iadr,ier,i,j,k,jel,lon,ns,np;
    int		vois[4],ref,tag;
    char		tabar,done;
@@ -1700,7 +1693,7 @@
      /* mark internal edges */
      tabar  = 0;
      iadr  = 4*(k-1) + 1;
-@@ -101,17 +101,23 @@
+@@ -101,24 +101,30 @@ int MMG_cendel(pMesh mesh,pSol sol,doubl
        if ( lon < 3 || lon > 7 )  continue;
  
        /* qual crit */
@@ -1728,7 +1721,6 @@
          break;
        }
        else if ( ier < 0 ) {
-@@ -118,7 +124,7 @@
          fprintf(stdout,"     %7d PROPOSED  %7d SWAPPED\n",np,ns);
          fprintf(stdout,"  ## UNABLE TO SWAP.\n");
          MMG_kiufree(queue);
@@ -1737,7 +1729,7 @@
        } 
      }
    }
-@@ -220,3 +226,93 @@
+@@ -220,3 +226,93 @@ int MMG_cendellong(pMesh mesh,pSol sol,d
    return(ns);
  }
  
@@ -1831,11 +1823,11 @@
 +  MMG_kiufree(queue);
 +  return(ns);
 +}
-Index: contrib/mmg3d/build/sources/cenrad.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/cenrad.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/cenrad.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/cenrad.c	(working copy)
-@@ -58,6 +58,7 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/cenrad.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/cenrad.c
+@@ -58,6 +58,7 @@ int MMG_cenrad_iso(pMesh mesh,double *ct
    ux = c4[0] - c1[0];
    uy = c4[1] - c1[1];
    uz = c4[2] - c1[2];
@@ -1843,7 +1835,7 @@
    dd = 1.0 / sqrt(ux*ux + uy*uy + uz*uz);
    n1[0] = ux*dd;
    n1[1] = uy*dd;
-@@ -70,6 +71,7 @@
+@@ -70,6 +71,7 @@ int MMG_cenrad_iso(pMesh mesh,double *ct
    ux = c4[0] - c2[0];
    uy = c4[1] - c2[1];
    uz = c4[2] - c2[2];
@@ -1851,7 +1843,7 @@
    dd = 1.0 / sqrt(ux*ux + uy*uy + uz*uz);
    n2[0] = ux*dd;
    n2[1] = uy*dd;
-@@ -80,6 +82,7 @@
+@@ -80,6 +82,7 @@ int MMG_cenrad_iso(pMesh mesh,double *ct
    ux = c4[0] - c3[0];
    uy = c4[1] - c3[1];
    uz = c4[2] - c3[2];
@@ -1859,7 +1851,7 @@
    dd = 1.0 / sqrt(ux*ux + uy*uy + uz*uz);
    n3[0] = ux*dd;
    n3[1] = uy*dd;
-@@ -93,6 +96,7 @@
+@@ -93,6 +96,7 @@ int MMG_cenrad_iso(pMesh mesh,double *ct
    uz = n1[1]*n2[2] - n1[2]*n2[1];
  
    dd = n1[0]*ux + n2[0]*uy + n3[0]*uz;
@@ -1867,7 +1859,7 @@
    dd = 0.5 / dd;
  
    cc1 = ux*pl1 + uy*pl2 + uz*pl3;
-@@ -111,7 +115,7 @@
+@@ -111,7 +115,7 @@ int MMG_cenrad_iso(pMesh mesh,double *ct
    *rad = (c[0] - c4[0]) * (c[0] - c4[0]) \
         + (c[1] - c4[1]) * (c[1] - c4[1]) \
         + (c[2] - c4[2]) * (c[2] - c4[2]);
@@ -1876,11 +1868,11 @@
    return(1);
  }
  
-Index: contrib/mmg3d/build/sources/chkmsh.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/chkmsh.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/chkmsh.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/chkmsh.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/chkmsh.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/chkmsh.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -1915,7 +1907,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -1926,7 +1917,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -1935,7 +1926,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -49,11 +49,11 @@
+@@ -49,11 +49,11 @@ along with MMG3D. If not, see <http://ww
  
  
  int MMG_chkmsh(pMesh mesh,int severe,int base) {
@@ -1952,7 +1943,7 @@
  
    for (k=1; k<=mesh->ne; k++) {
      pt1 = &mesh->tetra[k];
-@@ -67,7 +67,7 @@
+@@ -67,7 +67,7 @@ int MMG_chkmsh(pMesh mesh,int severe,int
        if ( !adj )  continue;
  
        if ( adj == k ) {
@@ -1961,7 +1952,7 @@
  	printf("k %d: %d %d %d %d\n",k,pt1->v[0],pt1->v[1],pt1->v[2],pt1->v[3]);
  	printf("adj (%d): %d %d %d %d\n",
  	       k,adja[0]/4,adja[1]/4,adja[2]/4,adja[3]/4);
-@@ -75,20 +75,20 @@
+@@ -75,59 +75,59 @@ int MMG_chkmsh(pMesh mesh,int severe,int
        }
        pt2 = &mesh->tetra[adj];
        if ( !pt2->v[0] ) {
@@ -1986,7 +1977,6 @@
  	printf("k %d: %d %d %d %d\n",k,pt1->v[0],pt1->v[1],pt1->v[2],pt1->v[3]);
  	printf("a %d: %d %d %d %d\n",
  	       adj,pt2->v[0],pt2->v[1],pt2->v[2],pt2->v[3]);
-@@ -95,39 +95,39 @@
  	printf("adj(%d): %d %d %d %d\n",
  	       k,adja[0]/4,adja[1]/4,adja[2]/4,adja[3]/4);
  	printf("adj(%d): %d %d %d %d\n",
@@ -2015,11 +2005,7 @@
 -      adj = adja[i] / 4;
 -      voy = adja[i] % 4;
 -      pt2 = &mesh->tetra[adj];
-+    if ( !adja[i] )  continue;
-+    adj = adja[i] / 4;
-+    voy = adja[i] % 4;
-+    pt2 = &mesh->tetra[adj];
- 
+-
 -      ppt = &mesh->point[ pt2->v[voy] ];
 -      dd = (ppt->c[0] - c[0]) * (ppt->c[0] - c[0]) \
 -         + (ppt->c[1] - c[1]) * (ppt->c[1] - c[1]) \
@@ -2028,6 +2014,11 @@
 -        fprintf(stdout,"  ## Non-Delaunay mesh:  %.14f < %.14f\n",dd,ray);
 -	exit(1);
 -      }
++    if ( !adja[i] )  continue;
++    adj = adja[i] / 4;
++    voy = adja[i] % 4;
++    pt2 = &mesh->tetra[adj];
++
 +    ppt = &mesh->point[ pt2->v[voy] ];
 +    dd = (ppt->c[0] - c[0]) * (ppt->c[0] - c[0]) \
 +    + (ppt->c[1] - c[1]) * (ppt->c[1] - c[1]) \
@@ -2046,7 +2037,7 @@
    if ( !severe )  return(1);
  
    for (k=1; k<=mesh->ne; k++) {
-@@ -145,13 +145,13 @@
+@@ -145,13 +145,13 @@ int MMG_chkmsh(pMesh mesh,int severe,int
        ip  = pt1->v[i];
        ppt = &mesh->point[ip];
        if ( ppt->tag & M_UNUSED ) {
@@ -2062,7 +2053,7 @@
  	nk  = list.tetra[l] % 4;
  	pt2 = &mesh->tetra[kk];
  	if ( pt2->v[nk] != ip ) {
-@@ -162,7 +162,7 @@
+@@ -162,7 +162,7 @@ int MMG_chkmsh(pMesh mesh,int severe,int
        if ( lon < 1 )  continue;
        len = 0;
        for (kk=1; kk<=mesh->ne; kk++) {
@@ -2071,7 +2062,7 @@
  	if ( !pt2->v[0] )  continue;
  	for (j=0; j<4; j++)
  	  if ( pt2->v[j] == ip ) {
-@@ -171,8 +171,8 @@
+@@ -171,8 +171,8 @@ int MMG_chkmsh(pMesh mesh,int severe,int
  	  }
        }
        if ( len != lon ) {
@@ -2082,11 +2073,11 @@
        }
      }
    }
-Index: contrib/mmg3d/build/sources/chrono.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/chrono.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/chrono.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/chrono.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/chrono.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/chrono.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -2121,7 +2112,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -2132,7 +2122,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,18 +41,18 @@
+@@ -41,18 +41,18 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -2162,7 +2152,7 @@
  
  #ifdef __cplusplus
  extern "C" {
-@@ -63,80 +63,79 @@
+@@ -63,80 +63,79 @@ extern "C" {
  #include "chrono.h"
  
  
@@ -2171,49 +2161,52 @@
 -  struct  tm  *ptm;
 -  double  tim;
 -  int     hh1,mm1,ss1,hh2,mm2,ss2;
+-
+-  ptm = localtime(&t1);
+-  hh1 = ptm->tm_hour;
+-  mm1 = ptm->tm_min;
+-  ss1 = ptm->tm_sec;
+-
+-  ptm = localtime(&t2);
+-  hh2 = ptm->tm_hour;
+-  mm2 = ptm->tm_min;
+-  ss2 = ptm->tm_sec;
+-  if ( hh2 < hh1 )  hh2 += 24;
+-  
+-  tim  = 3600.0*(hh2-hh1);
+-  tim += 60.0*(mm2-mm1);
+-  tim += ss2-ss1;
 +  /* return elapsed time in secs. */
 +  static double diftim(time_t t2,time_t t1) {
 +    struct  tm  *ptm;
 +    double  tim;
 +    int     hh1,mm1,ss1,hh2,mm2,ss2;
- 
--  ptm = localtime(&t1);
--  hh1 = ptm->tm_hour;
--  mm1 = ptm->tm_min;
--  ss1 = ptm->tm_sec;
++
 +    ptm = localtime(&t1);
 +    hh1 = ptm->tm_hour;
 +    mm1 = ptm->tm_min;
 +    ss1 = ptm->tm_sec;
- 
--  ptm = localtime(&t2);
--  hh2 = ptm->tm_hour;
--  mm2 = ptm->tm_min;
--  ss2 = ptm->tm_sec;
--  if ( hh2 < hh1 )  hh2 += 24;
--  
--  tim  = 3600.0*(hh2-hh1);
--  tim += 60.0*(mm2-mm1);
--  tim += ss2-ss1;
++
 +    ptm = localtime(&t2);
 +    hh2 = ptm->tm_hour;
 +    mm2 = ptm->tm_min;
 +    ss2 = ptm->tm_sec;
 +    if ( hh2 < hh1 )  hh2 += 24;
- 
--  return(tim);
--}
++
 +    tim  = 3600.0*(hh2-hh1);
 +    tim += 60.0*(mm2-mm1);
 +    tim += ss2-ss1;
  
+-  return(tim);
+-}
 +    return(tim);
 +  }
+ 
  
 -/* get system and user times in micro-seconds */
 -void  TIM_chrono(int cmode,TIM_mytime *ptt) {
 -  time_t tt;
- 
+-
 -  if ( cmode == RESET ) {
 -    ptt->dtim  = clock();
 -    ptt->ctim  = 0.0f;
@@ -2238,7 +2231,7 @@
 +      ptt->ctim  = 0.0f;
        ptt->ptim  = 0;
 +      ptt->call  = 0;
-     }
++    }
 +    else {
 +      ptt->dtim = difftime(clock(),ptt->dtim);  /* in secs */
 +      if ( cmode == ON ) {
@@ -2250,7 +2243,7 @@
 +	ptt->ctim += diftim(tt,ptt->ptim);
 +	ptt->ptim  = 0;
 +      }
-+    }
+     }
    }
 -}
  
@@ -2275,15 +2268,16 @@
 -/* initialize time table */
 -void  TIM_tminit(TIM_mytime *t,int maxtim) {
 -  int     k;
-+  /* initialize time table */
-+  void  TIM_tminit(TIM_mytime *t,int maxtim) {
-+    int     k;
- 
+-
 -  for (k=0; k<maxtim; k++) {
 -    t[k].dtim = clock();
 -    t[k].ptim = 0;
 -    t[k].ctim = 0.0;
 -    t[k].call = 0;
++  /* initialize time table */
++  void  TIM_tminit(TIM_mytime *t,int maxtim) {
++    int     k;
++
 +    for (k=0; k<maxtim; k++) {
 +      t[k].dtim = clock();
 +      t[k].ptim = 0;
@@ -2298,11 +2292,11 @@
  }
  #endif
 -
-Index: contrib/mmg3d/build/sources/chrono.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/chrono.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/chrono.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/chrono.h	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/chrono.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/chrono.h
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -2337,7 +2331,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -2348,7 +2341,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -2357,7 +2350,7 @@
  ****************************************************************************/
  #ifdef __cplusplus
  extern "C" {
-@@ -59,17 +59,17 @@
+@@ -59,17 +59,17 @@ extern "C" {
  #define  MAXCLK    ( 1073741823. / (double)CLOCKS_PER_SEC )
  
  
@@ -2384,11 +2377,11 @@
  
  
  #ifdef __cplusplus
-Index: contrib/mmg3d/build/sources/colpoi.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/colpoi.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/colpoi.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/colpoi.c	(working copy)
-@@ -76,7 +76,10 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/colpoi.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/colpoi.c
+@@ -76,7 +76,10 @@ int MMG_colpoi(pMesh mesh,pSol sol,int i
      kk   = list.tetra[l] >> 2;
      cal  = mesh->tetra[kk].qual;//(sol->offset==6) ? MMG_caltet_ani(mesh,sol,kk) : MMG_caltet_iso(mesh,sol,kk);
      if ( cal > crit )  crit = cal;
@@ -2400,7 +2393,7 @@
    crit *= coef; 
    //assert(crit < 1e20);
          
-@@ -148,7 +151,7 @@
+@@ -148,7 +151,7 @@ int MMG_colpoi(pMesh mesh,pSol sol,int i
        // if(cal < 1e-10) printf("(%e) long %d : %e\n",cal,i,MMG_length(ca,cb,ma,mb),crit/60.);
        if ( ppt->mark < base ) {
          len = MMG_length(ca,cb,ma,mb);   
@@ -2409,7 +2402,7 @@
            MMG_nlen++;
            memcpy(pb->c,coor,3*sizeof(double));
            memcpy(&sol->met[iadb],solu,sol->offset*sizeof(double));
-@@ -343,11 +346,18 @@
+@@ -343,11 +346,18 @@ int MMG_colpoi2(pMesh mesh,pSol sol,int
    crit = pt->qual;
    for (l=2; l<=lon; l++) {
      kk   = list.tetra[l] >> 2;
@@ -2429,7 +2422,7 @@
    /* change coords of pb */
    iada = (na-1)*sol->offset + 1;
    ma   = &sol->met[iada];
-@@ -421,7 +431,7 @@
+@@ -421,7 +431,7 @@ int MMG_colpoi2(pMesh mesh,pSol sol,int
        mb   = &sol->met[iadr];
         if ( ppt->mark < base ) {
          len = MMG_length(ca,cb,ma,mb);
@@ -2438,11 +2431,11 @@
  	        MMG_nlen++;
            memcpy(pb->c,coor,3*sizeof(double));
            memcpy(&sol->met[iadb],solu,sol->offset*sizeof(double));
-Index: contrib/mmg3d/build/sources/coquil.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/coquil.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/coquil.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/coquil.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/coquil.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/coquil.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -2477,7 +2470,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -2488,7 +2480,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,11 +41,11 @@
+@@ -41,11 +41,11 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -2502,7 +2494,7 @@
  int MMG_coquil(pMesh mesh,int iel,int ia,pList list) {
    pTetra      pt;
    int        *adja,i,iadr,adj,base,na,nb,ipa,ipb,piv,ilist,kref;
-@@ -55,8 +55,8 @@
+@@ -55,8 +55,8 @@ int MMG_coquil(pMesh mesh,int iel,int ia
    if ( !pt->v[0] )  return(0);
  
    base     = ++mesh->mark;
@@ -2513,7 +2505,7 @@
    ilist = 1;
    list->tetra[ilist] = 6*iel + ia;
  
-@@ -71,15 +71,15 @@
+@@ -71,15 +71,15 @@ int MMG_coquil(pMesh mesh,int iel,int ia
  
    while ( adj != iel ) {
      pt = &mesh->tetra[adj];
@@ -2533,7 +2525,7 @@
      }
      if(i==6) printf("tetra %d : %d %d %d %d -- %e\n",iel,pt->v[0],pt->v[1],pt->v[2],pt->v[3],pt->qual);
      assert(i<6);
-@@ -104,3 +104,118 @@
+@@ -104,3 +104,118 @@ int MMG_coquil(pMesh mesh,int iel,int ia
  
    return(ilist);
  }
@@ -2652,11 +2644,11 @@
 +  assert(!adj);
 +  return( 2*ilist+1 );
 +}
-Index: contrib/mmg3d/build/sources/cutelt.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/cutelt.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/cutelt.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/cutelt.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/cutelt.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/cutelt.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -2691,7 +2683,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -2702,7 +2693,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,504 +41,1063 @@
+@@ -41,504 +41,1063 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -2956,8 +2947,7 @@
 -	
 -	return(1);
 -}           
-+  pt->ref  = ref;
- 
+-
 -int MMG_cuthex(pMesh mesh,pHedge hed,int k,int p0,int p1,int p2,int p3,int p4,int p5,int p6,int p7, int ref) { 
 -	pTetra		pt;
 -	int				i,nu1,nu2;
@@ -2968,6 +2958,13 @@
 -  pt->v[1] = p1;
 -  pt->v[2] = p3;
 -  pt->v[3] = p7;
+   pt->ref  = ref;
+-	for(i=0 ; i<6 ; i++) {
+-		nu1 = pt->v[MMG_iare[i][0]];
+-		nu2 = pt->v[MMG_iare[i][1]];
+-		MMG_edgePut(hed,nu1,nu2,2);
+-	}
++
 +  return(1);
 +}
 +
@@ -3104,12 +3101,7 @@
 +  pt->v[1] = p[1];
 +  pt->v[2] = p[3];
 +  pt->v[3] = p[7];
-   pt->ref  = ref;
--	for(i=0 ; i<6 ; i++) {
--		nu1 = pt->v[MMG_iare[i][0]];
--		nu2 = pt->v[MMG_iare[i][1]];
--		MMG_edgePut(hed,nu1,nu2,2);
--	}
++  pt->ref  = ref;
 +  // for(i=0 ; i<6 ; i++) {
 +  //    nu1 = pt->v[MMG_iare[i][0]];
 +  //    nu2 = pt->v[MMG_iare[i][1]];
@@ -3264,6 +3256,11 @@
 -	if(ddebug) printf("k = %d : %d %d %d %d %d %d\n",k,p0,p1,p2,p3,p4,p5,p5);      
 -	
 -	icas = 0;
+-
+-	//find edge 2 : p1-p3 then edge 0 : 0 4
+-	if(!MMG_edgePoint(hed,p1,p3)) {
+-		if(MMG_edgePoint(hed,p0,p4))
+-			icas |= 1;
 +int MMG_checkcaseopp(pHexa ph,int nu1,int nu2,pHedge hed) {
 +  int i,nu3,nu4;
 +  unsigned char MMG_hied[8][3] = { {2,5,7}, {3,4,6}, {0,5,7}, {1,4,6}, {1,3,6}, {0,2,7}, {1,3,4}, {0,2,5} };
@@ -3277,11 +3274,7 @@
 +  if(i<3) return(1);
 +  else return(0);
 +}
- 
--	//find edge 2 : p1-p3 then edge 0 : 0 4
--	if(!MMG_edgePoint(hed,p1,p3)) {
--		if(MMG_edgePoint(hed,p0,p4))
--			icas |= 1;
++
 +int MMG_checkcase(pHexa ph,int nu1,int nu2,pHedge hed) {
 +  int i,nu3;
 +  unsigned char MMG_hied[8][3] = { {2,5,7}, {3,4,6}, {0,5,7}, {1,4,6}, {1,3,6}, {0,2,7}, {1,3,4}, {0,2,5} };
@@ -3355,8 +3348,7 @@
 +	icasopp = MMG_checkcaseopp(ph,nu1,nu2,hed);
 +	if(!icas0 && !icasopp) {
 +	  icas0 = 0;
- 	} else {
--		icas |= 4;
++	} else {
 +	  icas0 = MMG_checkcase(ph,nu2,nu1,hed);
 +	  icasopp = MMG_checkcaseopp(ph,nu2,nu1,hed);
 +	  if(icas0 || icasopp) {
@@ -3364,11 +3356,7 @@
 +	    continue;
 +	  }
 +	  icas0 = 1;
- 	}
--	//find edge 5 : p2-p4 then edge 3 : 1 5
--	if(!MMG_edgePoint(hed,p2,p4)) {
--		if(MMG_edgePoint(hed,p1,p5))
--			icas |= 8;
++	}
 +	if(icas0) {
 +	  //debug check
 +	  for(i=0;i<3;i++) {
@@ -3387,20 +3375,20 @@
 +	  }
 +	  MMG_decouphex(mesh,hed,netmp+6*(k-1),p,ph->ref);
  	} else {
--		icas |= 32;
+-		icas |= 4;
 +	  MMG_decouphex(mesh,hed,netmp+6*(k-1),ph->v,ph->ref);
  	}
--	//find edge 4 : p2-p3 then edge 1 : 0 5
--	if(!MMG_edgePoint(hed,p2,p3)) {
--		if(MMG_edgePoint(hed,p0,p5))
--		icas |= 2;
+-	//find edge 5 : p2-p4 then edge 3 : 1 5
+-	if(!MMG_edgePoint(hed,p2,p4)) {
+-		if(MMG_edgePoint(hed,p1,p5))
+-			icas |= 8;
 +      } else if (iface==4) {
 +	icas0 = MMG_checkcase(ph,nu2,nu1,hed);
 +	icasopp = MMG_checkcaseopp(ph,nu2,nu1,hed);
 +	if(!icas0 && !icasopp) {
 +	  icas0 = 0;
  	} else {
--		icas |= 16;
+-		icas |= 32;
 +	  icas0 = MMG_checkcase(ph,nu1,nu2,hed);
 +	  icasopp = MMG_checkcaseopp(ph,nu1,nu2,hed);
 +	  if(icas0 || icasopp) {
@@ -3408,6 +3396,26 @@
 +	    continue;
 +	  }
 +	  icas0 = 1;
+ 	}
+-	//find edge 4 : p2-p3 then edge 1 : 0 5
+-	if(!MMG_edgePoint(hed,p2,p3)) {
+-		if(MMG_edgePoint(hed,p0,p5))
+-		icas |= 2;
++	if(icas0) {
++	  //check debug
++	  for(i=0;i<3;i++) {
++	    nu3 = MMG_hied[nu1][i];
++	    if(nu3==nu2) continue;
++	    if(MMG_edgePoint(hed,ph->v[nu1],ph->v[nu3])) break;
++	  }
++	  assert(i==3);
++	  //printf("iface 4 on a trouve une autre arete---> renum\n");
++	  p[0] = ph->v[3]; p[1] = ph->v[0]; p[2] = ph->v[1]; p[3] = ph->v[2];
++	  p[4] = ph->v[7]; p[5] = ph->v[4]; p[6] = ph->v[5]; p[7] = ph->v[6];
++	  MMG_decouphex(mesh,hed,netmp+6*(k-1),p,ph->ref);
+ 	} else {
+-		icas |= 16;
++	  MMG_decouphex(mesh,hed,netmp+6*(k-1),ph->v,ph->ref);
  	}
 -	if(icas > 55) {
 -		fprintf(stdout,"grosgros bug %d\n",icas);
@@ -3643,21 +3651,6 @@
 -	return(1);
 -}
 \ No newline at end of file
-+	if(icas0) {
-+	  //check debug
-+	  for(i=0;i<3;i++) {
-+	    nu3 = MMG_hied[nu1][i];
-+	    if(nu3==nu2) continue;
-+	    if(MMG_edgePoint(hed,ph->v[nu1],ph->v[nu3])) break;
-+	  }
-+	  assert(i==3);
-+	  //printf("iface 4 on a trouve une autre arete---> renum\n");
-+	  p[0] = ph->v[3]; p[1] = ph->v[0]; p[2] = ph->v[1]; p[3] = ph->v[2];
-+	  p[4] = ph->v[7]; p[5] = ph->v[4]; p[6] = ph->v[5]; p[7] = ph->v[6];
-+	  MMG_decouphex(mesh,hed,netmp+6*(k-1),p,ph->ref);
-+	} else {
-+	  MMG_decouphex(mesh,hed,netmp+6*(k-1),ph->v,ph->ref);
-+	}
 +      } else {
 +	if(ddebug)  printf("il faut renum iface %d\n",iface);//iface 0,2,3
 +	icas0 = MMG_checkcase(ph,nu1,nu2,hed);
@@ -4216,11 +4209,11 @@
 +  }
 +  return(1);
 +}
-Index: contrib/mmg3d/build/sources/defines.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/defines.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/defines.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/defines.h	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/defines.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/defines.h
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -4255,7 +4248,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -4266,7 +4258,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -4275,7 +4267,7 @@
  ****************************************************************************/
  #define EPS      1.e-06
  #define EPS1     1.e-9
-@@ -49,7 +49,7 @@
+@@ -49,7 +49,7 @@ along with MMG3D. If not, see <http://ww
  #define EPSOK    1.e-18
  #define EPS30    1.e-30
  
@@ -4284,7 +4276,7 @@
  #define ALPHAD   0.04811252      /* 1.0/(12*sqrt(3)) */
  #define BETAC    0.03928371      /* sqrt(2)/36 */
  
-@@ -74,20 +74,12 @@
+@@ -74,20 +74,12 @@ along with MMG3D. If not, see <http://ww
  #define M_BDRY     (1 << 1)
  #define M_MOVE     (1 << 2)
  #define M_CAVITY   (1 << 3)
@@ -4309,11 +4301,11 @@
  extern unsigned char MMG_idir[4][3];
  extern unsigned char MMG_inxt[7];
  extern unsigned char MMG_iarf[4][3];
-Index: contrib/mmg3d/build/sources/delaunay.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/delaunay.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/delaunay.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/delaunay.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/delaunay.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/delaunay.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -4348,7 +4340,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -4359,7 +4350,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -4368,7 +4359,7 @@
  ****************************************************************************/
  #include "eigenv.h"
  #include "mesh.h"
-@@ -62,10 +62,10 @@
+@@ -62,10 +62,10 @@ int MMG_delone(pMesh mesh,pSol sol,int i
    int      *adja,*adjb,i,j,k,l,m,iel,jel,old,v[3],iadr,base,size;
    int       vois[4],ii,kk,iare1,iare2;
    short     i1;
@@ -4382,7 +4373,7 @@
    /* external faces */
    size = 0;
    for (k=1; k<=ilist; k++) {
-@@ -80,12 +80,12 @@
+@@ -80,12 +80,12 @@ int MMG_delone(pMesh mesh,pSol sol,int i
      for (i=0; i<4; i++) {
        jel = vois[i];
        if ( !jel || mesh->tetra[jel].mark != base ) {
@@ -4401,7 +4392,7 @@
        }
      }
    }
-@@ -94,9 +94,9 @@
+@@ -94,9 +94,9 @@ int MMG_delone(pMesh mesh,pSol sol,int i
    alert = 0;
    for (k=1; k<=ilist; k++) {
      old  = list->tetra[k];
@@ -4413,7 +4404,7 @@
        if ( !(ppt->tag & M_CAVITY) )  alert = 1;
      }
    }
-@@ -108,7 +108,7 @@
+@@ -108,7 +108,7 @@ int MMG_delone(pMesh mesh,pSol sol,int i
        ppt = &mesh->point[ pt1->v[i] ];
        ppt->tag &= ~M_CAVITY;
      }
@@ -4422,7 +4413,7 @@
    if ( alert )  return(-1);
    /* hash table params */
    if ( size > 3*LONMAX )  return(0);
-@@ -135,72 +135,72 @@
+@@ -135,72 +135,72 @@ int MMG_delone(pMesh mesh,pSol sol,int i
  
        /* external face */
        if ( !jel || (mesh->tetra[jel].mark != base) ) {
@@ -4470,6 +4461,18 @@
 -          adjb = &mesh->adja[iadr];
 -          adjb[j] = iel*4 + i;
 -    	  }
+-
+-        /* internal faces (p1,p2,ip) */
+-        for (j=0; j<4; j++) {
+-	        if ( j != i ) {
+-            m = 0;
+-	          for (l=0; l<3; l++)
+-              if ( pt1->v[ MMG_idir[j][l] ] != ip ) {
+-	              v[m] = pt1->v[ MMG_idir[j][l] ];
+-		            m++;
+-	            }
+-	          MMG_hashEdge(mesh,&list->hedg,iel,j,v);
+-	        }
 +	iel = MMG_newElt(mesh);
 +	if ( iel < 1 )  return(0);
 +	pt1 = &mesh->tetra[iel];
@@ -4514,18 +4517,7 @@
 +	  adjb = &mesh->adja[iadr];
 +	  adjb[j] = iel*4 + i;
 +	}
- 
--        /* internal faces (p1,p2,ip) */
--        for (j=0; j<4; j++) {
--	        if ( j != i ) {
--            m = 0;
--	          for (l=0; l<3; l++)
--              if ( pt1->v[ MMG_idir[j][l] ] != ip ) {
--	              v[m] = pt1->v[ MMG_idir[j][l] ];
--		            m++;
--	            }
--	          MMG_hashEdge(mesh,&list->hedg,iel,j,v);
--	        }
++
 +	/* internal faces (p1,p2,ip) */
 +	for (j=0; j<4; j++) {
 +	  if ( j != i ) {
@@ -4554,7 +4546,7 @@
      MMG_delElt(mesh,list->tetra[k]);
    }
  
-@@ -230,15 +230,15 @@
+@@ -230,15 +230,15 @@ int MMG_delons(pMesh mesh,pSol sol,pQueu
      iadr = (old-1)*4 + 1;
      adja = &mesh->adja[iadr];
      for (i=0; i<4; i++) {
@@ -4579,7 +4571,7 @@
      }
    }
  
-@@ -288,61 +288,61 @@
+@@ -288,61 +288,61 @@ int MMG_delons(pMesh mesh,pSol sol,pQueu
  
        /* external face */
        if ( !jel || mesh->tetra[jel].mark != base ) {
@@ -4625,6 +4617,18 @@
 -    	}
 -        if ( pt1->qual >= declic )
 -          MMG_kiuput(queue,iel);
+-
+-        /* internal faces (p1,p2,ip) */
+-        for (j=0; j<4; j++) {
+-	      if ( j != i ) {
+-            m = 0;
+-	        for (l=0; l<3; l++)
+-              if ( pt1->v[ MMG_idir[j][l] ] != ip ) {
+-	            v[m] = pt1->v[ MMG_idir[j][l] ];
+-		        m++;
+-	          }
+-	        MMG_hashEdge(mesh,&list->hedg,iel,j,v);
+-	      }
 +	iel = MMG_newElt(mesh);
 +	if ( iel < 1 )  return(0);
 +	pt1 = &mesh->tetra[iel];
@@ -4649,7 +4653,7 @@
 +	       || ((iare2==pt->v[MMG_iare[MMG_iarf[i][kk]][0]]) && (iare1==pt->v[MMG_iare[MMG_iarf[i][kk]][1]])) ) {
 +	      pt1->bdryinfo[MMG_iarf[i][kk]] = pt->bdryinfo[MMG_iarf[i][ii]];
 +	      break;
-+	    }
+ 	    }
 +	  }
 +	  assert(kk<3);
 +	}
@@ -4667,17 +4671,7 @@
 +	}
 +	if ( pt1->qual >= declic )
 +	  MMG_kiuput(queue,iel);
- 
--        /* internal faces (p1,p2,ip) */
--        for (j=0; j<4; j++) {
--	      if ( j != i ) {
--            m = 0;
--	        for (l=0; l<3; l++)
--              if ( pt1->v[ MMG_idir[j][l] ] != ip ) {
--	            v[m] = pt1->v[ MMG_idir[j][l] ];
--		        m++;
--	          }
--	        MMG_hashEdge(mesh,&list->hedg,iel,j,v);
++
 +	/* internal faces (p1,p2,ip) */
 +	for (j=0; j<4; j++) {
 +	  if ( j != i ) {
@@ -4686,15 +4680,14 @@
 +	      if ( pt1->v[ MMG_idir[j][l] ] != ip ) {
 +		v[m] = pt1->v[ MMG_idir[j][l] ];
 +		m++;
- 	      }
--	    }
++	      }
 +	    MMG_hashEdge(mesh,&list->hedg,iel,j,v);
 +	  }
 +	}
        }
      }
    }
-@@ -362,12 +362,12 @@
+@@ -362,12 +362,12 @@ int MMG_delons(pMesh mesh,pSol sol,pQueu
  
  /* cavity correction for quality */
  int MMG_correction_ani(pMesh mesh,pSol sol,int ip,pList list,int ilist,int nedep) {
@@ -4713,7 +4706,7 @@
  
    ppt  = &mesh->point[ip];
    if ( ppt->tag & M_UNUSED )  return(ilist);
-@@ -395,68 +395,68 @@
+@@ -395,68 +395,68 @@ int MMG_correction_ani(pMesh mesh,pSol s
        vois[3]  = adja[3] >> 2;
        pt   = &mesh->tetra[iel];
  
@@ -4723,38 +4716,23 @@
 -        adj = vois[i];
 -MMG_cas = 0;
 -        if ( adj && mesh->tetra[adj].mark == base)  continue;
-+	adj = vois[i];
-+	MMG_cas = 0;
-+	if ( adj && mesh->tetra[adj].mark == base)  continue;
- 
+-
 -        ib = pt->v[ MMG_idir[i][0] ];
 -        ic = pt->v[ MMG_idir[i][1] ];
 -        id = pt->v[ MMG_idir[i][2] ];
-+	ib = pt->v[ MMG_idir[i][0] ];
-+	ic = pt->v[ MMG_idir[i][1] ];
-+	id = pt->v[ MMG_idir[i][2] ];
- 
+-
 -        p1 = &mesh->point[ib];
 -        p2 = &mesh->point[ic];
 -        p3 = &mesh->point[id];
-+	p1 = &mesh->point[ib];
-+	p2 = &mesh->point[ic];
-+	p3 = &mesh->point[id];
- 
+-
 -        ux = p2->c[0] - p1->c[0];
 -        uy = p2->c[1] - p1->c[1];
 -        uz = p2->c[2] - p1->c[2];
-+	ux = p2->c[0] - p1->c[0];
-+	uy = p2->c[1] - p1->c[1];
-+	uz = p2->c[2] - p1->c[2];
- 
+-
 -        vx = p3->c[0] - p1->c[0];
 -        vy = p3->c[1] - p1->c[1];
 -        vz = p3->c[2] - p1->c[2];
-+	vx = p3->c[0] - p1->c[0];
-+	vy = p3->c[1] - p1->c[1];
-+	vz = p3->c[2] - p1->c[2];
- 
+-
 -        /* volume PABC */
 -        v1 = uz*vy - uy*vz;
 -        v2 = ux*vz - uz*vx;
@@ -4769,6 +4747,41 @@
 -       h3 = (p2->c[0] - p3->c[0])*(p2->c[0] - p3->c[0]) + (p2->c[1] - p3->c[1])*(p2->c[1] - p3->c[1])
 -          + (p2->c[2] - p3->c[2])*(p2->c[2] - p3->c[2]);
 -	     if ( dd < VOLMIN*sqrt(h1*h2*h3) )  break;   
+-
+-        /* average metric */
+-        iadr = (ib-1)*sol->offset + 1;
+-        mb   = &sol->met[iadr];
+-        iadr = (ic-1)*sol->offset + 1;
+-        mc   = &sol->met[iadr];
+-        iadr = (id-1)*sol->offset + 1;
+-        md   = &sol->met[iadr];
+-        for (j=0; j<6; j++)
+-          mm[j] = 0.25 * (ma[j]+mb[j]+mc[j]+md[j]);
+-          
+-        det = mm[0] * ( mm[3]*mm[5] - mm[4]*mm[4]) \
+-            - mm[1] * ( mm[1]*mm[5] - mm[2]*mm[4]) \
+-            + mm[2] * ( mm[1]*mm[4] - mm[2]*mm[3]);
+-        if ( det < EPSOK )  break;
++	adj = vois[i];
++	MMG_cas = 0;
++	if ( adj && mesh->tetra[adj].mark == base)  continue;
++
++	ib = pt->v[ MMG_idir[i][0] ];
++	ic = pt->v[ MMG_idir[i][1] ];
++	id = pt->v[ MMG_idir[i][2] ];
++
++	p1 = &mesh->point[ib];
++	p2 = &mesh->point[ic];
++	p3 = &mesh->point[id];
++
++	ux = p2->c[0] - p1->c[0];
++	uy = p2->c[1] - p1->c[1];
++	uz = p2->c[2] - p1->c[2];
++
++	vx = p3->c[0] - p1->c[0];
++	vy = p3->c[1] - p1->c[1];
++	vz = p3->c[2] - p1->c[2];
++
 +	/* volume PABC */
 +	v1 = uz*vy - uy*vz;
 +	v2 = ux*vz - uz*vx;
@@ -4783,21 +4796,7 @@
 +	h3 = (p2->c[0] - p3->c[0])*(p2->c[0] - p3->c[0]) + (p2->c[1] - p3->c[1])*(p2->c[1] - p3->c[1])
 +	  + (p2->c[2] - p3->c[2])*(p2->c[2] - p3->c[2]);
 +	if ( dd < VOLMIN*sqrt(h1*h2*h3) )  break;
- 
--        /* average metric */
--        iadr = (ib-1)*sol->offset + 1;
--        mb   = &sol->met[iadr];
--        iadr = (ic-1)*sol->offset + 1;
--        mc   = &sol->met[iadr];
--        iadr = (id-1)*sol->offset + 1;
--        md   = &sol->met[iadr];
--        for (j=0; j<6; j++)
--          mm[j] = 0.25 * (ma[j]+mb[j]+mc[j]+md[j]);
--          
--        det = mm[0] * ( mm[3]*mm[5] - mm[4]*mm[4]) \
--            - mm[1] * ( mm[1]*mm[5] - mm[2]*mm[4]) \
--            + mm[2] * ( mm[1]*mm[4] - mm[2]*mm[3]);
--        if ( det < EPSOK )  break;
++
 +	/* average metric */
 +	iadr = (ib-1)*sol->offset + 1;
 +	mb   = &sol->met[iadr];
@@ -4807,12 +4806,12 @@
 +	md   = &sol->met[iadr];
 +	for (j=0; j<6; j++)
 +	  mm[j] = 0.25 * (ma[j]+mb[j]+mc[j]+md[j]);
- 
++
 +	det = mm[0] * ( mm[3]*mm[5] - mm[4]*mm[4]) \
 +	  - mm[1] * ( mm[1]*mm[5] - mm[2]*mm[4]) \
 +	  + mm[2] * ( mm[1]*mm[4] - mm[2]*mm[3]);
 +	if ( det < EPSOK )  break;
-+
+ 
  	/* point close to face */
  	/*nn = (v1*v1 + v2*v2 + v3*v3);*/
 -MMG_cas=2;
@@ -4833,7 +4832,7 @@
  	*//*if ( pow(det,1./3.)*dd*dd < nn * eps2 )  break;*/
  	if ( det*dd*dd < nn * eps2 )  break;
  	/*if ( dd*dd < nn * eps2 ) {
-@@ -464,10 +464,10 @@
+@@ -464,10 +464,10 @@ MMG_cas=2;
  	  printf("en iso sqrt : %e %e    %e %e\n",dd,nn,dd/sqrt(nn),(sqrt(mm[0]))*(dd/sqrt(nn)));
  
  	  dd1 = mm[0]*v1*v1 + mm[3]*v2*v2 + mm[5]*v3*v3 \
@@ -4847,7 +4846,7 @@
  	  nn = sqrt(nn);
  	  ph = dd/nn;
  	  v1 /= nn;
-@@ -476,37 +476,41 @@
+@@ -476,37 +476,41 @@ MMG_cas=2;
  	  xh = ph*v1 + ppt->c[0];
  	  yh = ph*v2 + ppt->c[1];
  	  zh = ph*v3 + ppt->c[2];
@@ -4858,32 +4857,34 @@
 -          uy = yh - ppt->c[1];
 -          uz = zh - ppt->c[2];
 -          dd = ux*ux + uy*uy + uz*uz;
+-
+-          dd2 =      mm[0]*ux*ux + mm[3]*uy*uy + mm[5]*uz*uz \
+-               + 2.0*(mm[1]*ux*uy + mm[2]*ux*uz + mm[4]*uy*uz);
+-          if ( dd2 <= 0.0 )  dd2 = 0.0;
 +	  uy = yh - ppt->c[1];
 +	  uz = zh - ppt->c[2];
 +	  dd = ux*ux + uy*uy + uz*uz;
- 
--          dd2 =      mm[0]*ux*ux + mm[3]*uy*uy + mm[5]*uz*uz \
--               + 2.0*(mm[1]*ux*uy + mm[2]*ux*uz + mm[4]*uy*uz);
--          if ( dd2 <= 0.0 )  dd2 = 0.0;
++
 +	  dd2 =      mm[0]*ux*ux + mm[3]*uy*uy + mm[5]*uz*uz \
 +	  + 2.0*(mm[1]*ux*uy + mm[2]*ux*uz + mm[4]*uy*uz);
 +	  if ( dd2 <= 0.0 )  dd2 = 0.0;
++
++	  len = sqrt(dd2);
  
 -          len = sqrt(dd2);
 -	  
-+	  len = sqrt(dd2);
-+
  	  printf("on trouve len : %e %e %e\n",len,sqrt(eps2)*sqrt(mm[0]),pow(sqrt(eps2)*sqrt(det),1./3.));
  	  printf("len carre %e %e\n",mm[0]*v1*v1*ph*ph + mm[3]*v2*v2*ph*ph + mm[5]*v3*v3*ph*ph,dd2);
 -	 exit(0);
 -	 break;
 -	 }*/
 -MMG_cas=0;	
+-      }
 +	  exit(0);
 +	  break;
 +	  }*/
 +	MMG_cas=0;
-       }
++      }
 +#ifdef REQUIRED
 +      if ( i < 4 || pt->tag & M_REQUIRED ) {
 +#else
@@ -4907,7 +4908,7 @@
      }
    }
    while ( ncor > 0 && lon >= nedep );
-@@ -521,8 +525,8 @@
+@@ -521,8 +525,8 @@ int MMG_correction_iso(pMesh mesh,int ip
    pTetra   pt;
    double   dd,nn,eps,eps2,ux,uy,uz,vx,vy,vz,v1,v2,v3;
    int     *adja,i,ipil,iel,lon,iadr,adj,ib,ic,id,base,ncor;
@@ -4918,7 +4919,7 @@
    ppt  = &mesh->point[ip];
    if ( ppt->tag & M_UNUSED )  return(ilist);
    base = mesh->mark;
-@@ -542,56 +546,60 @@
+@@ -542,56 +546,60 @@ int MMG_correction_iso(pMesh mesh,int ip
        vois[2]  = adja[2] >> 2;
        vois[3]  = adja[3] >> 2;
        pt   = &mesh->tetra[iel];
@@ -4928,38 +4929,23 @@
 -        adj = vois[i];
 -MMG_cas = 0;
 -        if ( adj && mesh->tetra[adj].mark == base )  continue;
-+	adj = vois[i];
-+	MMG_cas = 0;
-+	if ( adj && mesh->tetra[adj].mark == base )  continue;
- 
+-
 -        ib = pt->v[ MMG_idir[i][0] ];
 -        ic = pt->v[ MMG_idir[i][1] ];
 -        id = pt->v[ MMG_idir[i][2] ];
-+	ib = pt->v[ MMG_idir[i][0] ];
-+	ic = pt->v[ MMG_idir[i][1] ];
-+	id = pt->v[ MMG_idir[i][2] ];
- 
+-
 -        p1 = &mesh->point[ib];
 -        p2 = &mesh->point[ic];
 -        p3 = &mesh->point[id];
-+	p1 = &mesh->point[ib];
-+	p2 = &mesh->point[ic];
-+	p3 = &mesh->point[id];
- 
+-
 -        ux = p2->c[0] - p1->c[0];
 -        uy = p2->c[1] - p1->c[1];
 -        uz = p2->c[2] - p1->c[2];
-+	ux = p2->c[0] - p1->c[0];
-+	uy = p2->c[1] - p1->c[1];
-+	uz = p2->c[2] - p1->c[2];
- 
+-
 -        vx = p3->c[0] - p1->c[0];
 -        vy = p3->c[1] - p1->c[1];
 -        vz = p3->c[2] - p1->c[2];
-+	vx = p3->c[0] - p1->c[0];
-+	vy = p3->c[1] - p1->c[1];
-+	vz = p3->c[2] - p1->c[2];
- 
+-
 -        /* volume PABC */
 -        v1 = uz*vy - uy*vz;
 -        v2 = ux*vz - uz*vx;
@@ -4969,6 +4955,38 @@
 -MMG_cas=1;   
 -//printf("on trouve vol %e <? %e\n",dd,VOLMIN);
 -	      if ( dd < VOLMIN )  break;
+-
+-        /* point close to face */
+-        nn = (v1*v1 + v2*v2 + v3*v3);
+-MMG_cas=2;                         
+-//printf("on trouve close ? %e %e\n",dd*dd,nn*eps2);
+-        if ( dd*dd < nn * eps2 )  break;
+-MMG_cas=0;	
+-      }
+-      if ( i < 4 ) {
+-        if ( ipil <= nedep )  {/*printf("on veut tout retirer ? %d %d\n",ipil,nedep);*/return(0);   }
+-        /* remove iel from list */
+-        pt->mark = base-1;
++	adj = vois[i];
++	MMG_cas = 0;
++	if ( adj && mesh->tetra[adj].mark == base )  continue;
++
++	ib = pt->v[ MMG_idir[i][0] ];
++	ic = pt->v[ MMG_idir[i][1] ];
++	id = pt->v[ MMG_idir[i][2] ];
++
++	p1 = &mesh->point[ib];
++	p2 = &mesh->point[ic];
++	p3 = &mesh->point[id];
++
++	ux = p2->c[0] - p1->c[0];
++	uy = p2->c[1] - p1->c[1];
++	uz = p2->c[2] - p1->c[2];
++
++	vx = p3->c[0] - p1->c[0];
++	vy = p3->c[1] - p1->c[1];
++	vz = p3->c[2] - p1->c[2];
++
 +	/* volume PABC */
 +	v1 = uz*vy - uy*vz;
 +	v2 = ux*vz - uz*vx;
@@ -4978,24 +4996,14 @@
 +	MMG_cas=1;
 +	//printf("on trouve vol %e <? %e\n",dd,VOLMIN);
 +	if ( dd < VOLMIN )  break;
- 
--        /* point close to face */
--        nn = (v1*v1 + v2*v2 + v3*v3);
--MMG_cas=2;                         
--//printf("on trouve close ? %e %e\n",dd*dd,nn*eps2);
--        if ( dd*dd < nn * eps2 )  break;
--MMG_cas=0;	
++
 +	/* point close to face */
 +	nn = (v1*v1 + v2*v2 + v3*v3);
 +	MMG_cas=2;
 +	//printf("on trouve close ? %e %e\n",dd*dd,nn*eps2);
 +	if ( dd*dd < nn * eps2 )  break;
 +	MMG_cas=0;
-       }
--      if ( i < 4 ) {
--        if ( ipil <= nedep )  {/*printf("on veut tout retirer ? %d %d\n",ipil,nedep);*/return(0);   }
--        /* remove iel from list */
--        pt->mark = base-1;
++      }
 +#ifdef REQUIRED
 +    if ( i < 4 || pt->tag & M_REQUIRED ) {
 +#else
@@ -5018,7 +5026,7 @@
      }
    }
    while ( ncor > 0 && lon >= nedep );
-@@ -607,8 +615,8 @@
+@@ -607,8 +615,8 @@ int MMG_cavity_ani(pMesh mesh,pSol sol,i
    double    c[3],eps,dd,ray,ux,uy,uz,crit;
    double    *mj,*mp,ct[12];
    int       *adja,*adjb,k,adj,adi,voy,i,j,ia,ilist,ipil,jel,iadr,base;
@@ -5029,7 +5037,7 @@
    if ( lon < 1 )  return(0);
    ppt = &mesh->point[ip];
    if ( ppt->tag & M_UNUSED )  return(0);
-@@ -642,7 +650,7 @@
+@@ -642,7 +650,7 @@ int MMG_cavity_ani(pMesh mesh,pSol sol,i
        /* boundary face */
        if ( pt->mark == base || pt->ref != ptc->ref )  continue;
        for (j=0,l=0; j<4; j++,l+=3) {
@@ -5038,7 +5046,7 @@
        }
  
  
-@@ -653,7 +661,7 @@
+@@ -653,23 +661,23 @@ int MMG_cavity_ani(pMesh mesh,pSol sol,i
        uy = ppt->c[1] - c[1];
        uz = ppt->c[2] - c[2];
        dd =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
@@ -5047,7 +5055,6 @@
        crit = eps * ray;
        if ( dd > crit )  continue;
  
-@@ -660,16 +668,16 @@
        /* mixed metrics */
        crit = sqrt(dd/ray);
        for (j=0; j<4; j++) {
@@ -5074,7 +5081,7 @@
        }
        crit *= EPSRAD;
        if ( crit > 5.0 ) continue;
-@@ -679,19 +687,19 @@
+@@ -679,19 +687,19 @@ int MMG_cavity_ani(pMesh mesh,pSol sol,i
        adjb = &mesh->adja[iadr];
  
        for (j=0; j<4; j++) {
@@ -5104,7 +5111,7 @@
        }
      }
      if ( ilist > LONMAX - 3 )  return(-1);
-@@ -705,11 +713,11 @@
+@@ -705,11 +713,11 @@ int MMG_cavity_ani(pMesh mesh,pSol sol,i
    else
      ilist = MMG_correction_ani(mesh,sol,ip,list,ilist,lon);
  
@@ -5121,7 +5128,7 @@
  
    return(ilist);
  }
-@@ -722,20 +730,14 @@
+@@ -722,19 +730,13 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,i
    int      *adja,*adjb,k,adj,adi,voy,i,j,ilist,ipil,jel,iadr,base;
    int       vois[4],l;
    int tref;
@@ -5135,16 +5142,15 @@
 -#if !defined(_MSC_VER)
 -#warning remove this test
 -#endif
-+
-   for (k=1; k<=lon; k++)
+-  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);
 -  
--  for (k=1; k<=lon; k++)
++
+   for (k=1; k<=lon; k++)
      list->tetra[k] = list->tetra[k] / 6;
  
-   /* grow cavity by adjacency */
-@@ -745,7 +747,7 @@
+@@ -745,7 +747,7 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,i
    ipil  = 1;
  
    do {
@@ -5153,7 +5159,7 @@
      iadr = (jel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      vois[0]  = adja[0];
-@@ -763,7 +765,7 @@
+@@ -763,7 +765,7 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,i
        if ( pt->mark == base || pt->ref != ptc->ref )  continue;
  
        for (j=0,l=0; j<4; j++,l+=3) {
@@ -5162,7 +5168,7 @@
        }
  
        if ( !MMG_cenrad_iso(mesh,ct,c,&ray) )  continue;
-@@ -771,8 +773,8 @@
+@@ -771,8 +773,8 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,i
  
        /* Delaunay criterion */
        dd = (ppt->c[0] - c[0]) * (ppt->c[0] - c[0]) \
@@ -5173,7 +5179,7 @@
        if ( dd > crit )  continue;
  
        /* lost face(s) */
-@@ -780,19 +782,19 @@
+@@ -780,19 +782,19 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,i
        adjb = &mesh->adja[iadr];
  
        for (j=0; j<4; j++) {
@@ -5203,7 +5209,7 @@
        }
      }
      if ( ilist > LONMAX - 3 )  return(-1);
-@@ -800,16 +802,16 @@
+@@ -800,16 +802,16 @@ int MMG_cavity_iso(pMesh mesh,pSol sol,i
    }
    while ( ipil <= ilist );
    /* global overflow */
@@ -5226,11 +5232,11 @@
  
    return(ilist);
  }
-Index: contrib/mmg3d/build/sources/eigenv.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/eigenv.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/eigenv.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/eigenv.c	(working copy)
-@@ -47,7 +47,7 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/eigenv.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/eigenv.c
+@@ -47,7 +47,7 @@ along with MMG3D. If not, see <http://ww
  #include <string.h>
  #include <math.h>
  
@@ -5239,7 +5245,7 @@
  #define  EPSD           1.e-15
  #define  EPSD2          1.e-10
  #define  EPS6           5.e-06
-@@ -55,17 +55,17 @@
+@@ -55,17 +55,17 @@ along with MMG3D. If not, see <http://ww
  #define  EPSX2          2.e-06
  #define  MAXTOU         50
  
@@ -5265,7 +5271,7 @@
  
  
  /* find root(s) of polynomial:  P(x)= x^3+bx^2+cx+d
-@@ -112,9 +112,9 @@
+@@ -112,9 +112,9 @@ static int newton3(double p[4],double x[
        fx = d + x[2]*(c+x[2]*(b+x[2]));
        if ( fabs(fx) > EPSD2 ) {
  #ifdef DEBUG
@@ -5277,7 +5283,7 @@
        }
        return(n);
      }
-@@ -128,9 +128,9 @@
+@@ -128,9 +128,9 @@ static int newton3(double p[4],double x[
        fx = d + x[2]*(c+x[2]*(b+x[2]));
        if ( fabs(fx) > EPSD2 ) {
  #ifdef DEBUG
@@ -5289,7 +5295,7 @@
        }
        return(n);
      }
-@@ -180,8 +180,8 @@
+@@ -180,8 +180,8 @@ static int newton3(double p[4],double x[
      if ( dxx < 1.0e-10 ) {
        x[0] = x2;
        if ( fabs(fx) > EPSD2 ) {
@@ -5300,7 +5306,7 @@
        }
        break;
      }
-@@ -215,20 +215,21 @@
+@@ -215,20 +215,21 @@ static int newton3(double p[4],double x[
    x[2] = 0.5 * (-db-delta);
  
  #ifdef DEBUG
@@ -5334,7 +5340,7 @@
  }
  
  
-@@ -322,7 +323,7 @@
+@@ -322,7 +323,7 @@ int eigenv(int symmat,double *mat,double
      if ( valm > maxd )  maxd = valm;
      valm = fabs(a31);
      if ( valm > maxd )  maxd = valm;
@@ -5343,7 +5349,7 @@
      if ( valm > maxd )  maxd = valm;
      if ( maxd < EPSD )  return(1);
  
-@@ -379,32 +380,32 @@
+@@ -379,32 +380,32 @@ int eigenv(int symmat,double *mat,double
  
        /* find vector of max norm */
        if ( dd1 > dd2 ) {
@@ -5398,7 +5404,7 @@
        }
      }
    }
-@@ -434,30 +435,30 @@
+@@ -434,30 +435,30 @@ int eigenv(int symmat,double *mat,double
      /* find vector of max norm */
      if ( dd1 > dd2 ) {
        if ( dd1 > dd3 ) {
@@ -5445,7 +5451,7 @@
        }
      }
  
-@@ -494,7 +495,7 @@
+@@ -494,60 +495,60 @@ int eigenv(int symmat,double *mat,double
  
    /* check accuracy */
    /*-------------------------------------------------------------------
@@ -5454,7 +5460,6 @@
      double  err,tmpx,tmpy,tmpz;
      float   m[6];
      int     i,j;
-@@ -501,53 +502,53 @@
  
      k = 0;
      for (i=0; i<3; i++)
@@ -5490,6 +5495,23 @@
 -             v[0][0]*v[2][0]+v[0][1]*v[2][1]+ v[0][2]*v[2][2]);
 -      printf("v2.v3 = %.14f\n",
 -             v[1][0]*v[2][0]+v[1][1]*v[2][1]+ v[1][2]*v[2][2]);
+-
+-      printf("Consistency\n");
+-      for (i=0; i<3; i++) {
+-        tmpx = v[0][i]*m[0] + v[1][i]*m[1]
+-             + v[2][i]*m[2] - lambda[i]*v[0][i];
+-        tmpy = v[0][i]*m[1] + v[1][i]*m[3]
+-             + v[2][i]*m[4] - lambda[i]*v[1][i];
+-        tmpz = v[0][i]*m[2] + v[1][i]*m[4]
+-             + v[2][i]*m[5] - lambda[i]*v[2][i];
+-        printf(" Av %d - lambda %d *v %d = %f %f %f\n",
+-        i,i,i,tmpx,tmpy,tmpz);
+-
+-        printf("w1 %f %f %f\n",w1[0],w1[1],w1[2]);
+-        printf("w2 %f %f %f\n",w2[0],w2[1],w2[2]);
+-        printf("w3 %f %f %f\n",w3[0],w3[1],w3[2]);
+-      }
+-      exit(1);
 +    printf("\nProbleme eigenv3: err= %f\n",err*maxm);
 +    printf("mat depart :\n");
 +    printf("%13.6f  %13.6f  %13.6f\n",mat[0],mat[1],mat[2]);
@@ -5508,17 +5530,7 @@
 +    v[0][0]*v[2][0]+v[0][1]*v[2][1]+ v[0][2]*v[2][2]);
 +    printf("v2.v3 = %.14f\n",
 +    v[1][0]*v[2][0]+v[1][1]*v[2][1]+ v[1][2]*v[2][2]);
- 
--      printf("Consistency\n");
--      for (i=0; i<3; i++) {
--        tmpx = v[0][i]*m[0] + v[1][i]*m[1]
--             + v[2][i]*m[2] - lambda[i]*v[0][i];
--        tmpy = v[0][i]*m[1] + v[1][i]*m[3]
--             + v[2][i]*m[4] - lambda[i]*v[1][i];
--        tmpz = v[0][i]*m[2] + v[1][i]*m[4]
--             + v[2][i]*m[5] - lambda[i]*v[2][i];
--        printf(" Av %d - lambda %d *v %d = %f %f %f\n",
--        i,i,i,tmpx,tmpy,tmpz);
++
 +    printf("Consistency\n");
 +    for (i=0; i<3; i++) {
 +    tmpx = v[0][i]*m[0] + v[1][i]*m[1]
@@ -5529,12 +5541,7 @@
 +    + v[2][i]*m[5] - lambda[i]*v[2][i];
 +    printf(" Av %d - lambda %d *v %d = %f %f %f\n",
 +    i,i,i,tmpx,tmpy,tmpz);
- 
--        printf("w1 %f %f %f\n",w1[0],w1[1],w1[2]);
--        printf("w2 %f %f %f\n",w2[0],w2[1],w2[2]);
--        printf("w3 %f %f %f\n",w3[0],w3[1],w3[2]);
--      }
--      exit(1);
++
 +    printf("w1 %f %f %f\n",w1[0],w1[1],w1[2]);
 +    printf("w2 %f %f %f\n",w2[0],w2[1],w2[2]);
 +    printf("w3 %f %f %f\n",w3[0],w3[1],w3[2]);
@@ -5548,7 +5555,7 @@
  
    return(n);
  }
-@@ -586,7 +587,7 @@
+@@ -586,7 +587,7 @@ int eigen2(double *mm,double *lambda,dou
    }
  
    /* eigenvalues of jacobian */
@@ -5557,7 +5564,7 @@
    ddeltb = a1*a1 - 4.0 * (m[0]*m[2] - m[1]*m[1]);
  
    if ( ddeltb < 0.0 ) {
-@@ -612,7 +613,7 @@
+@@ -612,7 +613,7 @@ int eigen2(double *mm,double *lambda,dou
      rr2 = -rr1;
    }
  
@@ -5566,11 +5573,11 @@
    xn = 1.0 / xn;
    lambda[0] = rr1 * xn;
    lambda[1] = rr2 * xn;
-Index: contrib/mmg3d/build/sources/eigenv.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/eigenv.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/eigenv.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/eigenv.h	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/eigenv.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/eigenv.h
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -5605,7 +5612,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -5616,7 +5622,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -5625,11 +5631,11 @@
  ****************************************************************************/
  int eigenv(int symmat,double *mat,double lambda[3],double v[3][3]);
  int eigen2(double *mm,double *lambda,double vp[2][2]);
-Index: contrib/mmg3d/build/sources/hash.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/hash.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/hash.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/hash.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/hash.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/hash.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -5664,7 +5670,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -5675,7 +5680,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -5684,7 +5689,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -55,7 +55,7 @@
+@@ -55,7 +55,7 @@ along with MMG3D. If not, see <http://ww
  
  
  
@@ -5693,7 +5698,7 @@
  typedef struct {
    int      min,max,sum,iel,nxt;
  } hface;
-@@ -69,7 +69,7 @@
+@@ -69,7 +69,7 @@ typedef struct {
  int MMG_hashTetra(pMesh mesh) {
    pTetra    pt,pt1;
    int       k,kk,pp,l,ll,mins,mins1,maxs,maxs1,sum,sum1,iadr;
@@ -5702,7 +5707,7 @@
    long int  inival;
    unsigned char  i,ii,i1,i2,i3;
    unsigned int    key;
-@@ -108,7 +108,7 @@
+@@ -108,14 +108,14 @@ int MMG_hashTetra(pMesh mesh) {
        key = key % hsize + 1;
  
        /* insert */
@@ -5711,7 +5716,6 @@
        link[iadr] = hcode[key];
        hcode[key] = -iadr;
      }
-@@ -115,7 +115,7 @@
    }
  
    /* set adjacency */
@@ -5720,7 +5724,7 @@
      if ( link[l] >= 0 )  continue;
      k = ((l-1) >> 2) + 1;
      i = (l-1) % 4;
-@@ -140,22 +140,22 @@
+@@ -140,22 +140,22 @@ int MMG_hashTetra(pMesh mesh) {
        i1 = MMG_idir[ii][0];
        i2 = MMG_idir[ii][1];
        i3 = MMG_idir[ii][2];
@@ -5757,7 +5761,7 @@
        }
        pp = ll;
        ll = -link[ll];
-@@ -166,8 +166,144 @@
+@@ -166,6 +166,142 @@ int MMG_hashTetra(pMesh mesh) {
    return(1);
  }
  
@@ -5771,7 +5775,7 @@
 +  unsigned int    key;
 +  unsigned char MMG_hidir[6][4] = { {0,3,2,1}, {0,4,7,3}, {0,1,5,4}, {4,5,6,7}, {1,2,6,5}, {2,3,7,6} };
 +  unsigned char MMG_hopp[6][4] = { {2,1,0,3}, {7,3,0,4}, {5,4,0,1}, {6,7,4,5}, {6,5,1,2}, {7,6,2,3} };
- 
++
 +  /* default */
 +  fprintf(stdout,"  ** SETTING HEXA ADJACENCIES\n");
 +  fflush(stdout);
@@ -5780,7 +5784,7 @@
 +  assert(hcode);
 +  link  = adjahex;
 +  hsize = nhex;
- 
++
 +  /* init */
 +  inival = 2147483647;
 +  for (k=0; k<=nhex; k++)
@@ -5897,12 +5901,10 @@
 +  M_free(hcode);
 +  return(1);
 +}
-+
-+
+ 
+ 
  /* hash mesh edge v[0],v[1] (face i of iel) */
- int MMG_hashEdge(pMesh mesh,pHedge hash,int iel,int i,int *v) {
-   int       *adja,iadr,jel,j,key,mins,maxs;
-@@ -202,19 +338,19 @@
+@@ -202,19 +338,19 @@ int MMG_hashEdge(pMesh mesh,pHedge hash,
      }
      else
        while ( ha->nxt && ha->nxt < hash->nhmax ) {
@@ -5911,12 +5913,7 @@
 -          iadr = (iel-1)*4 + 1;
 -          adja = &mesh->adja[iadr];
 -          adja[i] = ha->iel;
-+	ha = &hash->item[ha->nxt];
-+	if ( ha->min == mins && ha->max == maxs ) {
-+	  iadr = (iel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[i] = ha->iel;
- 
+-
 -          jel  = ha->iel >> 2;
 -          j    = ha->iel % 4;
 -          iadr = (jel-1)*4 + 1;
@@ -5924,6 +5921,12 @@
 -          adja[j] = iel*4 + i;
 -	      return(1);
 -	    }
++	ha = &hash->item[ha->nxt];
++	if ( ha->min == mins && ha->max == maxs ) {
++	  iadr = (iel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[i] = ha->iel;
++
 +	  jel  = ha->iel >> 2;
 +	  j    = ha->iel % 4;
 +	  iadr = (jel-1)*4 + 1;
@@ -5934,7 +5937,7 @@
        }
      ha->nxt = hash->hnxt;
      ha      = &hash->item[hash->hnxt];
-@@ -263,9 +399,9 @@
+@@ -263,9 +399,9 @@ int MMG_inEdge(pHedge hash,int *v,int *i
      do {
        ha = &hash->item[ha->nxt];
        if ( ha->min == mins && ha->max == maxs ) {
@@ -5947,7 +5950,7 @@
        }
      }
      while ( ha->nxt && ha->nxt < hash->nhmax );
-@@ -298,7 +434,7 @@
+@@ -298,7 +434,7 @@ int MMG_hashFace(Hface *hash,int iel,int
        return(ht->iel);
      else
        while ( ht->nxt && ht->nxt < hash->nhmax ) {
@@ -5956,7 +5959,7 @@
  	if ( ht->min == mins && ht->max == maxs && ht->sum == sum )
  	  return(ht->iel);
        }
-@@ -328,16 +464,16 @@
+@@ -328,16 +464,16 @@ int MMG_seedTria(pMesh mesh) {
    Hface     htri;
    int      *adja,v[3],i,k,iel,adj,iadr;
    int ncompt = 0;
@@ -5976,7 +5979,7 @@
  
    /* store triangles */
    for (k=1; k<=mesh->nt; k++) {
-@@ -355,25 +491,25 @@
+@@ -355,25 +491,25 @@ int MMG_seedTria(pMesh mesh) {
      for (i=0; i<4; i++) {
        adj = adja[i] >> 2;
        pt1 = &mesh->tetra[adj];
@@ -6020,7 +6023,7 @@
      }
    }
    M_free(htri.item);
-@@ -398,43 +534,48 @@
+@@ -398,43 +534,48 @@ int MMG_markBdry(pMesh mesh) {
      for (i=0; i<4; i++) {
        adj = adja[i] >> 2;
        pt1 = &mesh->tetra[adj];
@@ -6106,7 +6109,7 @@
      }
    }
  
-@@ -446,31 +587,34 @@
+@@ -446,31 +587,34 @@ int MMG_markBdry(pMesh mesh) {
    }
    else {
      //printf("passe-t-on la ?\n");
@@ -6159,7 +6162,7 @@
  /* edge a-b*/
  int MMG_edgePoint(pHedge hash,int a,int b) {
    int        key,mins,maxs;
-@@ -495,7 +639,7 @@
+@@ -495,7 +639,7 @@ int MMG_edgePoint(pHedge hash,int a,int
      do {
        ha = &hash->item[ha->nxt];
        if ( ha->min == mins && ha->max == maxs ) {
@@ -6168,7 +6171,7 @@
        }
      }
      while ( ha->nxt && ha->nxt < hash->nhmax );
-@@ -513,9 +657,9 @@
+@@ -513,9 +657,9 @@ int MMG_edgePut(pHedge hash,int a,int b,
    if ( a > b ) {
      mins = b;
      maxs = a;
@@ -6180,7 +6183,7 @@
    ha  = &hash->item[key];
  
    if ( ha->min ) {
-@@ -525,11 +669,11 @@
+@@ -525,11 +669,11 @@ int MMG_edgePut(pHedge hash,int a,int b,
      }
      else {
        while ( ha->nxt && ha->nxt < hash->nhmax ) {
@@ -6197,16 +6200,16 @@
      }
      ha->nxt = hash->hnxt;
      ha      = &hash->item[hash->hnxt];
-@@ -548,4 +692,3 @@
+@@ -548,4 +692,3 @@ int MMG_edgePut(pHedge hash,int a,int b,
  
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/heap.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/heap.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/heap.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/heap.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/heap.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/heap.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -6241,7 +6244,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -6252,7 +6254,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -6261,7 +6263,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -49,7 +49,7 @@
+@@ -49,7 +49,7 @@ along with MMG3D. If not, see <http://ww
  #define VECT      2
  
  
@@ -6270,7 +6272,7 @@
  static int MMG_compVector(pMesh mesh,pHeap heap,int i,int j) {
    pTetra   pt,pt1;
    pPoint   pp1,pp2;
-@@ -111,7 +111,7 @@
+@@ -111,7 +111,7 @@ static void MMG_hipdown(pMesh mesh,pHeap
      j   = k+k;
      if ( j < heap->curc ) {
        if ( MMG_compare(mesh,heap,heap->cell[j+1],heap->cell[j]) )
@@ -6279,7 +6281,7 @@
      }
      if ( MMG_compare(mesh,heap,i,heap->cell[j]) )
        break;
-@@ -203,14 +203,14 @@
+@@ -203,14 +203,14 @@ Heap *MMG_hipini(pMesh mesh,int nemax,sh
        dmin = INT_MAX;
        nm   = 0;
        for (i=0; i<4; i++) {
@@ -6300,11 +6302,11 @@
        }
      }
    }
-Index: contrib/mmg3d/build/sources/inout.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/inout.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/inout.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/inout.c	(working copy)
-@@ -46,13 +46,13 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/inout.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/inout.c
+@@ -46,13 +46,13 @@ along with MMG3D. If not, see <http://ww
  #include "mesh.h"
  
  
@@ -6320,7 +6322,7 @@
    char *p_in = (char *) &sbin;
    char *p = (char *)&inv;
  
-@@ -65,12 +65,12 @@
+@@ -65,12 +65,12 @@ int MMG_swapbin(int sbin)
    return(inv);
    /*unsigned char c1, c2, c3, c4;
  
@@ -6338,7 +6340,7 @@
  
  }
  float MMG_swapf(float sbin)
-@@ -93,9 +93,9 @@
+@@ -93,9 +93,9 @@ double MMG_swapd(double sbin)
    int i;
  
    for(i=0;i<8;i++)
@@ -6351,7 +6353,7 @@
    //printf("CONVERTION DOUBLE\n");
    return(out);
  }
-@@ -104,16 +104,20 @@
+@@ -104,16 +104,20 @@ double MMG_swapd(double sbin)
  int MMG_loadMesh(pMesh mesh,char *filename) {
    FILE*            inm;
    Hedge            hed,hed2;
@@ -6374,7 +6376,7 @@
  
  
    posnp = posnt = posne = posnhex = posnpris = 0;
-@@ -132,8 +136,8 @@
+@@ -132,8 +136,8 @@ int MMG_loadMesh(pMesh mesh,char *filena
        *ptr = '\0';
        strcat(data,".mesh");
        if( !(inm = fopen(data,"r")) ) {
@@ -6385,7 +6387,7 @@
        }
      } else {
        bin = 1;
-@@ -143,14 +147,14 @@
+@@ -143,14 +147,14 @@ int MMG_loadMesh(pMesh mesh,char *filena
      ptr = strstr(data,".meshb");
      if( !ptr ) {
        if( !(inm = fopen(data,"r")) ) {
@@ -6404,7 +6406,7 @@
        }
  
      }
-@@ -161,57 +165,57 @@
+@@ -161,152 +165,152 @@ int MMG_loadMesh(pMesh mesh,char *filena
      strcpy(chaine,"D");
      while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
        if(!strncmp(chaine,"MeshVersionFormatted",strlen("MeshVersionFormatted"))) {
@@ -6500,7 +6502,6 @@
      iswp=0;
      if(mesh->ver==16777216)
        iswp=1;
-@@ -218,95 +222,95 @@
      else if(mesh->ver!=1) {
        fprintf(stdout,"BAD FILE ENCODING\n");
      }
@@ -6672,7 +6673,7 @@
        }
      }
  
-@@ -325,8 +329,13 @@
+@@ -325,8 +329,13 @@ int MMG_loadMesh(pMesh mesh,char *filena
      fprintf(stdout,"  ** MISSING DATA\n");
      return(0);
    }
@@ -6687,7 +6688,7 @@
    /* read mesh vertices */
    mesh->npfixe = mesh->np;
    rewind(inm);
-@@ -335,30 +344,30 @@
+@@ -335,30 +344,30 @@ int MMG_loadMesh(pMesh mesh,char *filena
      ppt = &mesh->point[k];
      if (mesh->ver < 2) { /*float*/
        if (!bin) {
@@ -6737,7 +6738,7 @@
        }
      }
      ppt->tag  = M_UNUSED;
-@@ -371,84 +380,87 @@
+@@ -371,84 +380,87 @@ int MMG_loadMesh(pMesh mesh,char *filena
    for (k=1; k<=mesh->nt; k++) {
      pt1 = &mesh->tria[k];
      if (!bin)
@@ -6855,16 +6856,17 @@
 -        if(iswp) nu2=MMG_swapbin(nu2);
 -        if(fread(&ref,sw,1,inm)!=1){ fclose(inm); return(0); }
 -        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);
--			}
++      }
 +      if(MMG_edgePut(&hed,nu1,nu2,2)>1) {
 +	fprintf(stdout,"  ## WARNING DOUBLE EDGE : %d %d\n",nu1,nu2);
 +      }
@@ -6873,7 +6875,7 @@
      }
    }
  
-@@ -456,36 +468,53 @@
+@@ -456,36 +468,53 @@ int MMG_loadMesh(pMesh mesh,char *filena
    mesh->nefixe = mesh->ne;
    rewind(inm);
    fseek(inm,posne,SEEK_SET);
@@ -6915,17 +6917,18 @@
 -				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) {
 +      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;
--		}
++
 +    } else {
 +      for(i=0 ; i<6 ; i++)
 +	pt->bdryinfo[i] = 0;
@@ -6942,7 +6945,7 @@
  
    /*read corners*/
    if (ncor) {
-@@ -494,10 +523,10 @@
+@@ -494,10 +523,10 @@ int MMG_loadMesh(pMesh mesh,char *filena
      mesh->ncor = ncor;
      for (k=1; k<=ncor; k++) {
        if (!bin)
@@ -6956,7 +6959,7 @@
        }
        ppt = &mesh->point[ref];
        ppt->geom = M_CORNER;
-@@ -519,34 +548,58 @@
+@@ -519,34 +548,58 @@ int MMG_loadMesh(pMesh mesh,char *filena
      /*read hexa and transform to tetra*/
      rewind(inm);
      fseek(inm,posnhex,SEEK_SET);
@@ -7028,7 +7031,7 @@
      fprintf(stdout,"     NUMBER OF GIVEN VERTICES   %8d\n",mesh->npfixe);
      if ( mesh->ntfixe )
        fprintf(stdout,"     NUMBER OF GIVEN TRIANGLES  %8d\n",mesh->ntfixe);
-@@ -556,8 +609,8 @@
+@@ -556,8 +609,8 @@ int MMG_loadMesh(pMesh mesh,char *filena
      if ( ned )
        fprintf(stdout,"     NUMBER OF GIVEN EDGES      %8d\n",ned);
    }
@@ -7039,7 +7042,7 @@
  }
  
  
-@@ -597,67 +650,67 @@
+@@ -597,67 +650,67 @@ int MMG_loadSol(pSol sol,char *filename,
      strcpy(chaine,"DDD");
      while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
        if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
@@ -7152,7 +7155,7 @@
        }
      }
  
-@@ -694,24 +747,24 @@
+@@ -694,24 +747,24 @@ int MMG_loadSol(pSol sol,char *filename,
      isol = (k-1) * sol->offset + 1;
      if (sol->ver == 1) {
        for (i=0; i<sol->offset; i++) {
@@ -7191,7 +7194,7 @@
        }
      }
      /* MMG_swap data */
-@@ -767,67 +820,67 @@
+@@ -767,67 +820,67 @@ int MMG_loadVect(pMesh mesh,char *filena
      strcpy(chaine,"DDD");
      while(fscanf(inm,"%s",&chaine[0])!=EOF && strncmp(chaine,"End",strlen("End")) ) {
        if(!strncmp(chaine,"Dimension",strlen("Dimension"))) {
@@ -7304,7 +7307,7 @@
        }
      }
  
-@@ -856,23 +909,23 @@
+@@ -856,23 +909,23 @@ int MMG_loadVect(pMesh mesh,char *filena
      iadr = (k - 1) * 3 + 1;
      if (pd->ver < 2) {
        for (i=0; i<3; i++) {
@@ -7342,7 +7345,7 @@
        }
      }
    }
-@@ -888,7 +941,7 @@
+@@ -888,7 +941,7 @@ int MMG_loadVect(pMesh mesh,char *filena
  /* save mesh to disk */
  int MMG_saveMesh(pMesh mesh,char *filename) {
    FILE*        inm;
@@ -7351,7 +7354,7 @@
    pPoint       ppt;
    pTria        pt1;
    pTetra       pt;
-@@ -906,8 +959,8 @@
+@@ -906,8 +959,8 @@ int MMG_saveMesh(pMesh mesh,char *filena
        *ptr = '\0';
        strcat(data,".mesh");
        if( !(inm = fopen(data,"w")) ) {
@@ -7362,7 +7365,7 @@
        }
      } else {
        bin = 1;
-@@ -949,9 +1002,9 @@
+@@ -949,9 +1002,9 @@ int MMG_saveMesh(pMesh mesh,char *filena
      assert(cor);
    }
    if(mesh->ned) {
@@ -7374,7 +7377,7 @@
      }
      ed = (int*)M_calloc(2*mesh->ned,sizeof(int),"MMG_savemesh");
      assert(ed);
-@@ -961,10 +1014,10 @@
+@@ -961,10 +1014,10 @@ int MMG_saveMesh(pMesh mesh,char *filena
    for (k=1; k<=mesh->np; k++) {
      ppt = &mesh->point[k];
      if ( ppt->tag & M_UNUSED )  continue;
@@ -7387,7 +7390,7 @@
    if(!bin) {
      strcpy(&chaine[0],"\n\nVertices\n");
      fprintf(inm,"%s",chaine);
-@@ -979,7 +1032,7 @@
+@@ -979,7 +1032,7 @@ int MMG_saveMesh(pMesh mesh,char *filena
    for(k=1; k<=mesh->np; k++) {
      ppt = &mesh->point[k];
      if ( ppt->tag & M_UNUSED )  continue;
@@ -7396,7 +7399,7 @@
      if(!bin) {
        fprintf(inm,"%.15lg %.15lg %.15lg %d\n",ppt->c[0],ppt->c[1],ppt->c[2],ppt->ref);
      } else {
-@@ -1006,15 +1059,16 @@
+@@ -1006,42 +1059,43 @@ int MMG_saveMesh(pMesh mesh,char *filena
      }
      for (k=1; k<=mesh->nt; k++) {
        pt1  = &mesh->tria[k];
@@ -7420,7 +7423,6 @@
        }
      }
    }
-@@ -1021,27 +1075,27 @@
  
    /* write tetrahedra */
    ne = 0;
@@ -7465,7 +7467,7 @@
    if(!bin) {
      strcpy(&chaine[0],"\n\nTetrahedra\n");
      fprintf(inm,"%s",chaine);
-@@ -1053,15 +1107,15 @@
+@@ -1053,15 +1107,15 @@ int MMG_saveMesh(pMesh mesh,char *filena
      fwrite(&bpos,sw,1,inm);
      fwrite((unsigned char*)&ne,sw,1,inm);
    }
@@ -7484,7 +7486,7 @@
      } else {
        fwrite(&mesh->point[pt->v[0]].tmp,sw,1,inm);
        fwrite(&mesh->point[pt->v[1]].tmp,sw,1,inm);
-@@ -1083,17 +1137,18 @@
+@@ -1083,17 +1137,18 @@ int MMG_saveMesh(pMesh mesh,char *filena
        fwrite(&bpos,sw,1,inm);
        fwrite((unsigned char*)&ned,sw,1,inm);
      }
@@ -7514,7 +7516,7 @@
    }
  
    /* write corners */
-@@ -1138,7 +1193,7 @@
+@@ -1138,7 +1193,7 @@ int MMG_saveMesh(pMesh mesh,char *filena
      if ( mesh->ned )
        fprintf(stdout,"     TOTAL NUMBER OF EDGES      %8d\n",ned);
    }
@@ -7523,7 +7525,7 @@
    return(1);
  
  }
-@@ -1164,17 +1219,17 @@
+@@ -1164,17 +1219,17 @@ int MMG_saveSol(pMesh mesh,pSol sol,char
        *ptr = '\0';
        bin  = 0;
      } else {
@@ -7551,7 +7553,7 @@
      }
    }
    if ( bin )
-@@ -1217,10 +1272,10 @@
+@@ -1217,10 +1272,10 @@ int MMG_saveSol(pMesh mesh,pSol sol,char
  
    switch(sol->offset) {
    case 1:
@@ -7565,7 +7567,7 @@
      break;
    default:
      fprintf(stdout,"  ** DATA IGNORED\n");
-@@ -1232,7 +1287,7 @@
+@@ -1232,7 +1287,7 @@ int MMG_saveSol(pMesh mesh,pSol sol,char
    for (k=1; k<=mesh->np; k++) {
      ppt = &mesh->point[k];
      if ( ppt->tag & M_UNUSED )  continue;
@@ -7574,7 +7576,7 @@
    }
  
    if(!bin) {
-@@ -1263,25 +1318,25 @@
+@@ -1263,25 +1318,25 @@ int MMG_saveSol(pMesh mesh,pSol sol,char
      }
      if (sol->ver < 2) {
        if(!bin) {
@@ -7614,7 +7616,7 @@
        }
  
      }
-@@ -1357,7 +1412,7 @@
+@@ -1357,14 +1412,14 @@ int MMG_saveVect(pMesh mesh,char *filena
      fwrite(&binch,sw,1,inm);
  
    }
@@ -7623,7 +7625,6 @@
  
    /* write data */
    nbl = 0;
-@@ -1364,7 +1419,7 @@
    for (k=1; k<=mesh->np; k++) {
      ppt = &mesh->point[k];
      if ( ppt->tag & M_UNUSED )  continue;
@@ -7632,7 +7633,7 @@
    }
  
    if(!bin) {
-@@ -1393,9 +1448,9 @@
+@@ -1393,9 +1448,9 @@ int MMG_saveVect(pMesh mesh,char *filena
      for (i=0 ; i<3 ; i++) {
        dsol = (ppt->c[i] - mesh->disp->cold[3*(k-1) + 1 + i]* dd - mesh->info.min[i])/mesh->info.dt;
        if(!bin) {
@@ -7644,11 +7645,11 @@
        }
      }
      if (!bin) fprintf(inm,"\n");
-Index: contrib/mmg3d/build/sources/length.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/length.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/length.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/length.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/length.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/length.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -7683,7 +7684,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -7694,7 +7694,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,11 +41,11 @@
+@@ -41,11 +41,11 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -7708,7 +7708,7 @@
  double MMG_long_ani(double *ca,double *cb,double *sa,double *sb) {
    double   ux,uy,uz,dd1,dd2,len;
  
-@@ -54,14 +54,14 @@
+@@ -54,14 +54,14 @@ double MMG_long_ani(double *ca,double *c
    uz = cb[2] - ca[2];
  
    dd1 =      sa[0]*ux*ux + sa[3]*uy*uy + sa[5]*uz*uz \
@@ -7727,7 +7727,7 @@
    /*precision a 3.5 10e-3 pres*/
    if(fabs(dd1-dd2) < 0.05 ) {
      //printf("bonne precision %e \n",sqrt(0.5*(dd1+dd2)) - (sqrt(dd1)+sqrt(dd2)+4.0*sqrt(0.5*(dd1+dd2))) / 6.0 );
-@@ -81,13 +81,13 @@
+@@ -81,13 +81,13 @@ double MMG_long_ani_init(double *ca,doub
    uz = cb[2] - ca[2];
  
    dd1 =      sa[0]*ux*ux + sa[3]*uy*uy + sa[5]*uz*uz \
@@ -7744,7 +7744,7 @@
    len = (sqrt(dd1)+sqrt(dd2)+4.0*sqrt(0.5*(dd1+dd2))) / 6.0;
  
    return(len);
-@@ -100,7 +100,7 @@
+@@ -100,7 +100,7 @@ double MMG_long_iso(double *ca,double *c
  
    sa   = *ma;
    sb   = *mb;
@@ -7753,7 +7753,7 @@
    ux = cb[0] - ca[0];
    uy = cb[1] - ca[1];
    uz = cb[2] - ca[2];
-@@ -124,7 +124,7 @@
+@@ -124,7 +124,7 @@ int MMG_prilen(pMesh mesh,pSol sol) {
    pTetra      pt;
    double      lavg,len,ecart,som,lmin,lmax,*ca,*cb,*ma,*mb;
    int         k,l,lon,navg,ia,ipa,ipb,iamin,ibmin,iamax,ibmax,dep,hl[10];
@@ -7762,7 +7762,7 @@
    List        list;
    static double bd[9] = {0.0, 0.2, 0.5, 0.7071, 0.9, 1.111, 1.4142, 2.0, 5.0 };
    navg  = 0;
-@@ -148,74 +148,73 @@
+@@ -148,90 +148,144 @@ int MMG_prilen(pMesh mesh,pSol sol) {
        lon = MMG_coquil(mesh,k,ia,&list);
        if ( lon < 2 )  continue;
        for (l=2; l<=lon; l++)
@@ -7775,8 +7775,7 @@
 -        ipb = MMG_iare[ia][1];
 -        ca  = &mesh->point[pt->v[ipa]].c[0];
 -        cb  = &mesh->point[pt->v[ipb]].c[0];
-+      if ( l <= lon )  continue;
- 
+-
 -        iadr = (pt->v[ipa]-1)*sol->offset + 1;
 -        ma   = &sol->met[iadr];
 -        iadr = (pt->v[ipb]-1)*sol->offset + 1;
@@ -7790,11 +7789,7 @@
 -        lavg += len;
 -        /* update efficiency index */
 -	      if ( ecart > 1.0 )  ecart = 1.0 / ecart; 
-+      ipa = MMG_iare[ia][0];
-+      ipb = MMG_iare[ia][1];
-+      ca  = &mesh->point[pt->v[ipa]].c[0];
-+      cb  = &mesh->point[pt->v[ipb]].c[0];
- 
+-
 -        som  += (ecart - 1.0); 
 -      
 -        /* find largest, smallest edge */
@@ -7808,20 +7803,7 @@
 -          iamax = pt->v[ipa];
 -          ibmax = pt->v[ipb];
 -        }
-+      iadr = (pt->v[ipa]-1)*sol->offset + 1;
-+      ma   = &sol->met[iadr];
-+      iadr = (pt->v[ipb]-1)*sol->offset + 1;
-+      mb   = &sol->met[iadr];
-+      if(sol->offset==6)
-+	len = MMG_long_ani_init(ca,cb,ma,mb);
-+      else
-+	len = MMG_length(ca,cb,ma,mb);
-+      navg++;
-+      ecart = len;
-+      lavg += len;
-+      /* update efficiency index */
-+      if ( ecart > 1.0 )  ecart = 1.0 / ecart;
- 
+-
 -        /* update histogram */
 -        if (len < bd[3]) {
 -		      if (len > bd[2])       hl[3]++;
@@ -7836,6 +7818,27 @@
 -        else if (len < bd[7])    hl[7]++;
 -        else if (len < bd[8])    hl[8]++;
 -        else                     hl[9]++;
++      if ( l <= lon )  continue;
++
++      ipa = MMG_iare[ia][0];
++      ipb = MMG_iare[ia][1];
++      ca  = &mesh->point[pt->v[ipa]].c[0];
++      cb  = &mesh->point[pt->v[ipb]].c[0];
++
++      iadr = (pt->v[ipa]-1)*sol->offset + 1;
++      ma   = &sol->met[iadr];
++      iadr = (pt->v[ipb]-1)*sol->offset + 1;
++      mb   = &sol->met[iadr];
++      if(sol->offset==6)
++	len = MMG_long_ani_init(ca,cb,ma,mb);
++      else
++	len = MMG_length(ca,cb,ma,mb);
++      navg++;
++      ecart = len;
++      lavg += len;
++      /* update efficiency index */
++      if ( ecart > 1.0 )  ecart = 1.0 / ecart;
++
 +      som  += (ecart - 1.0);
 +
 +      /* find largest, smallest edge */
@@ -7843,14 +7846,16 @@
 +	lmin  = len;
 +	iamin = pt->v[ipa];
 +	ibmin = pt->v[ipb];
-       }
--      /*    /if ( dep < 0 )  break;*/
++      }
 +      else if (len > lmax) {
 +	lmax  = len;
 +	iamax = pt->v[ipa];
 +	ibmax = pt->v[ipb];
-+      }
-+
+       }
+-      /*    /if ( dep < 0 )  break;*/
+-  }
+ 
+-  //if(mesh->info.imprim < 0) { //EMI
 +      /* update histogram */
 +      if (len < bd[3]) {
 +	if (len > bd[2])       hl[3]++;
@@ -7867,10 +7872,8 @@
 +      else                     hl[9]++;
 +    }
 +    /*    /if ( dep < 0 )  break;*/
-   }
- 
--  //if(mesh->info.imprim < 0) { //EMI
--
++  }
+ 
    fprintf(stdout,"\n  -- RESULTING EDGE LENGTHS  %d\n",navg);
    fprintf(stdout,"     AVERAGE LENGTH         %12.4f\n",lavg / (double)navg);
    fprintf(stdout,"     SMALLEST EDGE LENGTH   %12.4f   %6d %6d\n",
@@ -7889,7 +7892,6 @@
      fprintf(stdout,"\n     HISTOGRAMM\n");
      if ( hl[1] )
        fprintf(stdout,"     0.00 < L < 0.20  %8d   %5.2f %%  \n",
-@@ -222,16 +221,71 @@
  	      hl[1],100.*(hl[1]/(float)navg));
      if ( lmax > 0.2 ) {
        for (k=2; k<9; k++) {
@@ -7904,13 +7906,11 @@
 -	        hl[9],100.*(hl[9]/(float)navg));
 +	fprintf(stdout,"     5.   < L         %8d   %5.2f %%  \n",
 +		hl[9],100.*(hl[9]/(float)navg));
-     }
--  
--    //}
++    }
 +  }
- 
-   return(1);
- }
++
++  return(1);
++}
 +
 +/* Store in eltab elements which have edge lengths shorter than lmin or longer than
 + * lmax, eltab is allocated and could contain mesh->ne elements */
@@ -7962,16 +7962,18 @@
 +        eltab[k] = 1;
 +        break;
 +      }
-+    }
+     }
+-  
+-    //}
 +  }
-+
-+  return(1);
-+}
-Index: contrib/mmg3d/build/sources/librnbg.c
+ 
+   return(1);
+ }
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/librnbg.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/librnbg.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/librnbg.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/librnbg.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/librnbg.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -8006,7 +8008,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -8017,7 +8018,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,12 +41,12 @@
+@@ -41,12 +41,12 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -8035,7 +8036,7 @@
  #include "mesh.h"
  
  #ifdef USE_SCOTCH
-@@ -62,16 +62,16 @@
+@@ -62,16 +62,16 @@ along with MMG3D. If not, see <http://ww
  
  
  
@@ -8062,7 +8063,7 @@
  int biPartBoxCompute(SCOTCH_Graph graf, int vertNbr, int boxVertNbr, SCOTCH_Num *permVrtTab) {
    int boxNbr, vertIdx, boxIdx;
    SCOTCH_Num tmp, tmp2, *partTab, *partNumTab, *partPrmTab;
-@@ -85,9 +85,12 @@
+@@ -85,9 +85,12 @@ int biPartBoxCompute(SCOTCH_Graph graf,
  
  
    /* Initializing SCOTCH functions */
@@ -8078,7 +8079,7 @@
    partTab = (SCOTCH_Num *)M_calloc(vertNbr, sizeof(SCOTCH_Num), "boxCompute");
  
  
-@@ -149,7 +152,7 @@
+@@ -149,7 +152,7 @@ int biPartBoxCompute(SCOTCH_Graph graf,
   *  - vertNbr : the number of vertices
   *  - boxVertNbr : the number of vertices of each box
   *  - permVrtTab : the new numbering
@@ -8087,30 +8088,29 @@
   *  returning 0 if OK, 1 else
   */
  int kPartBoxCompute(SCOTCH_Graph graf, int vertNbr, int boxVertNbr, SCOTCH_Num *permVrtTab) {
-@@ -168,13 +171,19 @@
+@@ -168,11 +171,17 @@ int kPartBoxCompute(SCOTCH_Graph graf, i
  
  
    /* Initializing SCOTCH functions */
 -  CHECK_SCOTCH(SCOTCH_stratInit(&strat), "scotch_stratInit", 0) ; 
 -  CHECK_SCOTCH(SCOTCH_archVcmplt(&arch), "scotch_archVcmplt", 0) ; 
+-
 +  CHECK_SCOTCH(SCOTCH_stratInit(&strat), "scotch_stratInit", 0) ;
 +#if SCOTCH_VERSION>=6
 +  CHECK_SCOTCH(SCOTCH_archCmplt(&arch, boxNbr), "scotch_archVcmplt", 0) ; 
- 
++
 +  sprintf(s, "m{vert=%d,low=r{job=t,map=t,poli=S,sep=m{vert=80,low=h{pass=10}f{bal=0.0005,move=80},asc=f{bal=0.005,move=80}}}}", vertNbr / boxVertNbr);
 +#else
 +  CHECK_SCOTCH(SCOTCH_archVcmplt(&arch), "scotch_archVcmplt", 0) ;
    sprintf(s, "m{vert=%d,low=r{job=t,map=t,poli=S,sep=m{type=h,vert=80,low=h{pass=10}f{bal=0.0005,move=80},asc=f{bal=0.005,move=80}}}}", vertNbr / boxVertNbr);
 -  CHECK_SCOTCH(SCOTCH_stratGraphMap(&strat, s), "scotch_stratGraphMap", 0) ; 
- 
++
 +#endif
 +  CHECK_SCOTCH(SCOTCH_stratGraphMap(&strat, s), "scotch_stratGraphMap", 0) ;
  
-+
+ 
    sortPartTb= (SCOTCH_Num *)M_calloc(2*vertNbr, sizeof(SCOTCH_Num), "boxCompute");
- 
- 
-@@ -183,9 +192,10 @@
+@@ -183,9 +192,10 @@ int kPartBoxCompute(SCOTCH_Graph graf, i
  
  
    // Looking for the max value in sortPartTb and computing sortPartTb as
@@ -8122,10 +8122,11 @@
    maxVal = sortPartTb[0];
    for (vertIdx = vertNbr - 1 ; vertIdx >= 0 ; vertIdx--) {
      sortPartTb[2*vertIdx] = sortPartTb[vertIdx];
-@@ -211,9 +221,14 @@
+@@ -211,7 +221,12 @@ int kPartBoxCompute(SCOTCH_Graph graf, i
        sortPartTb[2*vertIdx] <<= 1;
      }
    }
+-
 +#else
 +  for (vertIdx = vertNbr - 1 ; vertIdx >= 0 ; vertIdx--) {
 +    sortPartTb[2*vertIdx] = sortPartTb[vertIdx];
@@ -8134,11 +8135,8 @@
 +#endif
  
  
--
    // Sorting the tabular, which contains box values and vertex numbers
-   _SCOTCHintSort2asc1(sortPartTb, vertNbr);
- 
-@@ -238,7 +253,7 @@
+@@ -238,7 +253,7 @@ int kPartBoxCompute(SCOTCH_Graph graf, i
   *
   *  - boxVertNbr : number of vertices by box
   *  - mesh : the input mesh which is modified
@@ -8147,7 +8145,7 @@
   *  returning 0 if OK, 1 else
   */
  int renumbering(int boxVertNbr, MMG_pMesh mesh, MMG_pSol sol) {
-@@ -246,7 +261,7 @@
+@@ -246,7 +261,7 @@ int renumbering(int boxVertNbr, MMG_pMes
    MMG_pPoint points;
    MMG_pTria ptri, trias;
    MMG_pTetra ptet, tetras;
@@ -8156,7 +8154,7 @@
    SCOTCH_Num *vertTab, *vendTab, *edgeTab, *permVrtTab;
    SCOTCH_Graph graf ;
    int vertNbr, nodeGlbIdx, triaIdx, tetraIdx, ballTetIdx;
-@@ -256,8 +271,8 @@
+@@ -256,8 +271,8 @@ int renumbering(int boxVertNbr, MMG_pMes
    int      *adja,iadr;
    double *metNew;
  
@@ -8166,7 +8164,7 @@
    vertNbr = 0;
    vertOldTab = (int *)M_calloc(mesh->ne + 1, sizeof(int), "renumbering");
  
-@@ -315,13 +330,13 @@
+@@ -315,13 +330,13 @@ int renumbering(int boxVertNbr, MMG_pMes
  
        /* Testing if one neighbour of tetraIdx has already been added */
        if (vertTab[vertOldTab[tetraIdx]] < 0)
@@ -8183,7 +8181,7 @@
        }
  
        edgeTab[edgeNbr++] = vertOldTab[ballTetIdx];
-@@ -334,7 +349,7 @@
+@@ -334,7 +349,7 @@ int renumbering(int boxVertNbr, MMG_pMes
    /* Building the graph by calling Scotch functions */
  
    SCOTCH_graphInit(&graf) ;
@@ -8192,7 +8190,7 @@
    CHECK_SCOTCH(SCOTCH_graphCheck(&graf), "scotch_graphcheck", 0) ;
  
    permVrtTab = (SCOTCH_Num *)M_calloc(vertNbr + 1, sizeof(SCOTCH_Num), "renumbering");
-@@ -366,7 +381,7 @@
+@@ -366,7 +381,7 @@ int renumbering(int boxVertNbr, MMG_pMes
      if (!ptet->v[0]) continue;
  
      /* Building the new point list */
@@ -8201,7 +8199,7 @@
      nereal++;
  
      for(j = 0 ; j <= 3 ; j++) {
-@@ -378,15 +393,15 @@
+@@ -378,15 +393,15 @@ int renumbering(int boxVertNbr, MMG_pMes
        ppt = &mesh->point[nodeGlbIdx];
  
        if (!(ppt->tag & M_UNUSED)) {
@@ -8224,7 +8222,7 @@
        }
      }
    }
-@@ -409,11 +424,11 @@
+@@ -409,11 +424,11 @@ int renumbering(int boxVertNbr, MMG_pMes
    for(triaIdx = 1 ; triaIdx < mesh->nt + 1 ; triaIdx++) {
      ptri = &mesh->tria[triaIdx];
  
@@ -8238,7 +8236,7 @@
      ntreal++;
    }
  
-@@ -447,11 +462,11 @@
+@@ -447,15 +462,15 @@ int renumbering(int boxVertNbr, MMG_pMes
    }
  
    /* Modifying the numbering of the nodes of each triangle */
@@ -8253,18 +8251,17 @@
    }
  
    M_free(permVrtTab);
-@@ -458,4 +473,4 @@
  
    return 1;
  }
 -#endif
 \ No newline at end of file
 +#endif
-Index: contrib/mmg3d/build/sources/librnbg.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/librnbg.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/librnbg.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/librnbg.h	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/librnbg.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/librnbg.h
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -8299,7 +8296,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -8310,7 +8306,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,28 +41,29 @@
+@@ -41,28 +41,29 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -8350,11 +8346,11 @@
 -#endif
 \ No newline at end of file
 +#endif
-Index: contrib/mmg3d/build/sources/locate.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/locate.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/locate.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/locate.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/locate.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/locate.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -8389,7 +8385,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -8400,7 +8395,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -8409,7 +8404,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -49,12 +49,12 @@
+@@ -49,12 +49,12 @@ along with MMG3D. If not, see <http://ww
  #define EPSR     1.e+14
  
  
@@ -8424,7 +8419,7 @@
    int     *adj,iadr,it,nsfin;
  
    it    = 0;
-@@ -110,7 +110,7 @@
+@@ -110,14 +110,14 @@ int MMG_loctet(pMesh mesh,int nsdep,int
        nsfin = adj[2]/4;
        continue;
      }
@@ -8433,7 +8428,6 @@
      /* p in 4 */
      vol4 = -cx*vx - cy*vy - cz*vz;
      if ( epsra > vol4 ) {
-@@ -117,7 +117,7 @@
        nsfin = adj[3]/4;
        continue;
      }
@@ -8442,7 +8436,7 @@
      /* p in 1 */
      vol1 = -epsra * EPSR - vol2 - vol3 - vol4;
      if ( epsra > vol1 ) {
-@@ -130,8 +130,8 @@
+@@ -130,12 +130,11 @@ int MMG_loctet(pMesh mesh,int nsdep,int
      cb[0] = vol1 * dd;
      cb[1] = vol2 * dd;
      cb[2] = vol3 * dd;
@@ -8453,16 +8447,15 @@
      return(nsfin);
    }
    while ( ++it <= mesh->ne );
-@@ -138,4 +138,3 @@
  
    return(0);
  }
 -
-Index: contrib/mmg3d/build/sources/matrix.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/matrix.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/matrix.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/matrix.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/matrix.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/matrix.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -8497,7 +8490,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -8508,7 +8500,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -8517,7 +8509,7 @@
  ****************************************************************************/
  #include <stdio.h>
  #include <stdlib.h>
-@@ -50,7 +50,7 @@
+@@ -50,7 +50,7 @@ along with MMG3D. If not, see <http://ww
  #define EPS3    1.e-42
  #define EPS     1e-6
  
@@ -8526,11 +8518,11 @@
  int MMG_invmat(double *m,double *mi) {
    double  aa,bb,cc,det,vmin,vmax,maxx;
    int     k;
-Index: contrib/mmg3d/build/sources/memory.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/memory.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/memory.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/memory.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/memory.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/memory.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -8565,7 +8557,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -8576,7 +8567,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,12 +41,12 @@
+@@ -41,12 +41,12 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -8594,7 +8585,7 @@
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
-@@ -92,11 +92,11 @@
+@@ -92,11 +92,11 @@ void M_memDump() {
      if ( mstack[i].ptr ) {
        fprintf(stdout,"   %3d  %3d Pointer %10p  size ",++c,i,mstack[i].ptr);
        if (mstack[i].size > mega)
@@ -8610,7 +8601,7 @@
        fprintf(stdout,"(%s)\n",mstack[i].call);
        size += mstack[i].size;
      }
-@@ -143,7 +143,7 @@
+@@ -143,7 +143,7 @@ void *M_malloc(size_t size,char *call) {
      mstack[cur].size = size;
      /* i.e. mstack[cur].call = strdup(call) */
      /* mstack[cur].call = (char*)malloc((strlen(call)+1) * sizeof(char));
@@ -8619,7 +8610,7 @@
      strncpy(mstack[cur].call,call,19);
      i = cur;
      cur = mstack[cur].nxt;
-@@ -155,7 +155,7 @@
+@@ -155,15 +155,15 @@ void *M_malloc(size_t size,char *call) {
      return(mstack[i].ptr);
    }
    else {
@@ -8628,7 +8619,6 @@
  	    size);
      return(0);
    }
-@@ -162,8 +162,8 @@
  }
  
  
@@ -8639,7 +8629,7 @@
     Actual amount of space allocated is >=  nelem * elsize bytes. */
  void *M_calloc(size_t nelem, size_t elsize,char *call) {
    int    i;
-@@ -186,7 +186,7 @@
+@@ -186,7 +186,7 @@ void *M_calloc(size_t nelem, size_t elsi
      /*assert(mstack[cur].ptr);*/
      mstack[cur].size = nelem * elsize;
      /* mstack[cur].call = (char*)malloc((strlen(call)+1) * sizeof(char));
@@ -8648,7 +8638,7 @@
      strncpy(mstack[cur].call,call,19);
      i   = cur;
      cur = mstack[cur].nxt;
-@@ -198,14 +198,14 @@
+@@ -198,14 +198,14 @@ void *M_calloc(size_t nelem, size_t elsi
      return(mstack[i].ptr);
    }
    else {
@@ -8666,7 +8656,7 @@
     contents are unchanged up to the lesser of the new and old sizes. */
  void *M_realloc(void *ptr, size_t size,char *call) {
    int    i;
-@@ -216,8 +216,8 @@
+@@ -216,8 +216,8 @@ void *M_realloc(void *ptr, size_t size,c
    for (i=1; i<=MAXMEM; i++) {
      if (ptr == mstack[i].ptr) {
        /* free(mstack[i].call);
@@ -8677,7 +8667,7 @@
        strncpy(mstack[i].call,call,19);
        mstack[i].ptr = realloc(mstack[i].ptr,size);
        if (size)
-@@ -236,12 +236,12 @@
+@@ -236,12 +236,12 @@ void *M_realloc(void *ptr, size_t size,c
    return(0);
  }
  
@@ -8692,7 +8682,7 @@
    assert(ptr);
    for (i=1; i<=MAXMEM; i++) {
      if (mstack[i].ptr && ptr == mstack[i].ptr) {
-@@ -264,6 +264,26 @@
+@@ -264,6 +264,26 @@ void M_free(void *ptr) {
  #endif
  }
  
@@ -8719,7 +8709,7 @@
  
  /* dump memory requirements */
  void primem(int np) {
-@@ -273,12 +293,12 @@
+@@ -273,12 +293,12 @@ void primem(int np) {
    if ( memsize ) {
      fprintf(stdout,"\n  -- MEMORY REQUIREMENTS\n");
      if (memsize > 1024*1024)
@@ -8735,11 +8725,11 @@
      fprintf(stdout,"    (i.e. %d bytes/point)\n",memsize / np);
    }
  }
-Index: contrib/mmg3d/build/sources/memory.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/memory.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/memory.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/memory.h	(working copy)
-@@ -22,7 +22,6 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/memory.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/memory.h
+@@ -22,7 +22,6 @@ Reportez-vous à la licence publique gé
  Vous devez avoir reçu une copie de la licence publique générale de GNU
  en même temps que ce document.
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
@@ -8747,7 +8737,7 @@
  /****************************************************************************
  Initial software: MMG3D Version 4.0
  Co-authors: Cecile Dobrzynski et Pascal Frey.
-@@ -51,16 +50,16 @@
+@@ -51,16 +50,16 @@ extern "C" {
  #include <stdlib.h>
  #include <assert.h>
  
@@ -8756,16 +8746,17 @@
 -void  *M_calloc(size_t nelem,size_t elsize,char *call);
 -void  *M_realloc(void *ptr, size_t size,char *call);
 -void   M_free(void *ptr);
+-
+-/* ptototypes : tools */
+-int    M_memLeak();
+-void   M_memDump();
+-size_t M_memSize();
 +  /* prototype (re)definitions */
 +  void  *M_malloc(size_t size,char *call);
 +  void  *M_calloc(size_t nelem,size_t elsize,char *call);
 +  void  *M_realloc(void *ptr, size_t size,char *call);
 +  void   M_free(void *ptr);
- 
--/* ptototypes : tools */
--int    M_memLeak();
--void   M_memDump();
--size_t M_memSize();
++
 +  /* ptototypes : tools */
 +  int    M_memLeak();
 +  void   M_memDump();
@@ -8773,17 +8764,17 @@
  
  
  #ifdef __cplusplus
-Index: contrib/mmg3d/build/sources/mesh.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mesh.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/mesh.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/mesh.h	(working copy)
-@@ -54,18 +54,18 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/mesh.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mesh.h
+@@ -54,18 +54,18 @@ along with MMG3D. If not, see <http://ww
  #include <ctype.h>
  #include <math.h>
  #include <float.h>
+-
 +#include <limits.h>
  
--
  #include "chrono.h"
  #include "memory.h"
  
@@ -8802,27 +8793,26 @@
  #define M_STR "&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"
  
  #define EPS      1.e-06
-@@ -107,17 +107,10 @@
+@@ -107,16 +107,9 @@ along with MMG3D. If not, see <http://ww
  #define M_RIDGE_REF (1 << 7)
  #define ALL_BDRY   63
  
 -/*#ifdef INT_MAX
 -#undef INT_MAX
 -#undef SHORT_MAX
+-#endif
+-*/
+-#ifndef INT_MAX
+-#define INT_MAX      0x7fffffff
 +#ifndef M_PI
 +#define M_PI            3.14159265358979323846   /**< pi   */
  #endif
--*/
--#ifndef INT_MAX
--#define INT_MAX      0x7fffffff
--#endif
 -#define SHORT_MAX    0x7fff
- 
 -
+ 
  extern unsigned char MMG_idir[4][3];
  extern unsigned char MMG_inxt[7];
- extern unsigned char MMG_iarf[4][3];
-@@ -171,15 +164,19 @@
+@@ -171,15 +164,19 @@ typedef Bucket * pBucket;
  int MMG_setfunc(int );
  
  int MMG_cutprism(pMesh mesh,pHedge hed,int k,int p0,int p1,int p2,int p3,int p4,int p5,int ref);
@@ -8844,7 +8834,7 @@
  
  int MMG_interp_ani(double *,double *,double *,double );
  int MMG_interplog(double *,double *,double *,double *,double );
-@@ -207,8 +204,10 @@
+@@ -207,8 +204,10 @@ int MMG_pattern41(pMesh ,pSol ,pHedge ,i
  
  int MMG_colpoi(pMesh ,pSol ,int ,int ,int ,double );
  
@@ -8855,7 +8845,7 @@
  int  MMG_hashEdge(pMesh ,pHedge ,int ,int ,int *);
  int  MMG_inEdge(pHedge ,int *,int *,int *);
  int  MMG_markBdry(pMesh );
-@@ -225,6 +224,7 @@
+@@ -225,6 +224,7 @@ int  MMG_scaleMesh(pMesh ,pSol );
  int  MMG_unscaleMesh(pMesh ,pSol );
  
  int  MMG_mmg3d1(pMesh ,pSol ,int *);
@@ -8863,7 +8853,7 @@
  int  MMG_mmg3d9(pMesh ,pSol ,int *);
  int  MMG_mmg3d4(pMesh ,pSol ,int *);
  
-@@ -241,9 +241,10 @@
+@@ -241,9 +241,10 @@ int  MMG_zaldy3(pSol );
  int  MMG_zaldy4(pHedge ,int );
  
  int  MMG_optra4(pMesh ,pSol );
@@ -8875,7 +8865,7 @@
  int  MMG_optbdry(pMesh ,pSol ,int );
  int  MMG_opt2peau(pMesh ,pSol ,pQueue ,int ,double );
  int  MMG_optlap(pMesh ,pSol );
-@@ -330,15 +331,21 @@
+@@ -330,15 +331,21 @@ int MMG_swap710_42(pMesh ,pSol ,pList );
  int  MMG_typelt(pMesh ,int ,int *);
  
  /* quality */
@@ -8897,7 +8887,7 @@
  
  /* bucket */
  pBucket MMG_newBucket(pMesh ,int );
-@@ -368,6 +375,7 @@
+@@ -368,6 +375,7 @@ double MMG_calte3_ani(pMesh mesh,pSol so
  
  /* function pointers */
  double MMG_long_ani(double *,double *,double *,double *);
@@ -8905,7 +8895,7 @@
  double MMG_long_iso(double *,double *,double *,double *);
  double MMG_caltetcubic(pMesh mesh,pSol sol,int iel);
  double MMG_caltetrao(pMesh mesh,pSol sol,int iel);
-@@ -380,6 +388,7 @@
+@@ -380,6 +388,7 @@ int    MMG_caltet2_iso(pMesh mesh,pSol s
  int    MMG_caltet2_ani(pMesh mesh,pSol sol,int iel,int ie,double ,double * caltab);
  int    MMG_caltet2long_ani(pMesh mesh,pSol sol,int iel,int ie,double crit, double * caltab);
  int    MMG_caltet2long_iso(pMesh mesh,pSol sol,int iel,int ie,double crit, double * caltab);
@@ -8913,7 +8903,7 @@
  int    MMG_buckin_ani(pMesh mesh,pSol sol,pBucket bucket,int ip);
  int    MMG_buckin_iso(pMesh mesh,pSol sol,pBucket bucket,int ip);
  int    MMG_cavity_ani(pMesh mesh,pSol sol,int iel,int ip,pList list,int lon);
-@@ -392,10 +401,10 @@
+@@ -392,10 +401,10 @@ int    MMG_interp_ani(double *,double *,
  int    MMG_interp_iso(double *,double *,double * ,double );
  int    MMG_optlentet_ani(pMesh ,pSol ,pQueue ,double ,int ,int );
  int    MMG_optlentet_iso(pMesh ,pSol ,pQueue ,double ,int ,int );
@@ -8925,11 +8915,11 @@
  /* function pointers */
  typedef int (*MMG_Swap)(pMesh ,pSol ,pList );
  MMG_Swap MMG_swpptr;
-Index: contrib/mmg3d/build/sources/mmg3d.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/mmg3d.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/mmg3d.c	(working copy)
-@@ -43,7 +43,6 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/mmg3d.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d.c
+@@ -43,21 +43,19 @@ GNU General Public License for more deta
  You should have received a copy of the GNU General Public License
  along with MMG3D. If not, see <http://www.gnu.org/licenses/>.  
  ****************************************************************************/
@@ -8937,7 +8927,6 @@
  #include "mesh.h"
  #include "eigenv.h"
  
-@@ -50,14 +49,13 @@
  TIM_mytime         MMG_ctim[TIMEMAX];
  short	             MMG_imprim;
  
@@ -8959,7 +8948,7 @@
  static void excfun(int sigid) {
    switch (sigid) {
    case SIGFPE:
-@@ -101,6 +99,7 @@
+@@ -101,6 +99,7 @@ static void usage(char *prog) {
    fprintf(stdout,"-noswap        no edge or face flipping\n");
    fprintf(stdout,"-nomove        no point relocation\n");
    fprintf(stdout,"-noinsert      no new point\n");
@@ -8967,7 +8956,7 @@
    //fprintf(stdout,"-bdry          add points on boundary mesh\n");
    fprintf(stdout,"-out fileout   Specify output file name\n");  
  #ifdef USE_SCOTCH
-@@ -112,13 +111,11 @@
+@@ -112,46 +111,44 @@ static void usage(char *prog) {
  }
  
  
@@ -8982,7 +8971,6 @@
    i = 1;
    while ( i < argc ) {
      if ( *argv[i] == '-' ) {
-@@ -125,33 +122,33 @@
        switch(argv[i][1]) {
        case 'h':  /* on-line help */
        case '?':
@@ -9034,7 +9022,7 @@
          }
          break;
  
-@@ -159,7 +156,7 @@
+@@ -159,7 +156,7 @@ static int parsar(int argc,char *argv[],
          if ( !strcmp(argv[i],"-in") ) {
            ++i;
            mesh->name = argv[i];
@@ -9043,7 +9031,7 @@
          }
          break;
  
-@@ -170,7 +167,7 @@
+@@ -170,7 +167,7 @@ static int parsar(int argc,char *argv[],
          }
          else if ( ++i < argc ) {
  	  if ( isdigit(argv[i][0]) )
@@ -9052,7 +9040,7 @@
  	  else
  	    i--;
  	}
-@@ -182,11 +179,11 @@
+@@ -182,27 +179,29 @@ static int parsar(int argc,char *argv[],
  
        case 'n':
          if ( !strcmp(argv[i],"-noswap") )
@@ -9067,7 +9055,6 @@
          break;
  
        case 'o':
-@@ -193,16 +190,18 @@
          if ( !strcmp(argv[i],"-out") ) {
            ++i;
            mesh->outf = argv[i];
@@ -9090,7 +9077,7 @@
  	  else
  	    i--;
  	}
-@@ -215,12 +214,12 @@
+@@ -215,20 +214,20 @@ static int parsar(int argc,char *argv[],
          }
          break; 
  #ifdef USE_SCOTCH
@@ -9105,7 +9092,6 @@
              else {
                fprintf(stderr,"Missing argument option %s\n",argv[i-1]);
                usage(argv[0]);
-@@ -227,8 +226,8 @@
              }
              if ( ++i < argc ) {
                if ( isdigit(argv[i][0]) ) {
@@ -9116,7 +9102,7 @@
                    fprintf(stderr,"Wrong argument option %s\n",argv[i-1]);
                    usage(argv[0]);
                  }
-@@ -249,12 +248,12 @@
+@@ -249,12 +248,12 @@ static int parsar(int argc,char *argv[],
            }
          }
          break;
@@ -9131,7 +9117,7 @@
  	  else 
  	    i--;
  	}
-@@ -273,7 +272,7 @@
+@@ -273,7 +272,7 @@ static int parsar(int argc,char *argv[],
      else {
        if ( mesh->name == NULL ) {
          mesh->name = argv[i];
@@ -9140,7 +9126,7 @@
        }
        else if ( mesh->outf == NULL )
          mesh->outf = argv[i];
-@@ -281,7 +280,7 @@
+@@ -281,18 +280,18 @@ static int parsar(int argc,char *argv[],
          mesh->move = argv[i];
        else {
          fprintf(stdout,"  Argument %s ignored\n",argv[i]);
@@ -9149,7 +9135,6 @@
        }
      }
      i++;
-@@ -288,11 +287,11 @@
    }
  
    /* check file names */
@@ -9163,7 +9148,7 @@
    }
  
    if ( mesh->name == NULL ) {
-@@ -315,7 +314,7 @@
+@@ -315,7 +314,7 @@ static int parsar(int argc,char *argv[],
      if ( ptr ) *ptr = '\0';
      strcat(mesh->outf,".o.meshb");
    }
@@ -9172,7 +9157,7 @@
      mesh->move = (char *)calloc(128,sizeof(char));
      assert(mesh->move);
      fprintf(stdout,"  -- DISPLACEMENT FILE ?\n");
-@@ -348,20 +347,20 @@
+@@ -348,20 +347,20 @@ int parsop(pMesh mesh) {
      ret = fscanf(in,"%s",data);
      if ( !ret || feof(in) )  break;
      for (i=0; i<strlen(data); i++) data[i] = tolower(data[i]);
@@ -9204,7 +9189,7 @@
      fprintf(stderr,"  ** UNKNOWN KEYWORD %s\n",data);
    }
    fclose(in);
-@@ -398,304 +397,334 @@
+@@ -398,304 +397,334 @@ void endcod() {
  }
  
  
@@ -9240,6 +9225,53 @@
 -  }
 -  return(1);
 -}
+-
+-/* /\* /\\* *\/ */
+-/* /\* int main(int argc,char *argv[]) { *\/ */
+-/* /\*   pMesh      	mesh; *\/ */
+-/* /\*   pSol       	sol; *\/ */
+-/* /\*   Info     	*info; *\/ */
+-/* /\*   int        	alert; *\/ */
+-/* /\* int k,iadr,i,jj,kk,ii; *\/ */
+-/* /\* double	lambda[3],v[3][3],*mold,*m; *\/ */
+-
+-/* /\*   fprintf(stdout,"  -- MMG3d, Release %s (%s) \n",M_VER,M_REL); *\/ */
+-/* /\*   fprintf(stdout,"     Copyright (c) LJLL/IMB, 2010\n"); *\/ */
+-/* /\*   fprintf(stdout,"    %s\n",COMPIL); *\/ */
+-
+-/* /\*   signal(SIGABRT,excfun); *\/ */
+-/* /\*   signal(SIGFPE,excfun); *\/ */
+-/* /\*   signal(SIGILL,excfun); *\/ */
+-/* /\*   signal(SIGSEGV,excfun); *\/ */
+-/* /\*   signal(SIGTERM,excfun); *\/ */
+-/* /\*   signal(SIGINT,excfun); *\/ */
+-/* /\*   atexit(endcod); *\/ */
+-
+-/* /\*   TIM_tminit(MMG_ctim,TIMEMAX); *\/ */
+-/* /\*   TIM_chrono(ON,&MMG_ctim[0]); *\/ */
+-
+-/* /\*   mesh = (pMesh)M_calloc(1,sizeof(Mesh),"main"); *\/ */
+-/* /\*   assert(mesh); *\/ */
+-/* /\*   sol  = (pSol)M_calloc(1,sizeof(Sol),"main"); *\/ */
+-/* /\*   assert(sol); *\/ */
+-/* /\*   sol->offset = 1; *\/ */
+-
+-
+-/* /\*   info = &mesh->info; *\/ */
+-
+-/* /\*   info->imprim   = -99; *\/ */
+-/* /\*   info->memory   = -1; *\/ */
+-/* /\*   info->ddebug   = 0; *\/ */
+-/* /\*   info->rn2      = 3; *\/ */
+-/* /\*   info->rn       = 500; *\/ */
+-/* /\*   info->option   = 1; *\/ */
+-/* /\*   alert          = 0; *\/ */
+-/* /\*   info->bucksiz  = 0; *\/ */
+-/* /\*   info->noswap   = 0; *\/ */
+-/* /\*   info->nomove   = 0; *\/ */
+-/* /\*   info->noinsert = 0;  *\/ */
+-/* /\*   info->dt       = 1.; *\/ */
+-/* /\*   info->bdry     = 0; *\/ */
 +/* /\* set function pointers *\/ */
 +/* int MMG_setfunc(int type) { */
 +/*   if ( type == 6 ) { */
@@ -9272,19 +9304,8 @@
 +/*   } */
 +/*   return(1); */
 +/* } */
- 
--/* /\* /\\* *\/ */
--/* /\* int main(int argc,char *argv[]) { *\/ */
--/* /\*   pMesh      	mesh; *\/ */
--/* /\*   pSol       	sol; *\/ */
--/* /\*   Info     	*info; *\/ */
--/* /\*   int        	alert; *\/ */
--/* /\* int k,iadr,i,jj,kk,ii; *\/ */
--/* /\* double	lambda[3],v[3][3],*mold,*m; *\/ */
- 
--/* /\*   fprintf(stdout,"  -- MMG3d, Release %s (%s) \n",M_VER,M_REL); *\/ */
--/* /\*   fprintf(stdout,"     Copyright (c) LJLL/IMB, 2010\n"); *\/ */
--/* /\*   fprintf(stdout,"    %s\n",COMPIL); *\/ */
++
++
 +/* int main(int argc,char *argv[]) { */
 +/*   pMesh      	mesh; */
 +/*   pSol       	sol; */
@@ -9296,14 +9317,7 @@
 +/*   fprintf(stdout,"  -- MMG3d, Release %s (%s) \n",M_VER,M_REL); */
 +/*   fprintf(stdout,"     Copyright (c) LJLL/IMB, 2010\n"); */
 +/*   fprintf(stdout,"    %s %s\n",__DATE__,__TIME__); */
- 
--/* /\*   signal(SIGABRT,excfun); *\/ */
--/* /\*   signal(SIGFPE,excfun); *\/ */
--/* /\*   signal(SIGILL,excfun); *\/ */
--/* /\*   signal(SIGSEGV,excfun); *\/ */
--/* /\*   signal(SIGTERM,excfun); *\/ */
--/* /\*   signal(SIGINT,excfun); *\/ */
--/* /\*   atexit(endcod); *\/ */
++
 +/*   signal(SIGABRT,excfun); */
 +/*   signal(SIGFPE,excfun); */
 +/*   signal(SIGILL,excfun); */
@@ -9311,27 +9325,19 @@
 +/*   signal(SIGTERM,excfun); */
 +/*   signal(SIGINT,excfun); */
 +/*   atexit(endcod); */
- 
--/* /\*   TIM_tminit(MMG_ctim,TIMEMAX); *\/ */
--/* /\*   TIM_chrono(ON,&MMG_ctim[0]); *\/ */
++
 +/*   TIM_tminit(MMG_ctim,TIMEMAX); */
 +/*   TIM_chrono(ON,&MMG_ctim[0]); */
- 
--/* /\*   mesh = (pMesh)M_calloc(1,sizeof(Mesh),"main"); *\/ */
--/* /\*   assert(mesh); *\/ */
--/* /\*   sol  = (pSol)M_calloc(1,sizeof(Sol),"main"); *\/ */
--/* /\*   assert(sol); *\/ */
--/* /\*   sol->offset = 1; *\/ */
++
 +/*   mesh = (pMesh)M_calloc(1,sizeof(Mesh),"main"); */
 +/*   assert(mesh); */
 +/*   sol  = (pSol)M_calloc(1,sizeof(Sol),"main"); */
 +/*   assert(sol); */
 +/*   sol->offset = 1; */
- 
++
 +/*   /\* default values *\/ */
 +/*   info = &mesh->info; */
- 
--/* /\*   info = &mesh->info; *\/ */
++
 +/*   opt[6]   = -99; */
 +/*   optbin[1]   = -1; */
 +/*   opt[1]   = 0; */
@@ -9346,24 +9352,9 @@
 +/*   optbin[0]       = 1.; */
 +/*   info->bdry     = 0; */
 +/*   opt[9]   = 0; */
- 
--/* /\*   info->imprim   = -99; *\/ */
--/* /\*   info->memory   = -1; *\/ */
--/* /\*   info->ddebug   = 0; *\/ */
--/* /\*   info->rn2      = 3; *\/ */
--/* /\*   info->rn       = 500; *\/ */
--/* /\*   info->option   = 1; *\/ */
--/* /\*   alert          = 0; *\/ */
--/* /\*   info->bucksiz  = 0; *\/ */
--/* /\*   info->noswap   = 0; *\/ */
--/* /\*   info->nomove   = 0; *\/ */
--/* /\*   info->noinsert = 0;  *\/ */
--/* /\*   info->dt       = 1.; *\/ */
--/* /\*   info->bdry     = 0; *\/ */
++
 +/*   if ( !parsar(argc,argv,mesh,sol,opt,optbin) )  return(1); */
- 
--/* /\*   if ( !parsar(argc,argv,mesh,sol) )  return(1); *\/ */
--/* /\*   MMG_imprim = info->imprim; *\/ */
++
 +/*   info->imprim   = opt[6]; */
 +/*   info->memory   = optbin[1]; */
 +/*   info->ddebug   = opt[1]; */
@@ -9378,9 +9369,31 @@
 +/*   info->dt       = optbin[0]; */
 +/*   info->bdry     = 0; */
 +/*   info->optles = opt[9]; //0 pour etre dans le cas normal, 1 pour optim les */
-+
+ 
+-/* /\*   if ( !parsar(argc,argv,mesh,sol) )  return(1); *\/ */
+-/* /\*   MMG_imprim = info->imprim; *\/ */
 +/*   MMG_imprim = info->imprim; */
    
+-
+-/* /\*   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); *\/ */
+-/* /\*   if ( sol->np && sol->np != mesh->np ) { *\/ */
+-/* /\*     fprintf(stdout,"  ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n"); *\/ */
+-/* /\*     sol->np = 0; *\/ */
+-/* /\*   } *\/ */
+-
+-/* /\*   if ( !parsop(mesh) )  return(1); *\/ */
+-
+-/* /\*   if ( abs(info->option) == 9 && !MMG_loadVect(mesh,mesh->move,mesh->np) )  return(0); *\/ */
+-
+-/* /\*   if ( !MMG_setfunc(sol->offset) ) return(1); *\/ */
+-/* /\*   if ( !MMG_scaleMesh(mesh,sol) )  return(1); *\/ */
+-/* /\*   TIM_chrono(OFF,&MMG_ctim[1]); *\/ */
+-/* /\*   if ( MMG_imprim ) *\/ */
+-/* /\*     fprintf(stdout,"  -- DATA READING COMPLETED.     %.2f sec.\n", *\/ */
+-/* /\*             TIM_gttime(MMG_ctim[1])); *\/ */
 +/*   /\* load data *\/ */
 +/*   if ( MMG_imprim )   fprintf(stdout,"\n  -- INPUT DATA\n"); */
 +/*   TIM_chrono(ON,&MMG_ctim[1]); */
@@ -9390,30 +9403,14 @@
 +/*     fprintf(stdout,"  ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n"); */
 +/*     sol->np = 0; */
 +/*   } */
- 
--/* /\*   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); *\/ */
--/* /\*   if ( sol->np && sol->np != mesh->np ) { *\/ */
--/* /\*     fprintf(stdout,"  ## WARNING: WRONG SOLUTION NUMBER. IGNORED\n"); *\/ */
--/* /\*     sol->np = 0; *\/ */
--/* /\*   } *\/ */
++
 +/*   if ( !parsop(mesh) )  return(1); */
- 
--/* /\*   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) )  return(0); *\/ */
++
 +/*   if ( !MMG_setfunc(sol->offset) ) return(1); */
 +/*   if ( !MMG_scaleMesh(mesh,sol) )  return(1);    */
- 
--/* /\*   if ( !MMG_setfunc(sol->offset) ) return(1); *\/ */
--/* /\*   if ( !MMG_scaleMesh(mesh,sol) )  return(1); *\/ */
--/* /\*   TIM_chrono(OFF,&MMG_ctim[1]); *\/ */
--/* /\*   if ( MMG_imprim ) *\/ */
--/* /\*     fprintf(stdout,"  -- DATA READING COMPLETED.     %.2f sec.\n", *\/ */
--/* /\*             TIM_gttime(MMG_ctim[1])); *\/ */
++
 +/*   TIM_chrono(OFF,&MMG_ctim[1]); */
 +/*   if ( MMG_imprim ) */
 +/*     fprintf(stdout,"  -- DATA READING COMPLETED.     %.2f sec.\n", */
@@ -9427,6 +9424,29 @@
 -/* /\*     } *\/ */
 -/* /\*     if(MMG_imprim < 0) MMG_outquacubic(mesh,sol); *\/ */
 -/* /\*   } *\/ */
+-
+-/* /\*   fprintf(stdout,"\n  %s\n   MODULE MMG3D-LJLL/IMB : %s (%s)  %s\n  %s\n", *\/ */
+-/* /\*           M_STR,M_VER,M_REL,sol->offset == 1 ? "ISO" : "ANISO",M_STR); *\/ */
+-/* /\*   fprintf(stdout,"  MAXIMUM NUMBER OF POINTS    (NPMAX) : %8d\n",mesh->npmax); *\/ */
+-/* /\*   fprintf(stdout,"  MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8d\n",mesh->ntmax); *\/ */
+-/* /\*   fprintf(stdout,"  MAXIMUM NUMBER OF ELEMENTS  (NEMAX) : %8d\n",mesh->nemax); *\/ */
+-
+-
+-/* /\*   TIM_chrono(ON,&MMG_ctim[2]); *\/ */
+-/* /\*   if ( MMG_imprim )   fprintf(stdout,"\n  -- PHASE 1 : ANALYSIS\n"); *\/ */
+-/* /\*   if ( !MMG_hashTetra(mesh) )    return(1); *\/ */
+-/* /\*   if ( !MMG_markBdry(mesh) )     return(1); *\/ */
+-/* /\*   if (abs(mesh->info.option)==10) { *\/ */
+-/* /\*     MMG_saveMesh(mesh,"tetra.mesh"); *\/ */
+-/* /\*     return(0); *\/ */
+-/* /\*   }            *\/ */
+-
+-
+-/* /\*   if ( !sol->np  &&  !MMG_doSol(mesh,sol) )  return(1); *\/ */
+-/* /\*   TIM_chrono(OFF,&MMG_ctim[2]); *\/ */
+-/* /\*   if ( MMG_imprim ) *\/ */
+-/* /\*     fprintf(stdout,"  -- PHASE 1 COMPLETED.     %.2f sec.\n", *\/ */
+-/* /\*             TIM_gttime(MMG_ctim[2])); *\/ */
 +/*   if ( abs(MMG_imprim) > 3 )  { */
 +/*     alert = MMG_outqua(mesh,sol); */
 +/*     if(alert) { */
@@ -9436,18 +9456,13 @@
 +/*     if(mesh->info.optles) MMG_outquaLES(mesh,sol); */
 +/*     if(MMG_imprim < 0) MMG_outquacubic(mesh,sol); */
 +/*   } */
- 
--/* /\*   fprintf(stdout,"\n  %s\n   MODULE MMG3D-LJLL/IMB : %s (%s)  %s\n  %s\n", *\/ */
--/* /\*           M_STR,M_VER,M_REL,sol->offset == 1 ? "ISO" : "ANISO",M_STR); *\/ */
--/* /\*   fprintf(stdout,"  MAXIMUM NUMBER OF POINTS    (NPMAX) : %8d\n",mesh->npmax); *\/ */
--/* /\*   fprintf(stdout,"  MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8d\n",mesh->ntmax); *\/ */
--/* /\*   fprintf(stdout,"  MAXIMUM NUMBER OF ELEMENTS  (NEMAX) : %8d\n",mesh->nemax); *\/ */
++
 +/*   fprintf(stdout,"\n  %s\n   MODULE MMG3D-LJLL/IMB : %s (%s)  %s\n  %s\n", */
 +/*           M_STR,M_VER,M_REL,sol->offset == 1 ? "ISO" : "ANISO",M_STR); */
 +/*   fprintf(stdout,"  MAXIMUM NUMBER OF POINTS    (NPMAX) : %8d\n",mesh->npmax); */
 +/*   fprintf(stdout,"  MAXIMUM NUMBER OF TRIANGLES (NTMAX) : %8d\n",mesh->ntmax); */
 +/*   fprintf(stdout,"  MAXIMUM NUMBER OF ELEMENTS  (NEMAX) : %8d\n",mesh->nemax); */
- 
++
 +/*   /\* mesh analysis *\/ */
 +/*   TIM_chrono(ON,&MMG_ctim[2]); */
 +/*   if ( MMG_imprim )   fprintf(stdout,"\n  -- PHASE 1 : ANALYSIS\n");   */
@@ -9457,28 +9472,14 @@
 +/*     MMG_saveMesh(mesh,"tetra.mesh"); */
 +/*     return(0); */
 +/*   }            */
- 
--/* /\*   TIM_chrono(ON,&MMG_ctim[2]); *\/ */
--/* /\*   if ( MMG_imprim )   fprintf(stdout,"\n  -- PHASE 1 : ANALYSIS\n"); *\/ */
--/* /\*   if ( !MMG_hashTetra(mesh) )    return(1); *\/ */
--/* /\*   if ( !MMG_markBdry(mesh) )     return(1); *\/ */
--/* /\*   if (abs(mesh->info.option)==10) { *\/ */
--/* /\*     MMG_saveMesh(mesh,"tetra.mesh"); *\/ */
--/* /\*     return(0); *\/ */
--/* /\*   }            *\/ */
- 
++
++
 +/*   if ( !sol->np  &&  !MMG_doSol(mesh,sol) )  return(1); */
 +/*   TIM_chrono(OFF,&MMG_ctim[2]); */
 +/*   if ( MMG_imprim ) */
 +/*     fprintf(stdout,"  -- PHASE 1 COMPLETED.     %.2f sec.\n", */
 +/*             TIM_gttime(MMG_ctim[2])); */
  
--/* /\*   if ( !sol->np  &&  !MMG_doSol(mesh,sol) )  return(1); *\/ */
--/* /\*   TIM_chrono(OFF,&MMG_ctim[2]); *\/ */
--/* /\*   if ( MMG_imprim ) *\/ */
--/* /\*     fprintf(stdout,"  -- PHASE 1 COMPLETED.     %.2f sec.\n", *\/ */
--/* /\*             TIM_gttime(MMG_ctim[2])); *\/ */
--
 -/* /\*   if ( info->ddebug )  MMG_chkmsh(mesh,1,1); *\/ */
 +/*   if ( info->ddebug )  MMG_chkmsh(mesh,1,1); */
    
@@ -9500,15 +9501,7 @@
 -/* /\*      if ( MMG_imprim < -6) *\/ */
 -/* /\*        fprintf(stdout,"renumbering"); *\/ */
 -/* /\*      renumbering(info->rn, mesh, sol);   *\/ */
-+/* #ifdef USE_SCOTCH */
-+/*   /\* renumbering begin *\/ */
-+/*   /\*check enough vertex to renum*\/  */
-+/*   if ( (info->rn2 & 1) && (mesh->np/2. > info->rn)) {  */
-+/*     TIM_chrono(ON,&MMG_ctim[5]);  */
-+/*     if ( MMG_imprim < -6) */
-+/*       fprintf(stdout,"renumbering"); */
-+/*     renumbering(info->rn, mesh, sol);   */
-     
+-    
 -/* /\*      if ( !MMG_hashTetra(mesh) )    return(1);     *\/ */
 -/* /\*      TIM_chrono(OFF,&MMG_ctim[5]);  *\/ */
 -/* /\*      if ( MMG_imprim < -6) *\/ */
@@ -9552,7 +9545,15 @@
 -/* /\*          } *\/ */
 -/* /\*       } *\/ */
 -/* /\*     }  *\/ */
--    
++/* #ifdef USE_SCOTCH */
++/*   /\* renumbering begin *\/ */
++/*   /\*check enough vertex to renum*\/  */
++/*   if ( (info->rn2 & 1) && (mesh->np/2. > info->rn)) {  */
++/*     TIM_chrono(ON,&MMG_ctim[5]);  */
++/*     if ( MMG_imprim < -6) */
++/*       fprintf(stdout,"renumbering"); */
++/*     renumbering(info->rn, mesh, sol);   */
+     
 -/* /\*     if(!info->noinsert) { *\/ */
 -/* /\*       if(abs(info->option) == 4){ *\/ */
 -/* /\*         MMG_mmg3d4(mesh,sol,&alert); *\/ */
@@ -9713,6 +9714,48 @@
 -/* /\* 	mesh->tetra[k].qual = MMG_caltet(mesh,sol,k);   *\/ */
 -/* /\* } *\\/ *\/ */
 -/* /\* /////////////////////////////////////   *\/ */
+-
+-/* /\*   if ( info->option > -1 || abs(MMG_imprim) > 3 ) { *\/ */
+-/* /\*     MMG_outqua(mesh,sol); *\/ */
+-/* /\*     if(MMG_imprim < 0) MMG_outquacubic(mesh,sol); *\/ */
+-/* /\*     MMG_prilen(mesh,sol); *\/ */
+-/* /\*     MMG_ratio(mesh,sol,NULL); *\/ */
+-/* /\*   } *\/ */
+-/* /\*   fprintf(stdout,"\n  %s\n   END OF MODULE MMG3D \n  %s\n",M_STR,M_STR); *\/ */
+-/* /\*   if ( alert ) *\/ */
+-/* /\*     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); *\/ */
+-/* /\*   TIM_chrono(ON,&MMG_ctim[1]); *\/ */
+-/* /\*   if ( !MMG_unscaleMesh(mesh,sol) )  return(1); *\/ */
+-/* /\*   MMG_saveMesh(mesh,mesh->outf); *\/ */
+-/* /\*   if ( info->option == 9 ) { *\/ */
+-/* /\*     MMG_saveSol(mesh,sol,mesh->outf); *\/ */
+-/* /\*     MMG_saveVect(mesh,mesh->move);     *\/ */
+-/* /\*   } *\/ */
+-/* /\*   else *\/ */
+-/* /\*     MMG_saveSol(mesh,sol,mesh->outf); *\/ */
+-/* /\*   TIM_chrono(OFF,&MMG_ctim[1]); *\/ */
+-/* /\*   if ( MMG_imprim )  fprintf(stdout,"  -- WRITING COMPLETED\n"); *\/ */
+-
+-/* /\*   /\\* free mem *\\/ *\/ */
+-/* /\*   M_free(mesh->point); *\/ */
+-/* /\*   M_free(mesh->tria); *\/ */
+-/* /\*   M_free(mesh->tetra); *\/ */
+-/* /\*   /\\*la desallocation de ce pointeur plante dans certains cas...*\\/ *\/ */
+-/* /\*   M_free(mesh->adja); *\/ */
+-/* /\*   M_free(mesh->disp->alpha); *\/ */
+-/* /\*   M_free(mesh->disp->mv); *\/ */
+-/* /\*   M_free(mesh->disp); *\/ */
+-
+-/* /\*   if ( sol->npfixe )  M_free(sol->met); *\/ */
+-/* /\*   M_free(sol); *\/ */
+-
+-/* /\*   if ( MMG_imprim < -4 || info->ddebug )  M_memDump(); *\/ */
+-/* /\*   M_free(mesh); *\/ */
+-/* /\*   return(0); *\/ */
+-/* /\* } *\/ */
 +/*     if ( info->ddebug )  MMG_chkmsh(mesh,1,1); */
 +/*     TIM_chrono(OFF,&MMG_ctim[4]); */
 +/*     if ( MMG_imprim ) */
@@ -9725,17 +9768,7 @@
 +/*     mesh->tetra[k].qual = MMG_caltet(mesh,sol,k);   */
 +/*     } *\/ */
 +/*   /////////////////////////////////////   */
- 
--/* /\*   if ( info->option > -1 || abs(MMG_imprim) > 3 ) { *\/ */
--/* /\*     MMG_outqua(mesh,sol); *\/ */
--/* /\*     if(MMG_imprim < 0) MMG_outquacubic(mesh,sol); *\/ */
--/* /\*     MMG_prilen(mesh,sol); *\/ */
--/* /\*     MMG_ratio(mesh,sol,NULL); *\/ */
--/* /\*   } *\/ */
--/* /\*   fprintf(stdout,"\n  %s\n   END OF MODULE MMG3D \n  %s\n",M_STR,M_STR); *\/ */
--/* /\*   if ( alert ) *\/ */
--/* /\*     fprintf(stdout,"\n  ## WARNING: INCOMPLETE MESH  %d , %d\n", *\/ */
--/* /\*             mesh->np,mesh->ne); *\/ */
++
 +/*   if ( info->option > -1 || abs(MMG_imprim) > 3 ) { */
 +/*     MMG_outqua(mesh,sol); */
 +/*     if(mesh->info.optles) MMG_outquaLES(mesh,sol); */
@@ -9748,19 +9781,7 @@
 +/*   if ( alert ) */
 +/*     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); *\/ */
--/* /\*   TIM_chrono(ON,&MMG_ctim[1]); *\/ */
--/* /\*   if ( !MMG_unscaleMesh(mesh,sol) )  return(1); *\/ */
--/* /\*   MMG_saveMesh(mesh,mesh->outf); *\/ */
--/* /\*   if ( info->option == 9 ) { *\/ */
--/* /\*     MMG_saveSol(mesh,sol,mesh->outf); *\/ */
--/* /\*     MMG_saveVect(mesh,mesh->move);     *\/ */
--/* /\*   } *\/ */
--/* /\*   else *\/ */
--/* /\*     MMG_saveSol(mesh,sol,mesh->outf); *\/ */
--/* /\*   TIM_chrono(OFF,&MMG_ctim[1]); *\/ */
--/* /\*   if ( MMG_imprim )  fprintf(stdout,"  -- WRITING COMPLETED\n"); *\/ */
++
 +/*   if ( MMG_imprim )  fprintf(stdout,"\n  -- WRITING DATA FILE %s\n",mesh->outf); */
 +/*   TIM_chrono(ON,&MMG_ctim[1]); */
 +/*   if ( !MMG_unscaleMesh(mesh,sol) )  return(1); */
@@ -9777,16 +9798,7 @@
 +/*   if ( mesh->info.ddebug )  */
 +/*     fprintf(stdout,"\nIsoperimetric quotient: %lf\n", MMG_isoperimetric (mesh)); */
 +/* #endif */
- 
--/* /\*   /\\* free mem *\\/ *\/ */
--/* /\*   M_free(mesh->point); *\/ */
--/* /\*   M_free(mesh->tria); *\/ */
--/* /\*   M_free(mesh->tetra); *\/ */
--/* /\*   /\\*la desallocation de ce pointeur plante dans certains cas...*\\/ *\/ */
--/* /\*   M_free(mesh->adja); *\/ */
--/* /\*   M_free(mesh->disp->alpha); *\/ */
--/* /\*   M_free(mesh->disp->mv); *\/ */
--/* /\*   M_free(mesh->disp); *\/ */
++
 +/*   /\* free mem *\/ */
 +/*   M_free(mesh->point); */
 +/*   M_free(mesh->tria); */
@@ -9796,25 +9808,19 @@
 +/*   M_free(mesh->disp->alpha); */
 +/*   M_free(mesh->disp->mv); */
 +/*   M_free(mesh->disp); */
- 
--/* /\*   if ( sol->npfixe )  M_free(sol->met); *\/ */
--/* /\*   M_free(sol); *\/ */
++
 +/*   if ( sol->npfixe )  M_free(sol->met); */
 +/*   M_free(sol); */
- 
--/* /\*   if ( MMG_imprim < -4 || info->ddebug )  M_memDump(); *\/ */
--/* /\*   M_free(mesh); *\/ */
--/* /\*   return(0); *\/ */
--/* /\* } *\/ */
++
 +/*   if ( MMG_imprim < -4 || info->ddebug )  M_memDump(); */
 +/*   M_free(mesh); */
 +/*   return(0); */
 +/* } */
-Index: contrib/mmg3d/build/sources/mmg3d1.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d1.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/mmg3d1.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/mmg3d1.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/mmg3d1.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d1.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -9849,7 +9855,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -9860,7 +9865,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -9869,7 +9874,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -53,12 +53,12 @@
+@@ -53,12 +53,12 @@ int MMG_npuiss,MMG_nvol,MMG_npres,MMG_np
  int MMG_cendellong(pMesh mesh,pSol sol,double declic,int base);
  
  int MMG_mmg3d1(pMesh mesh,pSol sol,int *alert) {
@@ -9887,7 +9892,7 @@
  
    if ( abs(mesh->info.imprim) > 3 )
      fprintf(stdout,"  ** SIZE OPTIMIZATION\n");
-@@ -75,10 +75,10 @@
+@@ -75,10 +75,10 @@ int MMG_mmg3d1(pMesh mesh,pSol sol,int *
    nf  = 0;
    it  = 0;
    maxtou = 100;
@@ -9902,7 +9907,7 @@
  
    /* 2. field points */
    if ( mesh->info.imprim < -4 ) {
-@@ -88,13 +88,13 @@
+@@ -88,13 +88,13 @@ MMG_nvoltot=0;
    /* create filter */
    bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
    if ( !bucket )  return(0);
@@ -9919,7 +9924,7 @@
      nna += na;
      nnd += nd;
  
-@@ -102,83 +102,83 @@
+@@ -102,83 +102,83 @@ MMG_nvoltot=0;
        if ( nd < 1000 )  break;
        else  *alert = 0;
      }
@@ -9945,8 +9950,8 @@
 +      if ( ns < 0 ) {
 +      *alert = 1;
 +      ns    = -ns;
-       }
 +      }
+       }
        if ( mesh->info.imprim && ns )
 -        fprintf(stdout,"     %8d SWAPPED\n",ns);    
 -      //puts("on arrete la");exit(0); 
@@ -9979,12 +9984,12 @@
 +      q = ndold / (double) (na+1);
 +      if( q < 1.7 && q > 0.57) {
 +      break;
-       }
++      }
 +      q = naold / (double) (nd+1);
 +      if( q < 1.7 && q > 0.57) {
 +      break;
 +      }
-+      }
+       }
        q = ndold / (double) (na+1);
        if( q < 1.1 && q > 0.9) {
 -        break;
@@ -10054,11 +10059,11 @@
    if ( mesh->info.imprim < 0 ) {
      MMG_outqua(mesh,sol);
      MMG_prilen(mesh,sol);
-Index: contrib/mmg3d/build/sources/mmg3d4.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d4.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/mmg3d4.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/mmg3d4.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/mmg3d4.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d4.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -10093,7 +10098,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -10104,7 +10108,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -10113,7 +10117,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -55,10 +55,12 @@
+@@ -55,10 +55,12 @@ int ddebug;
  
  int MMG_mmg3d4(pMesh mesh,pSol sol,int *alert) {
    Hedge    hash;
@@ -10128,7 +10132,7 @@
    if ( abs(mesh->info.imprim) > 3 )
      fprintf(stdout,"  ** SIZE OPTIMIZATION\n");
    if ( mesh->info.imprim < 0 ) {
-@@ -71,60 +73,60 @@
+@@ -71,81 +73,82 @@ int MMG_mmg3d4(pMesh mesh,pSol sol,int *
    maxtou = 10;
    nna = nns = nnd = 0;
    it  = 0;
@@ -10155,16 +10159,17 @@
 -      MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);      
 -      if ( abs(mesh->info.imprim) > 5 ) 
 -        fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);  
+-
+-	    M_free(bucket->head);
+-	    M_free(bucket->link);
+-	    M_free(bucket);
+-        
 +      //MMG_saveMesh(mesh,"avtana.mesh");
 +      MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
 +      //MMG_saveMesh(mesh,"apresana.mesh");
 +      if ( abs(mesh->info.imprim) > 5 )
 +	fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);
- 
--	    M_free(bucket->head);
--	    M_free(bucket->link);
--	    M_free(bucket);
--        
++
 +      M_free(bucket->head);
 +      M_free(bucket->link);
 +      M_free(bucket);
@@ -10222,7 +10227,6 @@
      if ( nna /*|| it == (maxtou-1)*/ ) {
        mesh->nt = 0;
        if ( !MMG_hashTetra(mesh) )  return(0);
-@@ -131,11 +133,12 @@
        if ( !MMG_markBdry(mesh) )   return(0);
      }
      // printf("chkmsh\n");
@@ -10239,7 +10243,6 @@
        nns   =  MMG_cendel(mesh,sol,declic,base);
      }
  
-@@ -142,10 +145,10 @@
      /* deletion */
      /*if ( 0 && nna ) {
        nnd   = MMG_colvert(mesh,sol,base);
@@ -10252,7 +10255,7 @@
    }
    while ( na+nd+nns+nna+nnd > 0 && ++it < maxtou && lmoy > 1.3);
  
-@@ -158,80 +161,80 @@
+@@ -158,80 +161,80 @@ int MMG_mmg3d4(pMesh mesh,pSol sol,int *
      MMG_prilen(mesh,sol);
    }
  
@@ -10269,16 +10272,7 @@
 -    *alert = 0;
 +  base   = mesh->flag;
 +  *alert = 0;
- 
--    nna = 0;
--    nnd = 0;
--    nf  = 0;
--    it  = 0;
--    maxtou = 100;
--    MMG_npdtot=0;
--    MMG_npuisstot=0;
--    MMG_nprestot=0;
--    MMG_nvoltot=0;
++
 +  nna = 0;
 +  nnd = 0;
 +  nf  = 0;
@@ -10288,25 +10282,75 @@
 +  MMG_npuisstot=0;
 +  MMG_nprestot=0;
 +  MMG_nvoltot=0;
++
++  /* 2. field points */
++  if ( mesh->info.imprim < -4 ) {
++    MMG_prilen(mesh,sol);
++    fprintf(stdout,"  -- FIELD POINTS\n");
++  }
++
++  /* create filter */
++  bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
++  if ( !bucket )  return(0);
++
++  do {
++    MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
++    nna += na;
++    nnd += nd;
++    if ( *alert ) {
++      if ( nd < 1000 )  break;
++      else  *alert = 0;
++    }
++    if ( it > 5 ) {
++      dd = abs(nd-na);
++      if ( dd < 5 || dd < 0.05*nd )   break;
++      else if ( it > 12 && nd >= na )  break;
++    }
++    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");
++    // //if(it==1) exit(0);
++  }
++  while ( na+nd > 0 && ++it < maxtou );
++
++  if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
++    fprintf(stdout,"     %7d INSERTED  %7d REMOVED  %7d FILTERED\n",na,nd,nf);
++  }
+ 
+-    nna = 0;
+-    nnd = 0;
+-    nf  = 0;
+-    it  = 0;
+-    maxtou = 100;
++  if(MMG_npdtot>0) {
++    fprintf(stdout,"    REJECTED : %5d\n",MMG_npdtot);
++    fprintf(stdout,"          VOL      : %6.2f %%    %5d \n",
++	    100*(MMG_nvoltot/(float)
++		 MMG_npdtot),MMG_nvoltot);
++    fprintf(stdout,"          PUISS    : %6.2f %%    %5d \n",
++	    100*(MMG_npuisstot/(float) MMG_npdtot),MMG_npuisstot);
++    fprintf(stdout,"         PROCHE    : %6.2f %%    %5d \n",
++	    100*(MMG_nprestot/(float) MMG_npuisstot),MMG_nprestot);
+     MMG_npdtot=0;
+     MMG_npuisstot=0;
+-    MMG_nprestot=0;
+     MMG_nvoltot=0;
++  }
++  if ( mesh->info.imprim < 0 ) {
++    MMG_outqua(mesh,sol);
++    MMG_prilen(mesh,sol);
++  }
  
 -    /* 2. field points */
 -    if ( mesh->info.imprim < -4 ) {
 -      MMG_prilen(mesh,sol);
 -      fprintf(stdout,"  -- FIELD POINTS\n");
 -    }
-+  /* 2. field points */
-+  if ( mesh->info.imprim < -4 ) {
-+    MMG_prilen(mesh,sol);
-+    fprintf(stdout,"  -- FIELD POINTS\n");
-+  }
- 
+-
 -    /* create filter */
 -    bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
 -    if ( !bucket )  return(0);
-+  /* create filter */
-+  bucket = MMG_newBucket(mesh,M_MAX(mesh->info.bucksiz,BUCKSIZ));
-+  if ( !bucket )  return(0);
- 
+-
 -    do {
 -      MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);    
 -      nna += na;
@@ -10324,30 +10368,13 @@
 -        fprintf(stdout,"     %7d INSERTED  %7d REMOVED   %7d FILTERED\n",na,nd,nf);    
 -			// MMG_saveMesh(mesh,"chk.mesh");
 -			// //if(it==1) exit(0);
-+  do {
-+    MMG_analar(mesh,sol,bucket,&na,&nd,&nf,alert);
-+    nna += na;
-+    nnd += nd;
-+    if ( *alert ) {
-+      if ( nd < 1000 )  break;
-+      else  *alert = 0;
-     }
+-    }
 -    while ( na+nd > 0 && ++it < maxtou );
 -
 -    if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
 -      fprintf(stdout,"     %7d INSERTED  %7d REMOVED  %7d FILTERED\n",na,nd,nf);
-+    if ( it > 5 ) {
-+      dd = abs(nd-na);
-+      if ( dd < 5 || dd < 0.05*nd )   break;
-+      else if ( it > 12 && nd >= na )  break;
-     }
-+    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");
-+    // //if(it==1) exit(0);
-+  }
-+  while ( na+nd > 0 && ++it < maxtou );
- 
+-    }
+-
 -  if(MMG_npdtot>0) { 
 -  fprintf(stdout,"    REJECTED : %5d\n",MMG_npdtot);
 -  fprintf(stdout,"          VOL      : %6.2f %%    %5d \n",
@@ -10365,44 +10392,22 @@
 -      MMG_outqua(mesh,sol);
 -      MMG_prilen(mesh,sol);
 -    }
-+  if ( nna+nnd && abs(mesh->info.imprim) < 3 ) {
-+    fprintf(stdout,"     %7d INSERTED  %7d REMOVED  %7d FILTERED\n",na,nd,nf);
-+  }
++  M_free(bucket->head);
++  M_free(bucket->link);
++  M_free(bucket);
  
 -    M_free(bucket->head);
 -    M_free(bucket->link);
 -    M_free(bucket);
 -  
-+  if(MMG_npdtot>0) {
-+    fprintf(stdout,"    REJECTED : %5d\n",MMG_npdtot);
-+    fprintf(stdout,"          VOL      : %6.2f %%    %5d \n",
-+	    100*(MMG_nvoltot/(float)
-+		 MMG_npdtot),MMG_nvoltot);
-+    fprintf(stdout,"          PUISS    : %6.2f %%    %5d \n",
-+	    100*(MMG_npuisstot/(float) MMG_npdtot),MMG_npuisstot);
-+    fprintf(stdout,"         PROCHE    : %6.2f %%    %5d \n",
-+	    100*(MMG_nprestot/(float) MMG_npuisstot),MMG_nprestot);
-+    MMG_npdtot=0;
-+    MMG_npuisstot=0;
-+    MMG_nvoltot=0;
-+  }
-+  if ( mesh->info.imprim < 0 ) {
-+    MMG_outqua(mesh,sol);
-+    MMG_prilen(mesh,sol);
-+  }
- 
-+  M_free(bucket->head);
-+  M_free(bucket->link);
-+  M_free(bucket);
-+
-+
+ 
    return(1);
  }
-Index: contrib/mmg3d/build/sources/mmg3d9.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d9.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/mmg3d9.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/mmg3d9.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/mmg3d9.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3d9.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -10437,7 +10442,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -10448,7 +10452,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -10457,7 +10461,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -49,11 +49,11 @@
+@@ -49,11 +49,11 @@ extern int MMG_nlen,MMG_ncal,MMG_ntopo,M
  
  /*essaie d'enlever les tets ayant plus d'une face de peau pour faciliter le bouger*/
  int MMG_optfacespeau(pMesh mesh,pSol sol) {
@@ -10473,7 +10477,7 @@
    declic = 1.7 / ALPHAD;
    maxtou = 10;
    it     = 0;
-@@ -73,22 +73,22 @@
+@@ -73,22 +73,22 @@ int MMG_optfacespeau(pMesh mesh,pSol sol
        /*optim bdry tetra*/
        npeau = 0;
        for(i=0 ; i<4 ; i++) {
@@ -10505,7 +10509,7 @@
  }
  
  /*collapse*/
-@@ -102,10 +102,10 @@
+@@ -102,10 +102,10 @@ int MMG_colps(pMesh mesh,pSol sol,int *n
    List      list;
    char      tabar;
  
@@ -10520,7 +10524,7 @@
  
    npp = 0;
    ndd = 0;
-@@ -125,10 +125,10 @@
+@@ -125,10 +125,10 @@ MMG_nex = 0;
      for (i=0; i<4; i++) {
        adj = adja[i] >> 2;
        if ( !adj || pt->ref != mesh->tetra[adj].ref ) {
@@ -10535,7 +10539,7 @@
      }
      if ( tabar == ALL_BDRY )  continue;
  
-@@ -151,42 +151,42 @@
+@@ -151,42 +151,42 @@ MMG_nex = 0;
  
        iadr = (ipb-1)*sol->offset + 1;
        mb  = &sol->met[iadr];
@@ -10601,7 +10605,7 @@
  
    return(1);
  
-@@ -201,13 +201,13 @@
+@@ -201,13 +201,13 @@ int MMG_dikomv(pMesh mesh,pSol sol,short
    double    vol,c[4][3];
    double    alpha,coor[3];
    int       k,i,nm;
@@ -10620,7 +10624,7 @@
    for (k=1; k<=mesh->ne; k++) {
      pt = &mesh->tetra[k];
      if ( !pt->v[0] )  continue;
-@@ -215,12 +215,12 @@
+@@ -215,12 +215,12 @@ Info     *info;
        ppt      = &mesh->point[ pt->v[i] ];
        ppt->tmp = k;
        if ( ppt->tag & M_MOVE ) {
@@ -10637,7 +10641,7 @@
      }
  
      vol = MMG_quickvol(c[0],c[1],c[2],c[3]);
-@@ -233,37 +233,38 @@
+@@ -233,37 +233,38 @@ Info     *info;
    for (k=1; k<=mesh->np; k++) {
      ppt = &mesh->point[k];
      if(ppt->tag & M_UNUSED) continue;
@@ -10702,7 +10706,7 @@
    }
  
    /* update point coords */
-@@ -275,7 +276,7 @@
+@@ -275,7 +276,7 @@ if(MMG_computeMetric(mesh,sol,k,coor) ==
        ppt->c[1] += alpha * pd->mv[3*(k-1) + 1 + 1];
        ppt->c[2] += alpha * pd->mv[3*(k-1) + 1 + 2];
        pd->alpha[k]  = t;
@@ -10711,7 +10715,7 @@
        nm++;
      }
    }
-@@ -299,7 +300,7 @@
+@@ -299,7 +300,7 @@ int MMG_chkmov(pMesh mesh,char level) {
    for (k=1; k<=mesh->np; k++) {
      ppt = &mesh->point[k];
      if ( ppt->tag & M_MOVE ) {
@@ -10720,7 +10724,7 @@
        ppt->tag &= ~M_MOVE;
        nc++;
      }
-@@ -319,18 +320,18 @@
+@@ -319,18 +320,18 @@ int MMG_chkmov(pMesh mesh,char level) {
  }
  
  int MMG_optra9(pMesh mesh,pSol sol) {
@@ -10745,7 +10749,7 @@
    declicw = 5./ALPHAD;
    declic  = 1.1 / ALPHAD;//1.1 pour mmg3d
  
-@@ -338,36 +339,38 @@
+@@ -338,36 +339,38 @@ int MMG_optra9(pMesh mesh,pSol sol) {
      for (k=1; k<=mesh->ne; k++) mesh->tetra[k].flag = mesh->flag;
      for (k=1; k<=mesh->np; k++) mesh->point[k].flag = mesh->flag;
      base = ++mesh->flag;
@@ -10767,11 +10771,12 @@
 -    /*sur des surfaces courbes, il existe des tetras ayant  4 points de peau avec Q=3*/  
 -    if (1/*!mesh->info.noswap*/ /*&& (it < 10)*/ )  {
 -	  nw += MMG_opttyp(mesh,sol,declicw,&alert);   
+-    }
 +     */
 +    /*sur des surfaces courbes, il existe des tetras ayant  4 points de peau avec Q=3*/
 +    if (!mesh->info.nomove/*!mesh->info.noswap*/ /*&& (it < 10)*/ )  {
 +      nw += MMG_opttyp(mesh,sol,declicw,&alert,mesh->flag-1);
-     }
++    }
 +    if (!mesh->info.nomove) {
 +      nm = MMG_optlen(mesh,sol,declic,base);
 +    } else
@@ -10797,7 +10802,7 @@
    pPoint    ppt;
    pTetra   pt;
    double   declic;
-@@ -375,10 +378,10 @@
+@@ -375,23 +378,23 @@ int MMG_mmg3d9(pMesh mesh,pSol sol,int *
    int      k,nm,iter,maxiter;
    int      base,nnd,nns,sit,maxtou,ns,iadr,iold;
    short    t,i,it,alpha;
@@ -10810,7 +10815,6 @@
    /*alloc et init metold*/
    sol->metold = (double*)M_calloc(sol->npmax+1,sol->offset*sizeof(double),"MMG_mmg3d9");
    assert(sol->metold);
-@@ -385,13 +388,13 @@
    mesh->disp->cold = (double*)M_calloc(3*(mesh->npmax + 1),sizeof(double),"MMG_mmg3d9");
    assert(mesh->disp->cold);
    for (k=1; k<=mesh->np; k++) {
@@ -10831,7 +10835,7 @@
    switch (sol->offset) {
    case 1:
      for (k=1; k<=sol->np; k++)  {
-@@ -412,86 +415,87 @@
+@@ -412,86 +415,87 @@ int MMG_mmg3d9(pMesh mesh,pSol sol,int *
      exit(2);
    }
  
@@ -10911,11 +10915,11 @@
        if ( mesh->info.imprim && nm )
 -        fprintf(stdout,"     %7d NODES MOVED\n",nm);
 +	fprintf(stdout,"     %7d NODES MOVED\n",nm);
++
++      printf("%%%% ITER %d alpha (%d) %d < %d\n",iter,i,alpha,SHRT_MAX);
  
 -      printf("%%%% ITER %d alpha (%d) %d < %d\n",iter,i,alpha,SHORT_MAX);
 -            
-+      printf("%%%% ITER %d alpha (%d) %d < %d\n",iter,i,alpha,SHRT_MAX);
-+
        if ( i>1 ) {
 -        fprintf(stdout,"     CAN'T MOVED\n");
 -        if(!mesh->info.noswap) MMG_optfacespeau(mesh,sol);
@@ -10937,6 +10941,14 @@
 -            fprintf(stdout,"      %7d SWAPPED\n",ns);
 -        }
 -        while ( ns && ++sit < maxtou );
+-
+-        if ( nnd+nns && abs(mesh->info.imprim) < 3 ) {
+-          fprintf(stdout,"     %7d REMOVED  %7d SWAPPED\n",nnd,nns);
+-        }
+-      }
+-      
+-      if ( qworst < 10./ALPHAD ) { 
+-        MMG_optra4(mesh,sol);
 +	fprintf(stdout,"     CAN'T MOVED\n");
 +	if(!mesh->info.noswap) MMG_optfacespeau(mesh,sol);
 +	nnd = 0;
@@ -10957,17 +10969,11 @@
 +	    fprintf(stdout,"      %7d SWAPPED\n",ns);
 +	}
 +	while ( ns && ++sit < maxtou );
- 
--        if ( nnd+nns && abs(mesh->info.imprim) < 3 ) {
--          fprintf(stdout,"     %7d REMOVED  %7d SWAPPED\n",nnd,nns);
--        }
++
 +	if ( nnd+nns && abs(mesh->info.imprim) < 3 ) {
 +	  fprintf(stdout,"     %7d REMOVED  %7d SWAPPED\n",nnd,nns);
 +	}
-       }
--      
--      if ( qworst < 10./ALPHAD ) { 
--        MMG_optra4(mesh,sol);
++      }
 +
 +      if ( qworst < 10./ALPHAD ) {
 +	MMG_optra4(mesh,sol);
@@ -10977,7 +10983,7 @@
        }
        if(!mesh->info.noswap) MMG_optfacespeau(mesh,sol);
        MMG_outqua(mesh,sol);
-@@ -505,7 +509,7 @@
+@@ -505,7 +509,7 @@ int MMG_mmg3d9(pMesh mesh,pSol sol,int *
        return(0);
      }
    }
@@ -10986,7 +10992,7 @@
    if(!mesh->info.noswap) MMG_optfacespeau(mesh,sol);
  
    /* update quality */
-@@ -519,10 +523,9 @@
+@@ -519,10 +523,9 @@ int MMG_mmg3d9(pMesh mesh,pSol sol,int *
      MMG_outqua(mesh,sol);
      MMG_prilen(mesh,sol);
    }
@@ -11001,11 +11007,11 @@
    */return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/mmg3dlib.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3dlib.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/mmg3dlib.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/mmg3dlib.c	(working copy)
-@@ -43,21 +43,27 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/mmg3dlib.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/mmg3dlib.c
+@@ -43,21 +43,27 @@ GNU General Public License for more deta
  You should have received a copy of the GNU General Public License
  along with MMG3D. If not, see <http://www.gnu.org/licenses/>.  
  ****************************************************************************/
@@ -11041,7 +11047,7 @@
  
  static void MMG_excfun(int sigid) {
    switch (sigid) {
-@@ -130,10 +136,10 @@
+@@ -130,10 +136,10 @@ int MMG_inputdata(pMesh mesh,pSol sol) {
    }
    /*tag points*/
    for (k=1; k<=mesh->np; k++) {
@@ -11055,7 +11061,7 @@
  }
  
  int MMG_tassage(pMesh mesh,pSol sol) {
-@@ -141,9 +147,11 @@
+@@ -141,9 +147,11 @@ int MMG_tassage(pMesh mesh,pSol sol) {
    pTria		pt1;
    pPoint	ppt,pptnew;
    int 		np,k,ne,nbl,isol,isolnew,i;
@@ -11068,7 +11074,7 @@
  
    /* compact vertices */
    np=0;
-@@ -169,31 +177,39 @@
+@@ -169,31 +177,39 @@ int MMG_tassage(pMesh mesh,pSol sol) {
      pt = &mesh->tetra[k];
      if ( !pt->v[0] )  {
        continue;
@@ -11128,7 +11134,7 @@
    
    /* compact metric */
    nbl = 1;
-@@ -210,25 +226,26 @@
+@@ -210,25 +226,26 @@ int MMG_tassage(pMesh mesh,pSol sol) {
    
     
    /*compact vertices*/
@@ -11174,7 +11180,7 @@
     
    for(k=1 ; k<=mesh->np ; k++)
      mesh->point[k].tmp = 0;
-@@ -245,22 +262,344 @@
+@@ -245,22 +262,344 @@ int MMG_tassage(pMesh mesh,pSol sol) {
    for (k=mesh->ntnil; k<mesh->ntmax-1; k++)
      mesh->tria[k].v[2] = k+1;
    
@@ -11183,7 +11189,7 @@
 +  
 +  return(1);
 +}
- 
++
 +/* set function pointers */
 +int MMG_setfunc(int type) {
 +  if ( type == 6 ) {
@@ -11259,7 +11265,7 @@
 +  M_free(sol->metold);  
 +  return(1);
 +}
-+
+ 
 +void usage(char *prog) {
 +  fprintf(stdout,"usage: %s [-v[n]] [-h] [-m n] [opts..] filein[.mesh] [-out fileout]\n",prog);
    
@@ -11526,7 +11532,7 @@
    
    
    signal(SIGABRT,MMG_excfun);
-@@ -269,8 +608,8 @@
+@@ -269,8 +608,8 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
    signal(SIGSEGV,MMG_excfun);
    signal(SIGTERM,MMG_excfun);
    signal(SIGINT,MMG_excfun);
@@ -11537,7 +11543,7 @@
  
    TIM_tminit(MMG_ctim,TIMEMAX);
    TIM_chrono(ON,&MMG_ctim[0]);
-@@ -287,10 +626,11 @@
+@@ -287,10 +626,11 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
    info->nomove   = opt[5];
    info->noinsert = opt[4];
    info->rn2      = opt[7];//3;
@@ -11550,7 +11556,7 @@
  
    imprim         = info->imprim;
    MMG_imprim   = imprim;
-@@ -311,11 +651,13 @@
+@@ -311,28 +651,28 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
    if ( !MMG_setfunc(sol->offset) ) return(1);
    if ( !MMG_scaleMesh(mesh,sol) )  return(1);
    TIM_chrono(OFF,&MMG_ctim[1]);
@@ -11566,7 +11572,6 @@
    if(alert) {
      fprintf(stdout,"\n \n    ## INVALID MESH. STOP\n");
      exit(1);  
-@@ -322,17 +664,15 @@
    }
    if(MMG_imprim < 0) MMG_outquacubic(mesh,sol);
  
@@ -11590,7 +11595,7 @@
    if ( !MMG_hashTetra(mesh) )    return(1);
    if ( !MMG_markBdry(mesh) )     return(1);
    if (abs(mesh->info.option)==10) {
-@@ -346,67 +686,67 @@
+@@ -346,67 +686,67 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
    } else
      im = 0;
      
@@ -11688,7 +11693,7 @@
        }
      } 
      
-@@ -419,7 +759,7 @@
+@@ -419,7 +759,7 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
      }
        
      TIM_chrono(OFF,&MMG_ctim[3]);
@@ -11697,7 +11702,7 @@
        fprintf(stdout,"  -- PHASE 2 COMPLETED.     %.2f sec.\n",
                TIM_gttime(MMG_ctim[3]));
    }
-@@ -429,35 +769,38 @@
+@@ -429,35 +769,38 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
  #ifdef USE_SCOTCH
      /* renumbering begin */
      /*MMG_chkmsh(mesh,0,-1); 
@@ -11744,7 +11749,7 @@
        fprintf(stdout,"  -- PHASE 3 COMPLETED.     %.2f sec.\n",
                TIM_gttime(MMG_ctim[4]));
    }
-@@ -465,20 +808,38 @@
+@@ -465,20 +808,38 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
  
    if ( info->option > -1 || abs(MMG_imprim) > 3 ) {
      MMG_outqua(mesh,sol);
@@ -11787,7 +11792,7 @@
    TIM_chrono(OFF,&MMG_ctim[1]);
    if ( MMG_imprim ) {
      fprintf(stdout,"     NUMBER OF GIVEN VERTICES   %8d\n",mesh->npfixe);
-@@ -487,11 +848,87 @@
+@@ -487,11 +848,87 @@ int MMG_mmg3dlib(int opt[9],MMG_pMesh me
      fprintf(stdout,"     NUMBER OF GIVEN ELEMENTS   %8d\n",mesh->nefixe);
      fprintf(stdout,"     TOTAL NUMBER OF VERTICES   %8d\n",mesh->np);
      fprintf(stdout,"     TOTAL NUMBER OF TRIANGLES  %8d\n",mesh->nt);
@@ -11875,11 +11880,11 @@
 +  MMG_searchlen(mesh,sol,lmin,lmax,eltab);  
 +  return(alert);
 +}
-Index: contrib/mmg3d/build/sources/movevertex.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/movevertex.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/movevertex.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/movevertex.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/movevertex.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/movevertex.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -11914,7 +11919,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -11925,7 +11929,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,17 +41,17 @@
+@@ -41,24 +41,24 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -11950,7 +11954,6 @@
    assert(k);
    assert(ib<4);
    pt = &mesh->tetra[k];
-@@ -58,7 +58,7 @@
    ppa  = &mesh->point[pt->v[ib]];
    iadr = (pt->v[ib]-1)*sol->offset + 1;
    mp   = &sol->met[iadr];
@@ -11959,7 +11962,7 @@
    /*compute normal*/
    i1 = pt->v[MMG_idir[ib][0]];
    i2 = pt->v[MMG_idir[ib][1]];
-@@ -66,7 +66,7 @@
+@@ -66,7 +66,7 @@ int MMG_movevertex_ani(pMesh mesh,pSol s
    p1 = &mesh->point[i1];
    p2 = &mesh->point[i2];
    p3 = &mesh->point[i3];
@@ -11968,7 +11971,7 @@
    ax = p3->c[0] - p1->c[0];
    ay = p3->c[1] - p1->c[1];
    az = p3->c[2] - p1->c[2];
-@@ -78,8 +78,8 @@
+@@ -78,8 +78,8 @@ int MMG_movevertex_ani(pMesh mesh,pSol s
    nx = (ay*bz - az*by);
    ny = (az*bx - ax*bz);
    nz = (ax*by - ay*bx);
@@ -11979,7 +11982,7 @@
    dd = 1./dd;
    nx *=dd;
    ny *=dd;
-@@ -94,21 +94,21 @@
+@@ -94,21 +94,21 @@ int MMG_movevertex_ani(pMesh mesh,pSol s
      az  = ppb->c[2] - ppa->c[2];
  
      dd =       mp[0]*ax*ax + mp[3]*ay*ay + mp[5]*az*az \
@@ -12007,7 +12010,7 @@
    iter    = 0;
    maxiter = 20;
    do {
-@@ -121,28 +121,28 @@
+@@ -121,28 +121,28 @@ int MMG_movevertex_ani(pMesh mesh,pSol s
        pt1 = &mesh->tetra[iel];
  
        qual = MMG_caltet(mesh,sol,iel);
@@ -12015,6 +12018,25 @@
 -       list.qual[l] = qual;
 +      if ( !((qual < pt1->qual) || (qual < pt->qual /2.)) )  break;
 +      list.qual[l] = qual;
++
++    }
++    if ( l > lon )  break;
++    coe *= 0.5;
++  }
++  while ( ++iter <= maxiter );
++  if ( iter > maxiter) {
++    memcpy(ppa->c,oldc,3*sizeof(double));
++    return(0);
++  }
++
++  for (l=1; l<=lon; l++) {
++    iel = list.tetra[l] >> 2;
++    pt1 = &mesh->tetra[iel];
++    pt1->qual = list.qual[l];
++    //    if ( pt1->qual < declic )
++    //  MMG_kiudel(queue,iel);
++  }
++  return(1);
  
 -     }
 -     if ( l > lon )  break;
@@ -12035,6 +12057,94 @@
 -   }
 -   return(1);
 - 
+ }
+ 
+ 
+@@ -153,15 +153,15 @@ int MMG_movevertex_iso(pMesh mesh,pSol s
+   int    j,iadr,ipb,iter,maxiter,l,lon,iel,i1,i2,i3;
+   double  hp,coe,crit;
+   double ax,ay,az,bx,by,bz,nx,ny,nz,dd,len,qual,oldc[3];
+-  
++
+   assert(k);
+   assert(ib<4);
+   pt = &mesh->tetra[k];
+-   
++
+   ppa  = &mesh->point[pt->v[ib]];
+   iadr = (pt->v[ib]-1)*sol->offset + 1;
+   hp   = sol->met[iadr];
+-  
++
+   /*compute normal*/
+   i1 = pt->v[MMG_idir[ib][0]];
+   i2 = pt->v[MMG_idir[ib][1]];
+@@ -169,7 +169,7 @@ int MMG_movevertex_iso(pMesh mesh,pSol s
+   p1 = &mesh->point[i1];
+   p2 = &mesh->point[i2];
+   p3 = &mesh->point[i3];
+-  
++
+   ax = p3->c[0] - p1->c[0];
+   ay = p3->c[1] - p1->c[1];
+   az = p3->c[2] - p1->c[2];
+@@ -181,8 +181,8 @@ int MMG_movevertex_iso(pMesh mesh,pSol s
+   nx = (ay*bz - az*by);
+   ny = (az*bx - ax*bz);
+   nz = (ax*by - ay*bx);
+-    
+-  dd = sqrt(nx*nx+ny*ny+nz*nz); 
++
++  dd = sqrt(nx*nx+ny*ny+nz*nz);
+   dd = 1./dd;
+   nx *=dd;
+   ny *=dd;
+@@ -198,15 +198,15 @@ int MMG_movevertex_iso(pMesh mesh,pSol s
+ 
+     dd    =   sqrt(ax*ax +ay*ay +az*az);
+     len  +=   dd/hp;
+-  }	
+-   
++  }
++
+   dd  = 1.0 / (double)3.;
+-  len *= dd; 
++  len *= dd;
+   if(len > 0.) len = 1.0 / len;
+   else printf("MMG_movevertex len %e\n",len);
+ 
+   memcpy(oldc,ppa->c,3*sizeof(double));
+-  	    
++
+   lon = MMG_boulep(mesh,k,ib,&list);
+   if(mesh->info.imprim < 0) if(lon < 4 && lon) printf("lon petit : %d\n",lon);
+   if(!lon) return(0);
+@@ -218,12 +218,12 @@ int MMG_movevertex_iso(pMesh mesh,pSol s
+     pt1 = &mesh->tetra[iel];
+     if ( pt1->qual > crit )  crit = pt1->qual;
+   }
+- /* if ( (crit > 100/ALPHAD) ) {
+-    crit *= 1.1;
+-  } else 
+-   */ crit *= 0.99;
+-  
+-  coe	  = 1.;
++  /* if ( (crit > 100/ALPHAD) ) {
++     crit *= 1.1;
++     } else
++  */ crit *= 0.99;
++
++  coe     = 1.;
+   iter    = 0;
+   maxiter = 20;
+   do {
+@@ -236,44 +236,44 @@ int MMG_movevertex_iso(pMesh mesh,pSol s
+       pt1 = &mesh->tetra[iel];
+       qual = MMG_caltet(mesh,sol,iel);
+       if ( qual > crit )  break;
+-       list.qual[l] = qual;
++      list.qual[l] = qual;
++
 +    }
 +    if ( l > lon )  break;
 +    coe *= 0.5;
@@ -12042,7 +12152,7 @@
 +  while ( ++iter <= maxiter );
 +  if ( iter > maxiter) {
 +    memcpy(ppa->c,oldc,3*sizeof(double));
-+    return(0);
++    return(-2);
 +  }
 +
 +  for (l=1; l<=lon; l++) {
@@ -12053,94 +12163,6 @@
 +    //  MMG_kiudel(queue,iel);
 +  }
 +  return(1);
-+
- }
- 
- 
-@@ -153,15 +153,15 @@
-   int    j,iadr,ipb,iter,maxiter,l,lon,iel,i1,i2,i3;
-   double  hp,coe,crit;
-   double ax,ay,az,bx,by,bz,nx,ny,nz,dd,len,qual,oldc[3];
--  
-+
-   assert(k);
-   assert(ib<4);
-   pt = &mesh->tetra[k];
--   
-+
-   ppa  = &mesh->point[pt->v[ib]];
-   iadr = (pt->v[ib]-1)*sol->offset + 1;
-   hp   = sol->met[iadr];
--  
-+
-   /*compute normal*/
-   i1 = pt->v[MMG_idir[ib][0]];
-   i2 = pt->v[MMG_idir[ib][1]];
-@@ -169,7 +169,7 @@
-   p1 = &mesh->point[i1];
-   p2 = &mesh->point[i2];
-   p3 = &mesh->point[i3];
--  
-+
-   ax = p3->c[0] - p1->c[0];
-   ay = p3->c[1] - p1->c[1];
-   az = p3->c[2] - p1->c[2];
-@@ -181,8 +181,8 @@
-   nx = (ay*bz - az*by);
-   ny = (az*bx - ax*bz);
-   nz = (ax*by - ay*bx);
--    
--  dd = sqrt(nx*nx+ny*ny+nz*nz); 
-+
-+  dd = sqrt(nx*nx+ny*ny+nz*nz);
-   dd = 1./dd;
-   nx *=dd;
-   ny *=dd;
-@@ -198,15 +198,15 @@
- 
-     dd    =   sqrt(ax*ax +ay*ay +az*az);
-     len  +=   dd/hp;
--  }	
--   
-+  }
-+
-   dd  = 1.0 / (double)3.;
--  len *= dd; 
-+  len *= dd;
-   if(len > 0.) len = 1.0 / len;
-   else printf("MMG_movevertex len %e\n",len);
- 
-   memcpy(oldc,ppa->c,3*sizeof(double));
--  	    
-+
-   lon = MMG_boulep(mesh,k,ib,&list);
-   if(mesh->info.imprim < 0) if(lon < 4 && lon) printf("lon petit : %d\n",lon);
-   if(!lon) return(0);
-@@ -218,12 +218,12 @@
-     pt1 = &mesh->tetra[iel];
-     if ( pt1->qual > crit )  crit = pt1->qual;
-   }
-- /* if ( (crit > 100/ALPHAD) ) {
--    crit *= 1.1;
--  } else 
--   */ crit *= 0.99;
--  
--  coe	  = 1.;
-+  /* if ( (crit > 100/ALPHAD) ) {
-+     crit *= 1.1;
-+     } else
-+  */ crit *= 0.99;
-+
-+  coe     = 1.;
-   iter    = 0;
-   maxiter = 20;
-   do {
-@@ -236,44 +236,44 @@
-       pt1 = &mesh->tetra[iel];
-       qual = MMG_caltet(mesh,sol,iel);
-       if ( qual > crit )  break;
--       list.qual[l] = qual;
-+      list.qual[l] = qual;
  
 -     }
 -     if ( l > lon )  break;
@@ -12161,25 +12183,6 @@
 -   }
 -   return(1);
 - 
-+    }
-+    if ( l > lon )  break;
-+    coe *= 0.5;
-+  }
-+  while ( ++iter <= maxiter );
-+  if ( iter > maxiter) {
-+    memcpy(ppa->c,oldc,3*sizeof(double));
-+    return(-2);
-+  }
-+
-+  for (l=1; l<=lon; l++) {
-+    iel = list.tetra[l] >> 2;
-+    pt1 = &mesh->tetra[iel];
-+    pt1->qual = list.qual[l];
-+    //    if ( pt1->qual < declic )
-+    //  MMG_kiudel(queue,iel);
-+  }
-+  return(1);
-+
  }
  
  
@@ -12208,7 +12211,7 @@
    /*compute normal*/
    i1 = pt->v[MMG_idir[ib][0]];
    i2 = pt->v[MMG_idir[ib][1]];
-@@ -281,7 +281,7 @@
+@@ -281,7 +281,7 @@ int MMG_movevertexbdry(pMesh mesh,pSol s
    p1 = &mesh->point[i1];
    p2 = &mesh->point[i2];
    p3 = &mesh->point[i3];
@@ -12217,7 +12220,7 @@
    ax = p3->c[0] - p1->c[0];
    ay = p3->c[1] - p1->c[1];
    az = p3->c[2] - p1->c[2];
-@@ -293,8 +293,8 @@
+@@ -293,8 +293,8 @@ int MMG_movevertexbdry(pMesh mesh,pSol s
    nx = (ay*bz - az*by);
    ny = (az*bx - ax*bz);
    nz = (ax*by - ay*bx);
@@ -12228,7 +12231,7 @@
    dd = 1./dd;
    nx *=dd;
    ny *=dd;
-@@ -310,13 +310,13 @@
+@@ -310,13 +310,13 @@ int MMG_movevertexbdry(pMesh mesh,pSol s
  
      dd   = ax*ax + ay*ay + az*az;
      len += sqrt(dd);
@@ -12245,7 +12248,7 @@
    lon = MMG_boulep(mesh,k,ib,&list);
    if(mesh->info.imprim < 0 ) if(lon < 4 && lon) printf("lon petit : %d\n",lon);
    if(!lon) return(0);
-@@ -326,7 +326,7 @@
+@@ -326,7 +326,7 @@ int MMG_movevertexbdry(pMesh mesh,pSol s
      pt1 = &mesh->tetra[iel];
      if ( pt1->qual > crit )  crit = pt1->qual;
    }
@@ -12254,7 +12257,7 @@
    iter    = 0;
    maxiter = 50;
    do {
-@@ -351,16 +351,14 @@
+@@ -351,16 +351,14 @@ int MMG_movevertexbdry(pMesh mesh,pSol s
      memcpy(ppa->c,oldc,3*sizeof(double));
      return(0);
    }
@@ -12280,11 +12283,11 @@
 +  return(1);
  
 +}
-Index: contrib/mmg3d/build/sources/optbdry.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optbdry.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optbdry.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optbdry.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optbdry.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optbdry.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -12319,7 +12322,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -12330,7 +12332,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -12339,7 +12341,7 @@
  ****************************************************************************/
  #include "mesh.h"
  #define OCRIT    0.99
-@@ -53,15 +53,15 @@
+@@ -53,38 +53,38 @@ int MMG_optbdry(pMesh mesh,pSol sol,int
    pTetra pt;
    int    ia,ib,i,*adja,iadr,ipb;
  
@@ -12359,7 +12361,6 @@
    ib  = i;
    ipb = pt->v[ib];
    if(!mesh->info.noinsert) {
-@@ -68,23 +68,23 @@
      for(i=1 ; i<4 ; i++) {
        ia = (ib+i)%4;
        if(MMG_colpoi2(mesh,sol,k,ia,ib,QDEGRAD)) {
@@ -12389,7 +12390,7 @@
  }
  int MMG_opt2peau(pMesh mesh,pSol sol,pQueue queue,int k,double declic) {
    pTetra    pt,pt1;
-@@ -98,7 +98,7 @@
+@@ -98,7 +98,7 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
    int       lon,l,iel,ier;
  
    ier = 0;
@@ -12398,34 +12399,36 @@
    pt = &mesh->tetra[k];
    if ( !pt->v[0] )  return(-1);
  
-@@ -112,17 +112,17 @@
+@@ -112,17 +112,17 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
    pd = &mesh->point[id];
  
    /* volume */
 -  abx = pb->c[0] - pa->c[0]; 
 -  aby = pb->c[1] - pa->c[1]; 
 -  abz = pb->c[2] - pa->c[2]; 
+-
+-  acx = pc->c[0] - pa->c[0]; 
+-  acy = pc->c[1] - pa->c[1]; 
+-  acz = pc->c[2] - pa->c[2]; 
+-
+-  adx = pd->c[0] - pa->c[0]; 
+-  ady = pd->c[1] - pa->c[1]; 
+-  adz = pd->c[2] - pa->c[2]; 
 +  abx = pb->c[0] - pa->c[0];
 +  aby = pb->c[1] - pa->c[1];
 +  abz = pb->c[2] - pa->c[2];
- 
--  acx = pc->c[0] - pa->c[0]; 
--  acy = pc->c[1] - pa->c[1]; 
--  acz = pc->c[2] - pa->c[2]; 
++
 +  acx = pc->c[0] - pa->c[0];
 +  acy = pc->c[1] - pa->c[1];
 +  acz = pc->c[2] - pa->c[2];
- 
--  adx = pd->c[0] - pa->c[0]; 
--  ady = pd->c[1] - pa->c[1]; 
--  adz = pd->c[2] - pa->c[2]; 
++
 +  adx = pd->c[0] - pa->c[0];
 +  ady = pd->c[1] - pa->c[1];
 +  adz = pd->c[2] - pa->c[2];
  
    v1  = acy*adz - acz*ady;
    v2  = acz*adx - acx*adz;
-@@ -151,7 +151,7 @@
+@@ -151,7 +151,7 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
    h[5] = cdx*cdx + cdy*cdy + cdz*cdz;
  
    /* face areas */
@@ -12434,7 +12437,7 @@
    s[0] = dd * dd;
    dd = cdz*bdx - cdx*bdz;
    s[0] = s[0] + dd * dd;
-@@ -194,7 +194,7 @@
+@@ -194,7 +194,7 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
    }
    rapmin = sqrt(rapmin);
    rapmax = sqrt(rapmax);
@@ -12443,7 +12446,7 @@
    if(mesh->info.imprim < -9) printf("edge : %d %d\n",pt->v[MMG_iare[iarmax][0]],pt->v[MMG_iare[iarmax][1]]);
    /*split edge*/
    lon = MMG_coquil(mesh,k,iarmax,&list);
-@@ -202,36 +202,43 @@
+@@ -202,36 +202,43 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
      //printf("lon %d\n",lon);
      //if(!lon) printf("colle peau, edge peau\n");
    }
@@ -12515,7 +12518,7 @@
      //M_free(list.hedg.item);
  
      if(ier) {
-@@ -240,7 +247,7 @@
+@@ -240,7 +247,7 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
      }
      else return(0);
    } else {
@@ -12524,7 +12527,7 @@
      if ( !MMG_zaldy4(&list.hedg,3*LONMAX) ) {
        fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM MMG_optbdry.\n");
        MMG_kiufree(queue);
-@@ -249,24 +256,31 @@
+@@ -249,24 +256,31 @@ int MMG_opt2peau(pMesh mesh,pSol sol,pQu
      if ( lon > 2 ) {
        crit = pt->qual;
        for (l=2; l<=lon; l++) {
@@ -12565,11 +12568,11 @@
 -    
 +
  }
-Index: contrib/mmg3d/build/sources/optcoq.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optcoq.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optcoq.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optcoq.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optcoq.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optcoq.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -12604,7 +12607,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -12615,7 +12617,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,14 +41,14 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -12624,7 +12626,6 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -48,7 +48,7 @@
  #define SCRIT    0.95
  
  
@@ -12633,7 +12634,7 @@
  int MMG_optcoq(pMesh mesh,pSol sol) {
    pTetra     pt,pt1;
    pPoint     p1,p2;
-@@ -56,7 +56,7 @@
+@@ -56,7 +56,7 @@ int MMG_optcoq(pMesh mesh,pSol sol) {
    double     crit;
    int       *adja,adj,iadr,i,j,k,ia,ib,jel,lon,ns,nss,it,maxtou;
    char       tabar;
@@ -12642,7 +12643,7 @@
  
    maxtou = 10;
    nss    = 0;
-@@ -65,53 +65,53 @@
+@@ -65,53 +65,53 @@ int npp;
    do {
      ns  = 0;
      npp =0;
@@ -12682,16 +12683,10 @@
 -        ib = pt->v[ MMG_iare[i][1] ];
 -        p1 = &mesh->point[ia];
 -        p2 = &mesh->point[ib];
-+	ia = pt->v[ MMG_iare[i][0] ];
-+	ib = pt->v[ MMG_iare[i][1] ];
-+	p1 = &mesh->point[ia];
-+	p2 = &mesh->point[ib];
- 
+-
 -        lon  = MMG_coquil(mesh,k,i,&list);
 -        if ( lon < 3 || lon > 7 )  continue;
-+	lon  = MMG_coquil(mesh,k,i,&list);
-+	if ( lon < 3 || lon > 7 )  continue;
- 
+-
 -        /* qual crit */
 -        crit = pt->qual;
 -        for (j=2; j<=lon; j++) {
@@ -12705,6 +12700,14 @@
 -          ns++;
 -          break;
 -        }*/
++	ia = pt->v[ MMG_iare[i][0] ];
++	ib = pt->v[ MMG_iare[i][1] ];
++	p1 = &mesh->point[ia];
++	p2 = &mesh->point[ib];
++
++	lon  = MMG_coquil(mesh,k,i,&list);
++	if ( lon < 3 || lon > 7 )  continue;
++
 +	/* qual crit */
 +	crit = pt->qual;
 +	for (j=2; j<=lon; j++) {
@@ -12725,11 +12728,11 @@
      nss += ns;
    }
    while ( ns > 0 && ++it < maxtou );
-Index: contrib/mmg3d/build/sources/optcte.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optcte.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optcte.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optcte.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optcte.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optcte.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -12764,7 +12767,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -12775,7 +12777,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -12784,7 +12786,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -95,38 +95,38 @@
+@@ -95,38 +95,38 @@ int MMG_optlentmp(pMesh mesh,pSol sol,do
        lmi = LSHORT;
        lma = LLONG;
        for (l=1; l<=lon; l++) {
@@ -12792,30 +12794,18 @@
 -        nk  = list.tetra[l] % 4;
 -        pt1 = &mesh->tetra[iel];
 -        if ( pt1->qual > cal )  cal = pt1->qual;
-+	iel = list.tetra[l] >> 2;
-+	nk  = list.tetra[l] % 4;
-+	pt1 = &mesh->tetra[iel];
-+	if ( pt1->qual > cal )  cal = pt1->qual;
- 
+-
 -        for (j=0; j<3; j++) {
 -          ipb = pt1->v[ MMG_idir[nk][j] ];
 -          ppb = &mesh->point[ipb];
-+	for (j=0; j<3; j++) {
-+	  ipb = pt1->v[ MMG_idir[nk][j] ];
-+	  ppb = &mesh->point[ipb];
- 
+-
 -          iadr = (ipb-1)*sol->offset + 1;
 -          mb   = &sol->met[iadr];
-+	  iadr = (ipb-1)*sol->offset + 1;
-+	  mb   = &sol->met[iadr];
- 
+-
 -          ux  = ppb->c[0] - ppa->c[0];
 -          uy  = ppb->c[1] - ppa->c[1];
 -          uz  = ppb->c[2] - ppa->c[2];
-+	  ux  = ppb->c[0] - ppa->c[0];
-+	  uy  = ppb->c[1] - ppa->c[1];
-+	  uz  = ppb->c[2] - ppa->c[2];
- 
+-
 -          dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
 -              + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
 -          
@@ -12824,9 +12814,7 @@
 -          len = 0.5*(dd1+dd2);
 -          if ( len < lmi )      lmi = len;
 -          else if (len > lma )  lma = len;
-+	  dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
-+	    + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
- 
+-
 -          /* optimal point */
 -          len = 1.0 / sqrt(dd1);
 -          cx += ppa->c[0] + ux * len;
@@ -12834,6 +12822,25 @@
 -          cz += ppa->c[2] + uz * len;
 -          nb++;
 -        }
++	iel = list.tetra[l] >> 2;
++	nk  = list.tetra[l] % 4;
++	pt1 = &mesh->tetra[iel];
++	if ( pt1->qual > cal )  cal = pt1->qual;
++
++	for (j=0; j<3; j++) {
++	  ipb = pt1->v[ MMG_idir[nk][j] ];
++	  ppb = &mesh->point[ipb];
++
++	  iadr = (ipb-1)*sol->offset + 1;
++	  mb   = &sol->met[iadr];
++
++	  ux  = ppb->c[0] - ppa->c[0];
++	  uy  = ppb->c[1] - ppa->c[1];
++	  uz  = ppb->c[2] - ppa->c[2];
++
++	  dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
++	    + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
++
 +	  dd2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
 +	    + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 +	  len = 0.5*(dd1+dd2);
@@ -12850,7 +12857,7 @@
        }
        if ( nb < 3 )  continue;
        dd  = 1.0 / (double)nb;
-@@ -138,72 +138,72 @@
+@@ -138,72 +138,72 @@ int MMG_optlentmp(pMesh mesh,pSol sol,do
        coe  = HQCOEF;
        iter = 1;
        if ( cal > 10.0 / ALPHAD )
@@ -12871,62 +12878,69 @@
 -        ppa->c[0] = oldc[0] + coe * cpx;
 -        ppa->c[1] = oldc[1] + coe * cpy;
 -        ppa->c[2] = oldc[2] + coe * cpz;
-+	ppa->c[0] = oldc[0] + coe * cpx;
-+	ppa->c[1] = oldc[1] + coe * cpy;
-+	ppa->c[2] = oldc[2] + coe * cpz;
- 
+-
 -        for (l=1; l<=lon; l++) {
 -          iel = list.tetra[l] >> 2;
 -          nk  = list.tetra[l] % 4;
 -          pt1 = &mesh->tetra[iel];
-+	for (l=1; l<=lon; l++) {
-+	  iel = list.tetra[l] >> 2;
-+	  nk  = list.tetra[l] % 4;
-+	  pt1 = &mesh->tetra[iel];
- 
+-
 -          cal = MMG_caltet(mesh,sol,iel);
 -          if ( cal > ctg )  break;
 -          list.qual[l] = cal;
-+	  cal = MMG_caltet(mesh,sol,iel);
-+	  if ( cal > ctg )  break;
-+	  list.qual[l] = cal;
- 
+-
 -          /* check MMG_length */
 -          for (j=0; j<3; j++) {
 -            ipb = pt1->v[ MMG_idir[nk][j] ];
 -            ppb = &mesh->point[ipb];
-+	  /* check MMG_length */
-+	  for (j=0; j<3; j++) {
-+	    ipb = pt1->v[ MMG_idir[nk][j] ];
-+	    ppb = &mesh->point[ipb];
- 
+-
 -            iadr = (ipb-1)*sol->offset + 1;
 -            mb   = &sol->met[iadr];
-+	    iadr = (ipb-1)*sol->offset + 1;
-+	    mb   = &sol->met[iadr];
- 
+-
 -            ux  = ppb->c[0] - ppa->c[0];
 -            uy  = ppb->c[1] - ppa->c[1];
 -            uz  = ppb->c[2] - ppa->c[2];
-+	    ux  = ppb->c[0] - ppa->c[0];
-+	    uy  = ppb->c[1] - ppa->c[1];
-+	    uz  = ppb->c[2] - ppa->c[2];
- 
+-
 -            dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
 -                + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
 -          
 -            dd2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
 -                + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 -            len = 0.5*(dd1+dd2);
-+	    dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
-+	      + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
- 
+-
 -            if ( len < lmi || len > lma )  break;
 -          }
 -          if ( j < 3 )  break;
 -        }
 -        if ( l > lon )  break;
 -        coe *= 0.5;
++	ppa->c[0] = oldc[0] + coe * cpx;
++	ppa->c[1] = oldc[1] + coe * cpy;
++	ppa->c[2] = oldc[2] + coe * cpz;
++
++	for (l=1; l<=lon; l++) {
++	  iel = list.tetra[l] >> 2;
++	  nk  = list.tetra[l] % 4;
++	  pt1 = &mesh->tetra[iel];
++
++	  cal = MMG_caltet(mesh,sol,iel);
++	  if ( cal > ctg )  break;
++	  list.qual[l] = cal;
++
++	  /* check MMG_length */
++	  for (j=0; j<3; j++) {
++	    ipb = pt1->v[ MMG_idir[nk][j] ];
++	    ppb = &mesh->point[ipb];
++
++	    iadr = (ipb-1)*sol->offset + 1;
++	    mb   = &sol->met[iadr];
++
++	    ux  = ppb->c[0] - ppa->c[0];
++	    uy  = ppb->c[1] - ppa->c[1];
++	    uz  = ppb->c[2] - ppa->c[2];
++
++	    dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
++	      + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
++
 +	    dd2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
 +	      + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 +	    len = 0.5*(dd1+dd2);
@@ -12969,7 +12983,7 @@
        }
  
        /* interpol metric */
-@@ -226,9 +226,9 @@
+@@ -226,9 +226,9 @@ ctg = 1000. / ALPHAD;
  
  
  int MMG_optcte(pMesh mesh,pSol sol) {
@@ -12982,7 +12996,7 @@
  
  
    alert  = 0;
-@@ -240,36 +240,35 @@
+@@ -240,36 +240,35 @@ int MMG_optcte(pMesh mesh,pSol sol) {
    it     = 0;
  
    do {
@@ -13038,11 +13052,11 @@
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/optlap.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optlap.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optlap.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optlap.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optlap.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optlap.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -13077,7 +13091,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -13088,7 +13101,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -13097,7 +13110,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -59,23 +59,23 @@
+@@ -59,23 +59,23 @@ int MMG_optlap(pMesh mesh,pSol sol) {
    double    *nv,res,dd,ox,oy,oz,declic;
  
    if(!mesh->disp) {
@@ -13120,9 +13133,9 @@
    assert(nv);
 -  
 -  pdisp         = mesh->disp;	
- 
++
 +  pdisp         = mesh->disp;
-+
+ 
    it  = 1;
    declic = 3./ALPHAD;
    do {
@@ -13131,7 +13144,7 @@
      /*initialisation*/
      for(i = 1 ; i<=mesh->np ; i++) {
        ppt          = &mesh->point[i];
-@@ -83,10 +83,10 @@
+@@ -83,58 +83,58 @@ int MMG_optlap(pMesh mesh,pSol sol) {
        pdisp->mv[3*(i-1) + 1 + 0] = 0.;
        pdisp->mv[3*(i-1) + 1 + 1] = 0.;
        pdisp->mv[3*(i-1) + 1 + 2] = 0.;
@@ -13144,7 +13157,6 @@
      for(k = 1 ; k<=mesh->ne ; k++) {
        pt = &mesh->tetra[k];
        if (!pt->v[0]) continue;
-@@ -93,48 +93,48 @@
        if (pt->qual > declic) continue;
  
        for(i=0 ; i<6 ; i++) {
@@ -13224,7 +13236,7 @@
      }
  
      /*2nd stage : anti-laplacian*/
-@@ -142,14 +142,14 @@
+@@ -142,14 +142,14 @@ int MMG_optlap(pMesh mesh,pSol sol) {
        pt = &mesh->tetra[k];
        if (!pt->v[0]) continue;
        if (pt->qual > declic) continue;
@@ -13246,7 +13258,7 @@
  	if(!(ppta->tag & M_BDRY)) {
  	  pdisp->mv[3*(ipta-1) + 1 + 0] += nv[3*(iptb-1) + 1];
  	  pdisp->mv[3*(ipta-1) + 1 + 1] += nv[3*(iptb-1) + 2];
-@@ -164,119 +164,119 @@
+@@ -164,119 +164,119 @@ int MMG_optlap(pMesh mesh,pSol sol) {
  	}
        }
      }
@@ -13446,11 +13458,11 @@
    } while(it++ < maxiter);
  
    M_free(nv);
-Index: contrib/mmg3d/build/sources/optlen.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optlen.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optlen.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optlen.c	(working copy)
-@@ -76,7 +76,10 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optlen.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optlen.c
+@@ -76,7 +76,10 @@ int MMG_optlen_ani(pMesh mesh,pSol sol,d
      pt = &mesh->tetra[k];
      if ( !pt->v[0] )  continue;
      else if ( pt->flag != base - 1 )  continue;
@@ -13462,7 +13474,7 @@
      for (i=0; i<4; i++) {
        ipa = pt->v[i];
        ppa = &mesh->point[ipa];
-@@ -101,6 +104,12 @@
+@@ -101,6 +104,12 @@ int MMG_optlen_ani(pMesh mesh,pSol sol,d
          iel = list.tetra[l] >> 2;
          nk  = list.tetra[l] % 4;
          pt1 = &mesh->tetra[iel];
@@ -13475,7 +13487,7 @@
          if ( pt1->qual > cal )  cal = pt1->qual;
  
          for (j=0; j<3; j++) {
-@@ -246,9 +255,14 @@
+@@ -246,9 +255,14 @@ nrj = 0;
    do {
      k = MMG_kiupop(queue);
      if ( !k )  break;
@@ -13490,7 +13502,7 @@
      if ( !pt->v[0] )  continue;
     //	else if ( pt->flag != base - 1 ) continue;
      for (i=0; i<4; i++) {
-@@ -273,75 +287,84 @@
+@@ -273,75 +287,84 @@ nrj = 0;
          iel = list.tetra[l] >> 2;
          nk  = list.tetra[l] % 4;
          pt1 = &mesh->tetra[iel];
@@ -13629,7 +13641,7 @@
        if ( nb < 3 )  continue;
        dd  = 1.0 / (double)nb;
        cpx = cx*dd - ppa->c[0];
-@@ -390,9 +413,9 @@
+@@ -390,9 +413,9 @@ memcpy(ppa->c,oldc,3*sizeof(double));
          pt1 = &mesh->tetra[iel];
          pt1->qual = list.qual[l];
          pt1->flag = base;
@@ -13641,7 +13653,7 @@
          if ( pt1->qual < declic )
            MMG_kiudel(queue,iel);
          else if ( coe > 0.1 )
-@@ -442,7 +465,10 @@
+@@ -442,7 +465,10 @@ nrj = 0;
      pt = &mesh->tetra[k];
      if ( !pt->v[0] )  continue;
     	//else if ( pt->flag != base - 1 ) continue;
@@ -13653,7 +13665,7 @@
      for (i=0; i<4; i++) {
        ipa = pt->v[i];
        ppa = &mesh->point[ipa];
-@@ -468,6 +494,12 @@
+@@ -468,6 +494,12 @@ nrj = 0;
          iel = list.tetra[l] >> 2;
          nk  = list.tetra[l] % 4;
          pt1 = &mesh->tetra[iel];
@@ -13666,7 +13678,7 @@
          if ( pt1->qual > cal )  cal = pt1->qual;
  	
  //printf("lon %d cal %e %e\n",kel,pt1->qual,MMG_caltet_iso(mesh,sol,iel));
-@@ -607,4 +639,209 @@
+@@ -607,4 +639,209 @@ nrj = 0;
  
    MMG_kiufree(queue);
    return(nm);
@@ -13877,11 +13889,11 @@
 +  return(nm);
 +} 
 +
-Index: contrib/mmg3d/build/sources/optlentet.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optlentet.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optlentet.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optlentet.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optlentet.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optlentet.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -13916,7 +13928,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -13927,7 +13938,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -13936,7 +13947,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -91,31 +91,31 @@
+@@ -91,31 +91,31 @@ int MMG_optlentet_ani(pMesh mesh,pSol so
        if ( pt1->qual > cal )  cal = pt1->qual;
  
        for (j=0; j<3; j++) {
@@ -13953,10 +13964,7 @@
 -  	ux  = ppb->c[0] - ppa->c[0];
 -  	uy  = ppb->c[1] - ppa->c[1];
 -  	uz  = ppb->c[2] - ppa->c[2];
-+	ux  = ppb->c[0] - ppa->c[0];
-+	uy  = ppb->c[1] - ppa->c[1];
-+	uz  = ppb->c[2] - ppa->c[2];
- 
+-
 -  	dd1 =	   mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
 -  	    + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
 -  	
@@ -13965,15 +13973,20 @@
 -  	len = 0.5*(dd1+dd2);
 -  	if ( len < lmi )      lmi = len;
 -  	else if (len > lma )  lma = len;
-+	dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
-+	  + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
- 
+-
 -  	/* optimal point */
 -  	len = 1.0 / sqrt(dd1);
 -  	cx += ppa->c[0] + ux * len;
 -  	cy += ppa->c[1] + uy * len;
 -  	cz += ppa->c[2] + uz * len;
 -  	nb++;
++	ux  = ppb->c[0] - ppa->c[0];
++	uy  = ppb->c[1] - ppa->c[1];
++	uz  = ppb->c[2] - ppa->c[2];
++
++	dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
++	  + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
++
 +	dd2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
 +	  + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 +	len = 0.5*(dd1+dd2);
@@ -13989,57 +14002,63 @@
        }
      }
      if ( nb < 3 )  continue;
-@@ -141,36 +141,36 @@
+@@ -141,36 +141,36 @@ int MMG_optlentet_ani(pMesh mesh,pSol so
        ppa->c[2] = oldc[2] + coe * cpz;
  
        for (l=1; l<=lon; l++) {
 -  	iel = list.tetra[l] >> 2;
 -  	nk  = list.tetra[l] % 4;
 -  	pt1 = &mesh->tetra[iel];
-+	iel = list.tetra[l] >> 2;
-+	nk  = list.tetra[l] % 4;
-+	pt1 = &mesh->tetra[iel];
- 
+-
 -  	cal = MMG_caltet(mesh,sol,iel);
 -  	if ( cal > ctg )  break;
 -  	list.qual[l] = cal;
-+	cal = MMG_caltet(mesh,sol,iel);
-+	if ( cal > ctg )  break;
-+	list.qual[l] = cal;
- 
+-
 -  	/* check length */
 -  	for (j=0; j<3; j++) {
 -  	  ipb = pt1->v[ MMG_idir[nk][j] ];
 -  	  ppb = &mesh->point[ipb];
-+	/* check length */
-+	for (j=0; j<3; j++) {
-+	  ipb = pt1->v[ MMG_idir[nk][j] ];
-+	  ppb = &mesh->point[ipb];
- 
+-
 -  	  iadr = (ipb-1)*sol->offset + 1;
 -  	  mb   = &sol->met[iadr];
-+	  iadr = (ipb-1)*sol->offset + 1;
-+	  mb   = &sol->met[iadr];
- 
+-
 -  	  ux  = ppb->c[0] - ppa->c[0];
 -  	  uy  = ppb->c[1] - ppa->c[1];
 -  	  uz  = ppb->c[2] - ppa->c[2];
-+	  ux  = ppb->c[0] - ppa->c[0];
-+	  uy  = ppb->c[1] - ppa->c[1];
-+	  uz  = ppb->c[2] - ppa->c[2];
- 
+-
 -  	  dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
 -  	      + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
 -  	
 -  	  dd2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
 -  	      + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 -  	  len = 0.5*(dd1+dd2);
-+	  dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
-+	    + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
- 
+-
 -  	  if ( len < lmi || len > lma )  break;
 -  	}
 -  	if ( j < 3 )  break;
++	iel = list.tetra[l] >> 2;
++	nk  = list.tetra[l] % 4;
++	pt1 = &mesh->tetra[iel];
++
++	cal = MMG_caltet(mesh,sol,iel);
++	if ( cal > ctg )  break;
++	list.qual[l] = cal;
++
++	/* check length */
++	for (j=0; j<3; j++) {
++	  ipb = pt1->v[ MMG_idir[nk][j] ];
++	  ppb = &mesh->point[ipb];
++
++	  iadr = (ipb-1)*sol->offset + 1;
++	  mb   = &sol->met[iadr];
++
++	  ux  = ppb->c[0] - ppa->c[0];
++	  uy  = ppb->c[1] - ppa->c[1];
++	  uz  = ppb->c[2] - ppa->c[2];
++
++	  dd1 =      mp[0]*ux*ux + mp[3]*uy*uy + mp[5]*uz*uz \
++	    + 2.0*(mp[1]*ux*uy + mp[2]*ux*uz + mp[4]*uy*uz);
++
 +	  dd2 =      mb[0]*ux*ux + mb[3]*uy*uy + mb[5]*uz*uz \
 +	    + 2.0*(mb[1]*ux*uy + mb[2]*ux*uz + mb[4]*uy*uz);
 +	  len = 0.5*(dd1+dd2);
@@ -14050,7 +14069,7 @@
        }
        if ( l > lon )  break;
        coe *= 0.5;
-@@ -186,12 +186,12 @@
+@@ -186,22 +186,22 @@ int MMG_optlentet_ani(pMesh mesh,pSol so
        iel = list.tetra[l] >> 2;
        nk  = list.tetra[l] % 4;
        pt1 = &mesh->tetra[iel];
@@ -14067,7 +14086,6 @@
      }
  
      /* interpol metric */
-@@ -198,10 +198,10 @@
      ppa->flag = mesh->flag + 1;
      break;
    }
@@ -14081,7 +14099,7 @@
    return(0);
  }
  
-@@ -227,7 +227,7 @@
+@@ -227,7 +227,7 @@ int MMG_optlentet_iso(pMesh mesh,pSol so
  
      lon = MMG_boulep(mesh,k,i,&list);
      if ( lon < 4 )  continue;
@@ -14090,7 +14108,7 @@
      /* optimal point */
      ca   = &ppa->c[0];
      iadr = (ipa-1)*sol->offset + 1;
-@@ -246,25 +246,25 @@
+@@ -246,25 +246,25 @@ int MMG_optlentet_iso(pMesh mesh,pSol so
        if ( pt1->qual > cal )  cal = pt1->qual;
  
        for (j=0; j<3; j++) {
@@ -14102,6 +14120,17 @@
 -    	len  = MMG_length(ca,cb,&hp,&hb);
 -        if ( len < lmi )       lmi = len;
 -    	else if ( len > lma )  lma = len;
+-
+-        /* optimal point */
+-        ux  = cb[0] - ca[0];
+-    	uy  = cb[1] - ca[1];
+-    	uz  = cb[2] - ca[2];
+-
+-        len = 1.0 / len;
+-    	cx += ca[0] + ux * len;
+-    	cy += ca[1] + uy * len;
+-    	cz += ca[2] + uz * len;
+-    	nb++;
 +	ipb  = pt1->v[ MMG_idir[nk][j] ];
 +	ppb  = &mesh->point[ipb];
 +	iadr = (ipb-1)*sol->offset + 1;
@@ -14110,21 +14139,12 @@
 +	len  = MMG_length(ca,cb,&hp,&hb);
 +	if ( len < lmi )       lmi = len;
 +	else if ( len > lma )  lma = len;
- 
--        /* optimal point */
--        ux  = cb[0] - ca[0];
--    	uy  = cb[1] - ca[1];
--    	uz  = cb[2] - ca[2];
++
 +	/* optimal point */
 +	ux  = cb[0] - ca[0];
 +	uy  = cb[1] - ca[1];
 +	uz  = cb[2] - ca[2];
- 
--        len = 1.0 / len;
--    	cx += ca[0] + ux * len;
--    	cy += ca[1] + uy * len;
--    	cz += ca[2] + uz * len;
--    	nb++;
++
 +	len = 1.0 / len;
 +	cx += ca[0] + ux * len;
 +	cy += ca[1] + uy * len;
@@ -14133,7 +14153,7 @@
        }
      }
      if ( nb < 3 )  continue;
-@@ -290,28 +290,28 @@
+@@ -290,28 +290,28 @@ int MMG_optlentet_iso(pMesh mesh,pSol so
        ca[2] = oldc[2] + coe * cpz;
  
        for (l=1; l<=lon; l++) {
@@ -14144,10 +14164,7 @@
 -    	cal = MMG_caltet(mesh,sol,iel);
 -    	if ( cal > ctg )  break;
 -    	list.qual[l] = cal;
-+	iel = list.tetra[l] >> 2;
-+	nk  = list.tetra[l] % 4;
-+	pt1 = &mesh->tetra[iel];
- 
+-
 -    	/* check length */
 -    	for (j=0; j<3; j++) {
 -    	  ipb = pt1->v[ MMG_idir[nk][j] ];
@@ -14162,6 +14179,10 @@
 -    	  }
 -        }
 -    	if ( j < 3 )  break;
++	iel = list.tetra[l] >> 2;
++	nk  = list.tetra[l] % 4;
++	pt1 = &mesh->tetra[iel];
++
 +	cal = MMG_caltet(mesh,sol,iel);
 +	if ( cal > ctg )  break;
 +	list.qual[l] = cal;
@@ -14183,7 +14204,7 @@
        }
        if ( l > lon )  break;
        coe *= 0.5;
-@@ -331,9 +331,9 @@
+@@ -331,9 +331,9 @@ int MMG_optlentet_iso(pMesh mesh,pSol so
        pt1->flag = mesh->flag;
  
        if ( pt1->qual < declic )
@@ -14196,7 +14217,7 @@
      }
  
  
-@@ -341,9 +341,9 @@
+@@ -341,9 +341,9 @@ int MMG_optlentet_iso(pMesh mesh,pSol so
      ppa->flag = mesh->flag + 1;
      break;
    }
@@ -14209,11 +14230,11 @@
 +
    return(0);
  }
-Index: contrib/mmg3d/build/sources/optra4.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optra4.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/optra4.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/optra4.c	(working copy)
-@@ -46,12 +46,23 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/optra4.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/optra4.c
+@@ -46,12 +46,23 @@ along with MMG3D. If not, see <http://ww
  #include "mesh.h"
  
  int MMG_pretreat(pMesh ,pSol ,double ,int *);
@@ -14238,7 +14259,7 @@
    /* optim coquil */
    alert  = 0;
    maxtou = 20;//0;
-@@ -72,9 +83,10 @@
+@@ -72,9 +83,10 @@ int MMG_optra4(pMesh mesh,pSol sol) {
      base = ++mesh->flag;
  //MMG_ratio(mesh,sol,NULL); 
      ns = 0;
@@ -14252,7 +14273,7 @@
          alert = 1;
      	ns    = -ns;
        }
-@@ -85,22 +97,251 @@
+@@ -85,22 +97,251 @@ int MMG_optra4(pMesh mesh,pSol sol) {
      /*sur des surfaces courbes, il existe des tetras ayant  4 points de peau avec Q=3*/
      if ( it < 10 )  {
        nwold = nw;
@@ -14410,9 +14431,9 @@
 +  /* MMG_chkmsh(mesh,0,0); */
 +  ////////////////////////////////////////////////////////////////////////////////////
 +
-   return(1);
- }
- 
++  return(1);
++}
++
 +int MMG_optra4_LES(pMesh mesh,pSol sol) {  
 +  pTetra  pt;  
 +  double	declicw;
@@ -14506,14 +14527,14 @@
 +  }
 +
 +
-+  return(1);
-+}
-+
-Index: contrib/mmg3d/build/sources/opttet.c
+   return(1);
+ }
+ 
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/opttet.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/opttet.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/opttet.c	(working copy)
-@@ -76,7 +76,7 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/opttet.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/opttet.c
+@@ -76,7 +76,7 @@ int iterworst,nw;
  //printf("--------------- iter %d : declicw %e\n",iterworst,declicw*ALPHAD);
  //MMG_outqua(mesh,sol);
       if (!mesh->info.noswap) 
@@ -14522,11 +14543,11 @@
     } while((iterworst++ < 0) && nw);
     MMG_outqua(mesh,sol);
     puts("  ");
-Index: contrib/mmg3d/build/sources/opttyp.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/opttyp.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/opttyp.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/opttyp.c	(working copy)
-@@ -52,7 +52,7 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/opttyp.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/opttyp.c
+@@ -52,17 +52,17 @@ along with MMG3D. If not, see <http://ww
  int MMG_colpoi2(pMesh mesh,pSol sol,int iel,int ia,int ib,double coef);
  
  /* optimize mesh quality based on element type */
@@ -14535,7 +14556,6 @@
    pTetra     pt,pt1;
    pPoint     pa,pb;
    List       list;
-@@ -59,10 +59,10 @@
    pQueue     queue;
    double      crit;
    double     len,*ca,*cb,*ma,*mb;
@@ -14549,7 +14569,7 @@
  
    /*classification des mauvais : 0 si pas sur la peau*/
    /*				 1 si au moins une face de peau */
-@@ -76,10 +76,10 @@
+@@ -76,10 +76,10 @@ double LLONG2;
      nbt = 0;
      for(k=1 ; k<=mesh->ne ; k++) {
        pt = &mesh->tetra[k];
@@ -14562,7 +14582,7 @@
     
        iadr = 4*(k-1) + 1;
        adja = &mesh->adja[iadr];
-@@ -87,11 +87,11 @@
+@@ -87,11 +87,11 @@ double LLONG2;
          if(!adja[i])break;     
        }
        if(i==4) {
@@ -14578,7 +14598,7 @@
        } else cs[1]++;
      }
  
-@@ -105,9 +105,8 @@
+@@ -105,9 +105,8 @@ double LLONG2;
    
    
    /*traitement des mauvais*/
@@ -14589,7 +14609,7 @@
    assert(queue);
  
    memset(cs,0,10*sizeof(int)); 
-@@ -122,21 +121,27 @@
+@@ -122,21 +121,27 @@ double LLONG2;
    }
  
    np = 0;
@@ -14621,7 +14641,7 @@
      iadr = 4*(k-1) + 1;
      adja = &mesh->adja[iadr];
      /*optim bdry tetra*/
-@@ -144,7 +149,6 @@
+@@ -144,7 +149,6 @@ cs[ityp]++;
      for(i=0 ; i<4 ; i++) {
        if(!adja[i])npeau++;     
      }
@@ -14629,7 +14649,7 @@
      if(npeau>1 && !mesh->info.noswap) {
        if(mesh->info.imprim<-4) printf("%d faces de peau!!!! %d (typ %d) %e\n",npeau,k,ityp,pt->qual * ALPHAD);
        dsb[0]++;
-@@ -159,12 +163,14 @@
+@@ -159,12 +163,14 @@ cs[ityp]++;
        if(dpeau) { 
          nd++;
          ds[ityp]++;
@@ -14647,7 +14667,7 @@
        iar = item[0];
        lon = MMG_coquil(mesh,k,iar,&list);
        if ( lon > 2 ) {
-@@ -172,16 +178,31 @@
+@@ -172,16 +178,31 @@ cs[ityp]++;
          for (l=2; l<=lon; l++) {
            iel = list.tetra[l] / 6;
            pt1 = &mesh->tetra[iel];
@@ -14686,7 +14706,7 @@
            ia  = MMG_iare[iar][0];
            ib  = MMG_iare[iar][1];
            ipa = pt->v[ia];
-@@ -189,37 +210,37 @@
+@@ -189,37 +210,37 @@ cs[ityp]++;
            ca  = &mesh->point[ipa].c[0];
            cb  = &mesh->point[ipb].c[0];
            
@@ -14746,7 +14766,7 @@
        }
        for(i=0 ; i<6 ; i++) {
        	if(i==item[0]) continue;
-@@ -229,54 +250,66 @@
+@@ -229,54 +250,66 @@ cs[ityp]++;
            for (l=2; l<=lon; l++) {
              iel = list.tetra[l] / 6;
              pt1 = &mesh->tetra[iel];
@@ -14759,6 +14779,13 @@
 -          crit *= OCRIT;
 -          
 -          ier = MMG_swapar(mesh,sol,queue,&list,lon,crit,declic);
+-
+-	      if ( ier == 0 && !mesh->info.noinsert) {
+-           	/*if ( MMG_voltet(mesh,k) < 5.e-9 ) {     //degrade trop les maillages!!!
+-			  crit *= 2.;
+-			  crit = M_MIN(crit,8e+8);
+-			} */
+-		    ia  = MMG_iare[i][0];
 +#ifdef REQUIRED
 +	  //CEDRIC
 +	  if(l<lon)  {
@@ -14771,13 +14798,7 @@
 +#ifdef REQUIRED
 +	  }
 +#endif
- 
--	      if ( ier == 0 && !mesh->info.noinsert) {
--           	/*if ( MMG_voltet(mesh,k) < 5.e-9 ) {     //degrade trop les maillages!!!
--			  crit *= 2.;
--			  crit = M_MIN(crit,8e+8);
--			} */
--		    ia  = MMG_iare[i][0];
++
 +	  if ( ier == 0 && !mesh->info.noinsert) {
 +	    /*if ( MMG_voltet(mesh,k) < 5.e-9 ) {     //degrade trop les maillages!!!
 +	      crit *= 2.;
@@ -14846,7 +14867,7 @@
          } /*end if lon==2*/
        } /*end for i*/
        if(i<6) break;
-@@ -284,12 +317,12 @@
+@@ -284,12 +317,12 @@ cs[ityp]++;
        for(i=0 ; i<4 ; i++) {
          if(MMG_movevertex(mesh,sol,k,i)) {
            nd++;
@@ -14862,7 +14883,7 @@
      case 2:  /* chapeau */
        /*on essaie de decoller le point de l'arete*/
        iar = item[0];
-@@ -310,77 +343,96 @@
+@@ -310,77 +343,96 @@ cs[ityp]++;
  
      case 3:  /* aileron */
        iar = item[1];
@@ -14871,6 +14892,10 @@
 -       	MMG_swap23(mesh,sol,queue,k,iar,crit);
 -	nd++;
 -        ds[ityp]++;
+-	break;
+-      }
+-      else if ( ier < 0 ) {
+-	*alert = 1;
 -	break;
 +      if(!mesh->info.noswap) {
 +	ier = MMG_simu23(mesh,sol,k,iar,crit); //bizarre le crit la!!!
@@ -14887,10 +14912,6 @@
 +      } else { /*noswap*/
 +	ier = 0;
        }
--      else if ( ier < 0 ) {
--	*alert = 1;
--	break;
--      }
 +     
  
        iar = item[0];
@@ -15021,7 +15042,7 @@
        /*move vertex*/
        for(i=0 ; i<4 ; i++) {
          if(MMG_movevertex(mesh,sol,k,i)) {
-@@ -472,28 +524,40 @@
+@@ -472,28 +524,40 @@ cs[ityp]++;
        
        crit = pt->qual;
        for (l=2; l<=lon; l++) {
@@ -15079,7 +15100,7 @@
        }
        if ( ier > 0 ) {
          nd++;
-@@ -527,7 +591,7 @@
+@@ -527,7 +591,7 @@ cs[ityp]++;
          pa  = &mesh->point[ipa];
          pb  = &mesh->point[ipb];
          if ( !(pb->tag & M_BDRY) && MMG_colpoi2(mesh,sol,k,ia,ib,QDEGRAD) ) {
@@ -15088,7 +15109,7 @@
  	  nd++;
            MMG_delPt(mesh,ipb);
            ds[ityp]++;
-@@ -554,8 +618,14 @@
+@@ -554,8 +618,14 @@ cs[ityp]++;
          for (l=2; l<=lon; l++) {
            iel = list.tetra[l] / 6;
            pt1 = &mesh->tetra[iel];
@@ -15104,7 +15125,7 @@
          crit *= OCRIT;
  
          ia  = MMG_iare[iarmax][0];
-@@ -571,11 +641,11 @@
+@@ -571,11 +641,11 @@ cs[ityp]++;
          mb   = &sol->met[iadr];
  	
  	len = MMG_length(ca,cb,ma,mb);
@@ -15118,7 +15139,7 @@
            ds[ityp]++;
            break;
          }
-@@ -621,13 +691,19 @@
+@@ -621,13 +691,19 @@ cs[ityp]++;
            for (l=2; l<=lon; l++) {
              iel = list.tetra[l] / 6;
              pt1 = &mesh->tetra[iel];
@@ -15141,7 +15162,7 @@
              ds[ityp]++;
              break;
            }
-@@ -637,40 +713,48 @@
+@@ -637,47 +713,55 @@ cs[ityp]++;
        if(i<6) break;
        if(ier) break;
        /*MMG_swap arete*/
@@ -15217,7 +15238,6 @@
        break;
      }
       
-@@ -677,7 +761,7 @@
    }
    while ( k && *alert == 0 );
  
@@ -15226,7 +15246,7 @@
  	
      for (k=0; k<=7; k++)
        if ( cs[k] )
-@@ -692,46 +776,45 @@
+@@ -692,46 +776,45 @@ ds[ityp]++;
  
    }
  
@@ -15259,17 +15279,18 @@
 -  ier   = 0;
 -  queue = MMG_kiuini(mesh,mesh->nemax,declic,base);
 -  assert(queue);
-+  /* base  = -1;
-+     ier   = 0;
-+     queue = MMG_kiuini(mesh,mesh->nemax,declic,base);
-+     assert(queue);
- 
+-
 -  do {
 -    k = MMG_kiupop(queue);
 -    if ( !k )  break;
 -    pt = &mesh->tetra[k];
 -    if ( !pt->v[0] )  continue;
 -    else if ( pt->qual < declic )  continue;
++  /* base  = -1;
++     ier   = 0;
++     queue = MMG_kiuini(mesh,mesh->nemax,declic,base);
++     assert(queue);
++
 +     do {
 +     k = MMG_kiupop(queue);
 +     if ( !k )  break;
@@ -15287,6 +15308,10 @@
 -        break;
 -      }
 -    }
+-
+-  }
+-  while ( k && *alert == 0 );
+-  MMG_kiufree(queue);*/
 +     for (i=0; i<4; i++) {
 +     if(MMG_simu23(mesh,sol,k,i,crit)) {
 +     printf("je swap\n");
@@ -15294,17 +15319,14 @@
 +     break;
 +     }
 +     }
- 
--  }
--  while ( k && *alert == 0 );
--  MMG_kiufree(queue);*/
++
 +     }
 +     while ( k && *alert == 0 );
 +     MMG_kiufree(queue);*/
  
  
    return(nd);
-@@ -797,10 +880,14 @@
+@@ -797,10 +880,14 @@ int MMG_pretreat(pMesh mesh,pSol sol,dou
          }
  	/*if(crit > wqual) {  
            crit *= 2.;
@@ -15322,7 +15344,7 @@
  	ier = 0;
          if (!mesh->info.noinsert)
            ier = MMG_spledg(mesh,sol,queue,&list,lon,crit,declic);
-@@ -813,8 +900,8 @@
+@@ -813,8 +900,8 @@ int MMG_pretreat(pMesh mesh,pSol sol,dou
    }  
    while ( k && *alert == 0 );
  
@@ -15333,11 +15355,11 @@
  
    return(nd);
  }
-Index: contrib/mmg3d/build/sources/outqua.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/outqua.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/outqua.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/outqua.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/outqua.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/outqua.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -15372,7 +15394,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -15383,7 +15404,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -15392,7 +15413,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -51,11 +51,11 @@
+@@ -51,11 +51,11 @@ int MMG_outqua(pMesh mesh,pSol sol) {
    double    coef,rap4,rapl,rapmin,rapmax,rapavg,dcal;
    int       his10[11],his01[33],rapnum,iout;
    int       k,i,j,imax,iel,ir,nn,nex,ielreal,tmp;
@@ -15407,7 +15428,7 @@
    rapmin  =  1.e20;
    rapmax  = -1.e20;
    rapavg  = 0.0;
-@@ -75,16 +75,17 @@
+@@ -75,16 +75,17 @@ int MMG_outqua(pMesh mesh,pSol sol) {
        nex++;
        continue;
      }
@@ -15431,7 +15452,7 @@
        if(dcal == CALLIM) {
          printf("Wrong elt %d : %d %d %d %d (qual %e (%e) %13.12f)\n",k,pt->v[0],pt->v[1],pt->v[2],pt->v[3],rap4,rap4/coef,MMG_voltet(mesh,k));
          printf("vextex 0 : %e %e %e\n",mesh->point[pt->v[0]].c[0],mesh->point[pt->v[0]].c[1],mesh->point[pt->v[0]].c[2]);
-@@ -92,7 +93,7 @@
+@@ -92,7 +93,7 @@ int MMG_outqua(pMesh mesh,pSol sol) {
          printf("vextex 2 : %e %e %e\n",mesh->point[pt->v[2]].c[0],mesh->point[pt->v[2]].c[1],mesh->point[pt->v[2]].c[2]);
          printf("vextex 3 : %e %e %e\n",mesh->point[pt->v[3]].c[0],mesh->point[pt->v[3]].c[1],mesh->point[pt->v[3]].c[2]);
          //MMG_saveMesh(mesh,"titi.mesh");
@@ -15440,7 +15461,7 @@
          iout += 1;
        }
  			if(abs(mesh->info.imprim) > 5) printf("reorient tet %d\n",k);
-@@ -101,11 +102,11 @@
+@@ -101,11 +102,11 @@ int MMG_outqua(pMesh mesh,pSol sol) {
      //rap4 = M_MIN(rap4,1.0e9);
      ir   = (int)rap4;
      if ( rap4 > rapmax ) {
@@ -15454,7 +15475,7 @@
      rapnum++;
  
      if ( rap4 > 1.0 && rap4 < 17e10 ) {
-@@ -118,12 +119,11 @@
+@@ -118,12 +119,11 @@ int MMG_outqua(pMesh mesh,pSol sol) {
          rapl = M_MIN(log10(rap4),32.0);
          his01[(int)rapl] += 1;
  	    his01[0]  += 1;
@@ -15468,7 +15489,7 @@
    fprintf(stdout,"\n  -- MESH QUALITY   %d \n",rapnum);
    if ( (rapavg > 0) && (rapavg / rapnum < 100.0) )
      fprintf(stdout,"     AVERAGE QUALITY        %12.4f\n",rapavg / rapnum);
-@@ -136,7 +136,7 @@
+@@ -136,18 +136,18 @@ int MMG_outqua(pMesh mesh,pSol sol) {
    fprintf(stdout,"     WORST ELEMENT   %d (%d)   %d %d %d %d\n",
  	  iel,ielreal,pt->v[0],pt->v[1],pt->v[2],pt->v[3]);
  
@@ -15477,7 +15498,6 @@
  
    fprintf(stdout,"\n     HISTOGRAMM\n");
    j = 0;
-@@ -143,11 +143,11 @@
    for (i=1; i<32; i++)
      j += his01[i];
  
@@ -15493,10 +15513,11 @@
    for (i=M_MAX((int)rapmin,1); i<=imax; i++) {
      fprintf(stdout,"     %5d < Q < %5d   %7d   %6.2f %%\n",
  	    i,i+1,his10[i],100.*(his10[i]/(float)his01[0]));
-@@ -166,21 +166,56 @@
+@@ -166,21 +166,56 @@ int MMG_outqua(pMesh mesh,pSol sol) {
        fprintf(stdout,"    10**%2d < Q < 10**%2d  %7d   %6.2f %%\n",
  	      i,i+1,his01[i],100.*(his01[i]/(float)his01[0]));
      }
+-    }
 +  }
 +  return(iout);
 +}
@@ -15514,10 +15535,12 @@
 +  iel     = 0;
 +  ielreal = 0;
 +  nn      = 0;
-+
+ 
+-  //}
 +  for (k=0; k<=32; k++)  his01[k] = 0;
 +  for (k=0; k<=10; k++)  his10[k] = 0;
-+
+ 
+-  return(iout);
 +  coef = ALPHAD;
 +  nex  = 0;
 +  for (k=1; k<=mesh->ne; k++) {
@@ -15525,7 +15548,7 @@
 +    if( !pt->v[0] ) {
 +      nex++;
 +      continue;
-     }
++    }
 + 
 +    nn++;     
 +    dcal = MMG_caltet(mesh,sol,k);//(sol->offset==6) ? MMG_caltet_ani(mesh,sol,k) : MMG_caltet_iso(mesh,sol,k);             
@@ -15535,10 +15558,7 @@
 +    if ((dcal == CALLIM) || ( rap4 > rapmax ))
 +      eltab[k] = 1;
 +  }
- 
--  //}
--
--  return(iout);
++
 +  return(1);
  }
  
@@ -15556,7 +15576,7 @@
    nex   = 0;
    nreal = 0;
    for(k=1 ; k<=mesh->ne ; k++) {
-@@ -194,8 +229,8 @@
+@@ -194,8 +229,8 @@ double MMG_priworst(pMesh mesh, pSol sol
        nbad  = k - nex;
        nreal = k;
      }
@@ -15567,7 +15587,7 @@
    if(nreal) printf("     worst quality %d (%d): %e %e\n",nreal,nbad,bad*ALPHAD,ALPHAC*MMG_calte1(mesh,sol,nreal));
  
    return((&mesh->tetra[nreal])->qual);
-@@ -206,9 +241,9 @@
+@@ -206,9 +241,9 @@ int MMG_outquacubic(pMesh mesh,pSol sol)
    double    rapmin,rapmax,rapavg,dcal,som;
    int       his10[11],his01[5],rapnum,iout;
    int       k,i,j,iel,ir,nn,nex,ielreal,hismin;
@@ -15579,7 +15599,7 @@
    rapmin  = 0.;
    rapmax  = 1.;
    rapavg  = 0.0;
-@@ -217,7 +252,7 @@
+@@ -217,7 +252,7 @@ int MMG_outquacubic(pMesh mesh,pSol sol)
    ielreal = 0;
    nn      = 0;
  
@@ -15588,7 +15608,7 @@
    for (k=0; k<=10; k++)  his10[k] = 0;
  
    nex  = 0;
-@@ -227,12 +262,12 @@
+@@ -227,19 +262,19 @@ int MMG_outquacubic(pMesh mesh,pSol sol)
        nex++;
        continue;
      }
@@ -15604,7 +15624,6 @@
      if(dcal == 0.) {
        printf("Wrong elt %d (qual %e)\n",k,dcal);
        iout += 1;
-@@ -239,7 +274,7 @@
      }
      ir   = (int)(dcal*10);
      if ( dcal < rapmax ) {
@@ -15613,7 +15632,7 @@
        iel     = k;
        ielreal = k - nex;
      }
-@@ -252,7 +287,7 @@
+@@ -252,17 +287,17 @@ int MMG_outquacubic(pMesh mesh,pSol sol)
          his10[ir] += 1;
  	    his01[0]  += 1;
        }
@@ -15622,7 +15641,6 @@
          if(dcal > 0.01) {
            his01[1] += 1;
          } else if  (dcal > 0.001) {
-@@ -259,10 +294,10 @@
            his01[2] += 1;
          } else if  (dcal > 0.0001) {
            his01[3] += 1;
@@ -15635,7 +15653,7 @@
      }
    }
  
-@@ -285,23 +320,23 @@
+@@ -285,30 +320,30 @@ int MMG_outquacubic(pMesh mesh,pSol sol)
    j = 0;
    for (i=1; i<4; i++)
      j += his01[i];
@@ -15667,7 +15685,6 @@
      j -= his01[1];
      if(his01[1]!=0)
        fprintf(stdout,"     0.01   < Q <  0.1   %7d   %6.2f %%\n",
-@@ -308,7 +343,7 @@
  	      his01[1],100.*(his01[1]/(float)his01[0]));
      if(j!=0)
        fprintf(stdout,"     0.001  < Q <  0.01  %7d   %6.2f %%\n",
@@ -15676,7 +15693,7 @@
      j -= his01[2];
      if(j!=0)
        fprintf(stdout,"     0.0001 < Q <  0.001 %7d   %6.2f %%\n",
-@@ -319,4 +354,113 @@
+@@ -319,4 +354,113 @@ int MMG_outquacubic(pMesh mesh,pSol sol)
    	      his01[4],100.*(his01[1]/(float)his01[0]));
     }
    return(iout);
@@ -15790,11 +15807,11 @@
 +  }
 +  return(iout);
  }
-Index: contrib/mmg3d/build/sources/pattern.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/pattern.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/pattern.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/pattern.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/pattern.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/pattern.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -15829,7 +15846,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -15840,7 +15856,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,12 +41,12 @@
+@@ -41,26 +41,26 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -15855,7 +15871,6 @@
  extern int MMG_permar[10][4];
  extern int MMG_pointar[64][2];
  extern int ddebug;
-@@ -53,14 +53,14 @@
  //insert ip on ia-ib
  int MMG_pattern1(pMesh mesh,pSol sol,pHedge hash,int jel) {
    pTetra     pt,pt1;
@@ -15875,7 +15890,7 @@
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
      ib = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][1]];
      ic = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][2]];
-@@ -70,7 +70,7 @@
+@@ -70,7 +70,7 @@ int MMG_pattern1(pMesh mesh,pSol sol,pHe
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -15884,7 +15899,7 @@
    ip = MMG_edgePoint(hash,ia,ib);
    assert(ip);
    if(ddebug) printf("ia %d %d %d %d\n",ia,ib,ic,id);
-@@ -78,15 +78,15 @@
+@@ -78,15 +78,15 @@ int MMG_pattern1(pMesh mesh,pSol sol,pHe
    pt->v[1] = ip;
    pt->v[2] = ic;
    pt->v[3] = id;
@@ -15904,7 +15919,7 @@
    iel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[iel];
    pt1->v[0] = ip;
-@@ -95,24 +95,24 @@
+@@ -95,24 +95,24 @@ int MMG_pattern1(pMesh mesh,pSol sol,pHe
    pt1->v[3] = id;
    pt1->qual = MMG_caltet(mesh,sol,iel);
    pt1->ref  = pt->ref;
@@ -15936,7 +15951,7 @@
  
    if(pt->tabedg != 12) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
-@@ -124,25 +124,25 @@
+@@ -124,25 +124,25 @@ int MMG_pattern2(pMesh mesh,pSol sol,pHe
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -15970,7 +15985,7 @@
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
    pt1->v[0] = ib;
-@@ -170,7 +170,7 @@
+@@ -170,7 +170,7 @@ int MMG_pattern2(pMesh mesh,pSol sol,pHe
    pt1->bdryref[1] = tabref[1];
    pt1->bdryref[2] = -1;
    pt1->bdryref[3] = tabref[3];
@@ -15979,7 +15994,7 @@
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
    pt1->v[0] = ia;
-@@ -184,16 +184,16 @@
+@@ -184,16 +184,16 @@ int MMG_pattern2(pMesh mesh,pSol sol,pHe
    pt1->bdryref[1] = -1;
    pt1->bdryref[2] = tabref[2];
    pt1->bdryref[3] = tabref[3];
@@ -16001,7 +16016,7 @@
  
    if(pt->tabedg != 17) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
-@@ -205,16 +205,16 @@
+@@ -205,16 +205,16 @@ int MMG_pattern22(pMesh mesh,pSol sol,pH
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -16022,7 +16037,7 @@
    //if(pt->qual==CALLIM) puts("ahhhhhhhhh1");
    pt->tabedg = 0;
    pt->flag = mesh->flag;
-@@ -222,7 +222,7 @@
+@@ -222,7 +222,7 @@ int MMG_pattern22(pMesh mesh,pSol sol,pH
    pt->bdryref[1] = -1;
    pt->bdryref[2] = tabref[2];
    pt->bdryref[3] = tabref[3];
@@ -16031,7 +16046,7 @@
    if ( ia > id ) {
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -248,7 +248,7 @@
+@@ -248,7 +248,7 @@ int MMG_pattern22(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("ahhhhhhhhh11");
      pt1->ref  = pt->ref;
@@ -16040,7 +16055,7 @@
      pt1->bdryref[0] = -1;
      pt1->bdryref[1] = tabref[1];
      pt1->bdryref[2] = tabref[2];
-@@ -278,25 +278,25 @@
+@@ -278,25 +278,25 @@ int MMG_pattern22(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("ahvvhhhhhhhh11");
      pt1->ref  = pt->ref;
@@ -16073,7 +16088,7 @@
    if(pt->tabedg != 21) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
      ib = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][1]];
-@@ -307,8 +307,8 @@
+@@ -307,27 +307,27 @@ int MMG_pattern3(pMesh mesh,pSol sol,pHe
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -16084,7 +16099,6 @@
    iad = MMG_edgePoint(hash,ia,id);
    assert(iad>0);
    iab = MMG_edgePoint(hash,ia,ib);
-@@ -315,12 +315,12 @@
    assert(iab>0);
    ibd = MMG_edgePoint(hash,ib,id);
    assert(ibd>0);
@@ -16099,7 +16113,6 @@
    pt->tabedg = 0;
    pt->flag = mesh->flag;
    pt->bdryref[0] = tabref[0];
-@@ -327,7 +327,7 @@
    pt->bdryref[1] = -1;
    pt->bdryref[2] = tabref[2];
    pt->bdryref[3] = tabref[3];
@@ -16108,7 +16121,7 @@
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
    pt1->v[0] = ia;
-@@ -349,13 +349,13 @@
+@@ -349,13 +349,13 @@ int MMG_pattern3(pMesh mesh,pSol sol,pHe
    pt1->v[2] = ic;
    pt1->v[3] = id;
    pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16124,7 +16137,7 @@
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
    pt1->v[0] = iab;
-@@ -369,18 +369,18 @@
+@@ -369,18 +369,18 @@ int MMG_pattern3(pMesh mesh,pSol sol,pHe
    pt1->bdryref[1] = -1;
    pt1->bdryref[2] = -1;
    pt1->bdryref[3] = tabref[2];
@@ -16148,7 +16161,7 @@
    if(pt->tabedg != 52) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
      ib = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][1]];
-@@ -391,8 +391,8 @@
+@@ -391,8 +391,8 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -16159,7 +16172,7 @@
    iad = MMG_edgePoint(hash,ia,id);
    assert(iad>0);
    icd = MMG_edgePoint(hash,ic,id);
-@@ -404,7 +404,7 @@
+@@ -404,16 +404,16 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
    pt->v[1] = ibd;
    pt->v[2] = icd;
    pt->v[3] = id;
@@ -16168,7 +16181,6 @@
    pt->tabedg = 0;
    pt->flag = mesh->flag;
    pt->bdryref[0] = tabref[0];
-@@ -411,9 +411,9 @@
    pt->bdryref[1] = tabref[1];
    pt->bdryref[2] = tabref[2];
    pt->bdryref[3] = pt->ref;
@@ -16180,7 +16192,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -423,7 +423,7 @@
+@@ -423,7 +423,7 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16189,7 +16201,7 @@
      pt1->bdryref[1] = tabref[1];
      pt1->bdryref[2] = tabref[2];
      pt1->bdryref[3] = tabref[3];
-@@ -435,13 +435,13 @@
+@@ -435,13 +435,13 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->v[2] = iad;
      pt1->v[3] = ibd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16207,7 +16219,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ic;
-@@ -451,12 +451,12 @@
+@@ -451,12 +451,12 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16224,7 +16236,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ib;
-@@ -466,10 +466,10 @@
+@@ -466,10 +466,10 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16237,7 +16249,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -478,13 +478,13 @@
+@@ -478,13 +478,13 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->v[2] = ib;
      pt1->v[3] = icd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16254,7 +16266,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -494,12 +494,12 @@
+@@ -494,12 +494,12 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16270,7 +16282,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -509,7 +509,7 @@
+@@ -509,7 +509,7 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16279,7 +16291,7 @@
      pt1->bdryref[1] = tabref[1];
      pt1->bdryref[2] = tabref[2];
      pt1->bdryref[3] = tabref[3];
-@@ -521,13 +521,13 @@
+@@ -521,13 +521,13 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->v[2] = iad;
      pt1->v[3] = ibd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16297,7 +16309,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ib;
-@@ -538,11 +538,11 @@
+@@ -538,11 +538,11 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
      pt1->bdryref[0] = tabref[1];
@@ -16312,7 +16324,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ib;
-@@ -552,7 +552,7 @@
+@@ -552,7 +552,7 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16321,7 +16333,7 @@
      pt1->bdryref[1] = tabref[0];
      pt1->bdryref[2] = tabref[3];
      pt1->bdryref[3] = tabref[2];
-@@ -564,13 +564,13 @@
+@@ -564,13 +564,13 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->v[2] = ibd;
      pt1->v[3] = icd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16339,7 +16351,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -580,12 +580,12 @@
+@@ -580,12 +580,12 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16355,7 +16367,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ib;
-@@ -595,7 +595,7 @@
+@@ -595,7 +595,7 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -16364,7 +16376,7 @@
      pt1->bdryref[1] = tabref[0];
      pt1->bdryref[2] = tabref[3];
      pt1->bdryref[3] = tabref[2];
-@@ -607,13 +607,13 @@
+@@ -607,13 +607,13 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->v[2] = ibd;
      pt1->v[3] = ia;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16382,7 +16394,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibd;
-@@ -624,12 +624,12 @@
+@@ -624,12 +624,12 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
      pt1->bdryref[0] = tabref[1];
@@ -16399,7 +16411,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ib;
-@@ -640,7 +640,7 @@
+@@ -640,7 +640,7 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
      pt1->bdryref[0] = tabref[1];
@@ -16408,7 +16420,7 @@
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = tabref[3];
  
-@@ -651,13 +651,13 @@
+@@ -651,13 +651,13 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->v[2] = icd;
      pt1->v[3] = iad;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16426,7 +16438,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -668,22 +668,22 @@
+@@ -668,22 +668,22 @@ int MMG_pattern31(pMesh mesh,pSol sol,pH
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
      pt1->bdryref[0] = tabref[0];
@@ -16456,7 +16468,7 @@
    if(pt->tabedg != 28) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
      ib = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][1]];
-@@ -694,11 +694,11 @@
+@@ -694,11 +694,11 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -16471,7 +16483,7 @@
    assert(ibc>0);
    ibd = MMG_edgePoint(hash,ib,id);
    assert(ibd>0);
-@@ -708,14 +708,14 @@
+@@ -708,14 +708,14 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt->v[1] = ib;
      pt->v[2] = ia;
      pt->v[3] = ibc;
@@ -16489,7 +16501,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -740,13 +740,13 @@
+@@ -740,13 +740,13 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->v[3] = id;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("bahhhhhhhhh3");
@@ -16505,7 +16517,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibc;
-@@ -776,13 +776,13 @@
+@@ -776,13 +776,13 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[1];
      pt1->bdryref[3] = tabref[3];
@@ -16522,7 +16534,7 @@
      //if(pt->qual==CALLIM) puts("ahhhhhhhhh1");
      pt->tabedg = 0;
      pt->flag = mesh->flag;
-@@ -814,13 +814,13 @@
+@@ -814,13 +814,13 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->v[3] = ic;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("ahhhhhhhhh3");
@@ -16538,7 +16550,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibd;
-@@ -851,13 +851,13 @@
+@@ -851,13 +851,13 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = tabref[1];
      pt1->bdryref[3] = tabref[3];
    }
@@ -16555,7 +16567,7 @@
      pt->tabedg = 0;
      pt->flag = mesh->flag;
      pt->bdryref[0] = -1;
-@@ -888,13 +888,13 @@
+@@ -888,13 +888,13 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->v[3] = ibc;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("ahhhhhhhhh8");
@@ -16571,7 +16583,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -925,12 +925,12 @@
+@@ -925,12 +925,12 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = -1;
      pt1->bdryref[3] = -1;
    }
@@ -16586,7 +16598,7 @@
      //if(pt->qual==CALLIM) puts("ahhhhhhhhh11");
      pt->tabedg = 0;
      pt->flag = mesh->flag;
-@@ -962,13 +962,13 @@
+@@ -962,13 +962,13 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->v[3] = id;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("ahhhhhhhhh13");
@@ -16602,7 +16614,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibc;
-@@ -978,25 +978,25 @@
+@@ -978,25 +978,25 @@ int MMG_pattern32(pMesh mesh,pSol sol,pH
      pt1->qual = MMG_caltet(mesh,sol,jel);
      //if(pt1->qual==CALLIM) puts("ahhhhhhhhh14");
      pt1->ref  = pt->ref;
@@ -16620,9 +16632,9 @@
    return(1);
 -  
 -} 
- 
++
 +}
-+
+ 
  int MMG_pattern33(pMesh mesh,pSol sol,pHedge hash,int iel) {
    pTetra     pt,pt1;
    int        ia,ib,ic,id,iad,iac,ibd,jel,i,tabref[4];
@@ -16636,7 +16648,7 @@
    if(pt->tabedg != 22) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
      ib = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][1]];
-@@ -1007,8 +1007,8 @@
+@@ -1007,8 +1007,8 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -16647,7 +16659,7 @@
    iad = MMG_edgePoint(hash,ia,id);
    assert(iad>0);
    iac = MMG_edgePoint(hash,ia,ic);
-@@ -1016,12 +1016,12 @@
+@@ -1016,12 +1016,12 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
    ibd = MMG_edgePoint(hash,ib,id);
    assert(ibd>0);
  
@@ -16662,7 +16674,7 @@
      if(pt->qual==CALLIM) printf("tet 1\n");
      pt->tabedg = 0;
      pt->flag = mesh->flag;
-@@ -1053,13 +1053,13 @@
+@@ -1053,13 +1053,13 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->v[3] = iac;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      if(pt1->qual==CALLIM) printf("tet 3\n");
@@ -16678,7 +16690,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iad;
-@@ -1089,13 +1089,13 @@
+@@ -1089,13 +1089,13 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->bdryref[1] = tabref[2];
      pt1->bdryref[2] = -1;
      pt1->bdryref[3] = tabref[1];
@@ -16695,7 +16707,7 @@
      pt->tabedg = 0;
      pt->flag = mesh->flag;
      pt->bdryref[0] = -1;
-@@ -1124,13 +1124,13 @@
+@@ -1124,13 +1124,13 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->v[2] = ibd;
      pt1->v[3] = ib;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16711,7 +16723,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iad;
-@@ -1159,12 +1159,12 @@
+@@ -1159,12 +1159,12 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = -1;
      pt1->bdryref[3] = tabref[1];
    }
@@ -16726,7 +16738,7 @@
      pt->tabedg = 0;
      pt->flag = mesh->flag;
      pt->bdryref[0] = tabref[0];
-@@ -1193,13 +1193,13 @@
+@@ -1193,13 +1193,13 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->v[2] = id;
      pt1->v[3] = ibd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16742,7 +16754,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iad;
-@@ -1228,12 +1228,12 @@
+@@ -1228,12 +1228,12 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = -1;
      pt1->bdryref[3] = -1;
    }
@@ -16757,7 +16769,7 @@
      pt->tabedg = 0;
      pt->flag = mesh->flag;
      pt->bdryref[0] = tabref[3];
-@@ -1262,13 +1262,13 @@
+@@ -1262,13 +1262,13 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->v[2] = ia;
      pt1->v[3] = ib;
      pt1->qual = MMG_caltet(mesh,sol,jel);
@@ -16773,7 +16785,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibd;
-@@ -1277,7 +1277,7 @@
+@@ -1277,7 +1277,7 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->v[3] = iac;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -16782,7 +16794,7 @@
      pt1->bdryref[0] = tabref[1];
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;
-@@ -1291,7 +1291,7 @@
+@@ -1291,25 +1291,25 @@ int MMG_pattern33(pMesh mesh,pSol sol,pH
      pt1->v[3] = id;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -16791,7 +16803,6 @@
      pt1->bdryref[0] = tabref[1];
      pt1->bdryref[1] = tabref[2];
      pt1->bdryref[2] = tabref[0];
-@@ -1298,18 +1298,18 @@
      pt1->bdryref[3] = -1;
  
    }
@@ -16816,7 +16827,7 @@
  
    if(pt->tabedg != 29) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
-@@ -1321,29 +1321,29 @@
+@@ -1321,29 +1321,29 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -16856,7 +16867,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = id;
-@@ -1366,7 +1366,7 @@
+@@ -1366,7 +1366,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibc;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -16865,7 +16876,7 @@
      pt1->bdryref[0] = -1;
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;
-@@ -1380,7 +1380,7 @@
+@@ -1380,7 +1380,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ib;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -16874,7 +16885,7 @@
      pt1->bdryref[0] = tabref[3];
      pt1->bdryref[1] = tabref[0];
      pt1->bdryref[2] = tabref[2];
-@@ -1394,7 +1394,7 @@
+@@ -1394,7 +1394,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = iab;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -16883,7 +16894,7 @@
      pt1->bdryref[0] = tabref[3];
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[2];
-@@ -1408,26 +1408,26 @@
+@@ -1408,26 +1408,26 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibc;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -16916,7 +16927,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibd;
-@@ -1442,7 +1442,7 @@
+@@ -1442,7 +1442,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = tabref[0];
      pt1->bdryref[2] = tabref[2];
      pt1->bdryref[3] = -1;
@@ -16925,7 +16936,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iad;
-@@ -1452,12 +1452,12 @@
+@@ -1452,12 +1452,12 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->qual = MMG_caltet(mesh,sol,jel);
      if(pt1->qual==CALLIM) printf("diel %d\n",iel);
      pt1->ref  = pt->ref;
@@ -16940,7 +16951,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ia;
-@@ -1467,12 +1467,12 @@
+@@ -1467,12 +1467,12 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->qual = MMG_caltet(mesh,sol,jel);
      if(pt1->qual==CALLIM) printf("eiel %d\n",iel);
      pt1->ref  = pt->ref;
@@ -16955,7 +16966,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = id;
-@@ -1482,12 +1482,12 @@
+@@ -1482,12 +1482,12 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->qual = MMG_caltet(mesh,sol,jel);
      if(pt1->qual==CALLIM) printf("fiel %d\n",iel);
      pt1->ref  = pt->ref;
@@ -16970,7 +16981,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iad;
-@@ -1497,7 +1497,7 @@
+@@ -1497,26 +1497,26 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->qual = MMG_caltet(mesh,sol,jel);
      if(pt1->qual==CALLIM) printf("giel %d\n",iel);
      pt1->ref  = pt->ref;
@@ -16979,7 +16990,6 @@
      pt1->bdryref[0] = tabref[0];
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;
-@@ -1504,19 +1504,19 @@
      pt1->bdryref[3] = tabref[1];
    }
    else if ( ia > ic ) {
@@ -17003,7 +17013,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iad;
-@@ -1539,7 +1539,7 @@
+@@ -1539,7 +1539,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibc;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17012,7 +17022,7 @@
      pt1->bdryref[0] = -1;
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;
-@@ -1553,7 +1553,7 @@
+@@ -1553,7 +1553,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17021,7 +17031,7 @@
      pt1->bdryref[0] = tabref[0];
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[2];
-@@ -1567,7 +1567,7 @@
+@@ -1567,7 +1567,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = id;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17030,7 +17040,7 @@
      pt1->bdryref[0] = tabref[0];
      pt1->bdryref[1] = tabref[1];
      pt1->bdryref[2] = tabref[2];
-@@ -1581,7 +1581,7 @@
+@@ -1581,7 +1581,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = iad;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17039,7 +17049,7 @@
      pt1->bdryref[0] = -1;
      pt1->bdryref[1] = tabref[1];
      pt1->bdryref[2] = tabref[2];
-@@ -1589,19 +1589,19 @@
+@@ -1589,19 +1589,19 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
    }
    else {
      assert(id > ic);
@@ -17063,7 +17073,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibd;
-@@ -1624,7 +1624,7 @@
+@@ -1624,7 +1624,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = iad;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17072,7 +17082,7 @@
      pt1->bdryref[0] = -1;
      pt1->bdryref[1] = tabref[1];
      pt1->bdryref[2] = -1;
-@@ -1638,7 +1638,7 @@
+@@ -1638,7 +1638,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = iad;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17081,7 +17091,7 @@
      pt1->bdryref[0] = -1;
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[2];
-@@ -1652,7 +1652,7 @@
+@@ -1652,7 +1652,7 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibd;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17090,7 +17100,7 @@
      pt1->bdryref[0] = tabref[0];
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[2];
-@@ -1666,24 +1666,24 @@
+@@ -1666,24 +1666,24 @@ int MMG_pattern4(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibc;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17122,7 +17132,7 @@
    if(pt->tabedg != 51) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
      ib = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][1]];
-@@ -1694,29 +1694,29 @@
+@@ -1694,29 +1694,29 @@ int MMG_pattern41(pMesh mesh,pSol sol,pH
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -17161,7 +17171,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = id;
-@@ -1787,19 +1787,19 @@
+@@ -1787,19 +1787,19 @@ int MMG_pattern41(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = -1;
    }
@@ -17185,7 +17195,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = icd;
-@@ -1870,19 +1870,19 @@
+@@ -1870,19 +1870,19 @@ int MMG_pattern41(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = -1;
    }
@@ -17209,7 +17219,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = iac;
-@@ -1953,20 +1953,20 @@
+@@ -1953,20 +1953,20 @@ int MMG_pattern41(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = tabref[3];
      pt1->bdryref[3] = tabref[0];
    }
@@ -17234,7 +17244,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = icd;
-@@ -2037,17 +2037,17 @@
+@@ -2037,17 +2037,17 @@ int MMG_pattern41(pMesh mesh,pSol sol,pH
      pt1->bdryref[2] = tabref[3];
      pt1->bdryref[3] = tabref[0];
    }
@@ -17258,7 +17268,7 @@
  
    if(pt->tabedg != 62) {
      ia = pt->v[MMG_permar[MMG_pointar[pt->tabedg][0]][0]];
-@@ -2059,21 +2059,21 @@
+@@ -2059,21 +2059,21 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      ib = pt->v[1];
      ic = pt->v[2];
      id = pt->v[3];
@@ -17291,7 +17301,7 @@
    if(ddebug) printf("bdyref      %d %d %d %d\n",pt->bdryref[0],pt->bdryref[1],pt->bdryref[2],pt->bdryref[3]);
    if(ddebug) printf("tabref      %d %d %d %d\n",tabref[0],tabref[1],tabref[2],tabref[3]);
    if ( ( ia > ib ) ) { /*tetra_p51.mesh*/
-@@ -2081,14 +2081,14 @@
+@@ -2081,14 +2081,14 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt->v[1] = ic;
      pt->v[2] = iac;
      pt->v[3] = icd;
@@ -17309,7 +17319,7 @@
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
      pt1->v[0] = ibc;
-@@ -2102,7 +2102,7 @@
+@@ -2102,7 +2102,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = -1;
@@ -17318,7 +17328,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2117,7 +2117,7 @@
+@@ -2117,7 +2117,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = tabref[2];
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = -1;
@@ -17327,7 +17337,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2132,7 +2132,7 @@
+@@ -2132,7 +2132,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;
      pt1->bdryref[3] = -1;
@@ -17336,7 +17346,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2147,7 +2147,7 @@
+@@ -2147,7 +2147,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = tabref[2];
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = -1;
@@ -17345,7 +17355,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2158,11 +2158,11 @@
+@@ -2158,11 +2158,11 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -17360,7 +17370,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2177,28 +2177,28 @@
+@@ -2177,28 +2177,28 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[3];
      pt1->bdryref[3] = -1;
@@ -17396,7 +17406,7 @@
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
-@@ -2206,7 +2206,7 @@
+@@ -2206,7 +2206,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = tabref[2];
      pt1->bdryref[2] = tabref[0];
      pt1->bdryref[3] = -1;
@@ -17405,7 +17415,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2217,11 +2217,18 @@
+@@ -2217,11 +2217,18 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
      pt1->flag = mesh->flag;
@@ -17426,7 +17436,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2236,7 +2243,7 @@
+@@ -2236,7 +2243,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;//tabref[3];
      pt1->bdryref[3] = tabref[3];//-1;
@@ -17435,7 +17445,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2251,7 +2258,7 @@
+@@ -2251,7 +2258,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = tabref[2];
      pt1->bdryref[3] = tabref[3];
@@ -17444,7 +17454,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2266,7 +2273,7 @@
+@@ -2266,7 +2273,7 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->bdryref[1] = -1;
      pt1->bdryref[2] = -1;
      pt1->bdryref[3] = -1;
@@ -17453,7 +17463,7 @@
  
      jel = MMG_newElt(mesh);
      pt1 = &mesh->tetra[jel];
-@@ -2276,36 +2283,36 @@
+@@ -2276,48 +2283,48 @@ int MMG_pattern5(pMesh mesh,pSol sol,pHe
      pt1->v[3] = ibc;
      pt1->qual = MMG_caltet(mesh,sol,jel);
      pt1->ref  = pt->ref;
@@ -17505,7 +17515,6 @@
  
  
    ip0 = pt1->v[0];
-@@ -2312,12 +2319,12 @@
    ip1 = pt1->v[1];
    ip2 = pt1->v[2];
    ip3 = pt1->v[3];
@@ -17521,7 +17530,7 @@
    pt1->v[0] = ipa[1];
    pt1->v[1] = ip0;
    pt1->v[2] = ipa[0];
-@@ -2343,7 +2350,7 @@
+@@ -2343,7 +2350,7 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = tabref[2];
    pt->bdryref[3] = tabref[3];
@@ -17530,7 +17539,7 @@
    iel = MMG_newElt(mesh);
    pt = &mesh->tetra[iel];
    pt->v[0] = ipa[3];
-@@ -2357,7 +2364,7 @@
+@@ -2357,7 +2364,7 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = tabref[0];
    pt->bdryref[3] = tabref[3];
@@ -17539,7 +17548,7 @@
  
    iel = MMG_newElt(mesh);
    pt = &mesh->tetra[iel];
-@@ -2372,8 +2379,8 @@
+@@ -2372,8 +2379,8 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = tabref[0];
    pt->bdryref[3] = tabref[1];
@@ -17550,7 +17559,7 @@
    iel = MMG_newElt(mesh);
    pt = &mesh->tetra[iel];
    pt->v[0] = ipa[1];
-@@ -2387,7 +2394,7 @@
+@@ -2387,7 +2394,7 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = tabref[3];
    pt->bdryref[3] = -1;
@@ -17559,7 +17568,7 @@
  
    iel = MMG_newElt(mesh);
    pt = &mesh->tetra[iel];
-@@ -2402,7 +2409,7 @@
+@@ -2402,7 +2409,7 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = -1;
    pt->bdryref[3] = tabref[2];
@@ -17568,7 +17577,7 @@
  
    iel = MMG_newElt(mesh);
    pt = &mesh->tetra[iel];
-@@ -2417,7 +2424,7 @@
+@@ -2417,7 +2424,7 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = -1;
    pt->bdryref[3] = -1;
@@ -17577,7 +17586,7 @@
  
    iel = MMG_newElt(mesh);
    pt = &mesh->tetra[iel];
-@@ -2432,9 +2439,8 @@
+@@ -2432,9 +2439,8 @@ int MMG_pattern6(pMesh mesh,pSol sol,int
    pt->bdryref[1] = -1;
    pt->bdryref[2] = -1;
    pt->bdryref[3] = tabref[0];
@@ -17589,11 +17598,11 @@
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/quality.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/quality.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/quality.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/quality.c	(working copy)
-@@ -51,6 +51,297 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/quality.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/quality.c
+@@ -51,6 +51,297 @@ double MMG_caltetrao(pMesh mesh,pSol sol
  	return(MMG_rao(mesh,iel,0));
  }
  
@@ -17891,7 +17900,7 @@
  /* compute tetra volume */
  double MMG_voltet(pMesh mesh,int iel) {
    pTetra   pt;
-@@ -193,7 +484,47 @@
+@@ -193,6 +484,46 @@ double MMG_quickvol(double *c1,double *c
    return(vol);
  }
  
@@ -17902,7 +17911,7 @@
 +  pTetra     pt;
 +  double    *a,*b,*c,*d,ct[12],cs[3],rad,lref,Vref,V,cal;
 +  int        ia,ib,ic,id,j,l;
- 
++
 +  cal = CALLIM;
 +  pt = &mesh->tetra[iel];  
 +  if ( !pt->v[0] )  return(cal);
@@ -17935,11 +17944,10 @@
 +  return(cal);
 +} 
 +
-+
+ 
  /* compute tetra quality aniso */
  double MMG_caltet_ani(pMesh mesh,pSol sol,int iel) {
-   pTetra     pt;
-@@ -416,7 +747,7 @@
+@@ -416,7 +747,7 @@ double MMG_caltet_iso(pMesh mesh,pSol so
        /*tmp = pt->v[2];
        pt->v[2] =pt->v[1];
        pt->v[1] = tmp;*/  
@@ -17948,7 +17956,7 @@
        return(cal);}
  
    /* max edge */
-@@ -479,7 +810,7 @@
+@@ -479,7 +810,7 @@ double MMG_calte1_ani(pMesh mesh,pSol so
    double     h1,h2,h3,h4,h5,h6,rapmax,vol,det,v1,v2,v3;
    double     air,dd,num;
    double    *a,*b,*c,*d;
@@ -17957,7 +17965,7 @@
    int        j,ia,ib,ic,id,iadr;
  
    pt = &mesh->tetra[iel];
-@@ -1479,7 +1810,7 @@
+@@ -1479,7 +1810,7 @@ double MMG_calte3_ani(pMesh mesh,pSol so
    double     cal,ab[3],ac[3],ad[3],bc[3],bd[3],cd[3];
    double     vol,det,v1,v2,v3,air,dd;
    double    *a,*b,*c,*d;
@@ -17966,7 +17974,7 @@
    int        j,ia,ib,ic,id,iadr;
    static double id3[6] ={1.0,0.,0.,1.,0.,1.};
  
-@@ -1743,3 +2074,48 @@
+@@ -1743,3 +2074,48 @@ double MMG_callong(pMesh mesh,pSol sol,i
    } 
    return(cal);
  }
@@ -18015,11 +18023,11 @@
 +  // caltab[1] = MMG_caltet(mesh,sol,0);
 +  return(1);
 +}
-Index: contrib/mmg3d/build/sources/queue.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/queue.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/queue.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/queue.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/queue.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/queue.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -18054,7 +18062,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -18065,7 +18072,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,10 +41,10 @@
+@@ -41,10 +41,10 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -18078,7 +18085,7 @@
  pQueue MMG_kiuini(pMesh mesh,int nbel,double declic,int base) {
    pQueue   q;
    pTetra   pt;
-@@ -92,7 +92,7 @@
+@@ -92,7 +92,7 @@ int MMG_kiudel(pQueue q,int iel) {
      }
      else {
        q->stack[0]   = q->stack[iel];
@@ -18087,7 +18094,7 @@
        return(1);
      }
    }
-@@ -100,7 +100,7 @@
+@@ -100,7 +100,7 @@ int MMG_kiudel(pQueue q,int iel) {
    else {
      for (k=iel-1; k>0; k--)
        if ( q->stack[k] == iel )  break;
@@ -18096,7 +18103,7 @@
      if ( iel == q->cur ) {
        q->cur        = k;
        q->stack[k]   = 0;
-@@ -143,7 +143,7 @@
+@@ -143,7 +143,7 @@ int MMG_kiuput(pQueue q,int iel) {
    else {
      for (k=iel-1; k>=0; k--)
        if ( q->stack[k] )  break;
@@ -18105,17 +18112,17 @@
      q->stack[iel] = q->stack[k];
      q->stack[k]   = iel;
      return(1);
-@@ -163,5 +163,3 @@
+@@ -163,5 +163,3 @@ int MMG_kiupop(pQueue q) {
  
    return(cur);
  }
 -
 -
-Index: contrib/mmg3d/build/sources/ratio.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/ratio.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/ratio.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/ratio.c	(working copy)
-@@ -43,12 +43,12 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/ratio.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/ratio.c
+@@ -43,12 +43,12 @@ GNU General Public License for more deta
  You should have received a copy of the GNU General Public License
  along with MMG3D. If not, see <http://www.gnu.org/licenses/>.
  ****************************************************************************/
@@ -18134,7 +18141,7 @@
  
  #include "mesh.h"
  
-@@ -57,16 +57,16 @@
+@@ -57,16 +57,16 @@ int MMG_gauss(double mat[6][6],double rh
  
  /*compute the aniso ratio for an element k*/
  double MMG_rao(pMesh mesh,int k,FILE* inm) {
@@ -18158,7 +18165,7 @@
    for (i=0 ; i<6 ; i++)
      rhs[i] = 1;
  
-@@ -74,7 +74,7 @@
+@@ -74,7 +74,7 @@ double MMG_rao(pMesh mesh,int k,FILE* in
      ppa = &mesh->point[pt->v[MMG_iare[i][0]]];
      ppb = &mesh->point[pt->v[MMG_iare[i][1]]];
      for (j=0 ; j<3 ; j++) {
@@ -18167,7 +18174,7 @@
      }
      mat[i][0] = edg[i][0]*edg[i][0];
      mat[i][1] = 2*edg[i][0]*edg[i][1];
-@@ -88,10 +88,10 @@
+@@ -88,10 +88,10 @@ double MMG_rao(pMesh mesh,int k,FILE* in
    /*find the eigenvalues of the metric*/
    if ( !eigenv(1,met,lambda,v) ) {
      for (j=0 ; j<6 ; j++)
@@ -18182,7 +18189,7 @@
    }
    /*calculate the aniso ratio obtained*/
    lmin = M_MIN(lambda[0],lambda[1]);
-@@ -100,12 +100,12 @@
+@@ -100,12 +100,12 @@ double MMG_rao(pMesh mesh,int k,FILE* in
    lmax = M_MAX(lmax,lambda[2]);
    rao  = sqrt(lmax / lmin);
    if(inm) {
@@ -18198,7 +18205,7 @@
    }
  
    return(rao);
-@@ -113,8 +113,8 @@
+@@ -113,8 +113,8 @@ double MMG_rao(pMesh mesh,int k,FILE* in
  
  
  int MMG_avgmet(pSol sol,pTetra pt,double* mm) {
@@ -18209,7 +18216,7 @@
  
    ia = pt->v[0];
    ib = pt->v[1];
-@@ -122,31 +122,31 @@
+@@ -122,31 +122,31 @@ int MMG_avgmet(pSol sol,pTetra pt,double
    id = pt->v[3];
  
    if (sol->offset==1) {
@@ -18264,7 +18271,7 @@
  
    }
  
-@@ -158,11 +158,11 @@
+@@ -158,11 +158,11 @@ int MMG_avgmet(pSol sol,pTetra pt,double
  */
  int MMG_ratio(pMesh mesh, pSol sol,char* firaoame) {
    FILE     *inm;
@@ -18281,7 +18288,7 @@
    double    rapmin,rapmax,rapavg;
    int       his[10],rapnum;
    int       iel,ir,nn,nex,ielreal;
-@@ -177,7 +177,7 @@
+@@ -177,7 +177,7 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
      else {
        ptr = strstr(data,".mesh");
        if ( ptr ) {
@@ -18290,7 +18297,7 @@
        }
      }
      strcat(data,".sol");
-@@ -194,13 +194,13 @@
+@@ -194,13 +194,13 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
      strcpy(&chaine[0],"\n\nDimension 3\n");
      fprintf(inm,"%s ",chaine);
  
@@ -18309,7 +18316,7 @@
      }
      strcpy(&chaine[0],"\n\nSolAtTetrahedra\n");
      fprintf(inm,"%s",chaine);
-@@ -209,7 +209,7 @@
+@@ -209,7 +209,7 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
  
    }
  
@@ -18318,7 +18325,7 @@
  
      /*ratio prescribed*/
  
-@@ -225,54 +225,53 @@
+@@ -225,54 +225,53 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
      for (k=0; k<10; k++)  his[k] = 0;
  
      for(k=1 ; k<=mesh->ne ; k++) {
@@ -18354,18 +18361,19 @@
 - 	  lmax = M_MAX(lambda[0],lambda[1]);
 -	  lmax = M_MAX(lmax,lambda[2]);
 -	  rao  = sqrt(lmax / lmin);
-+      lmin = M_MIN(lambda[0],lambda[1]);
-+      lmin = M_MIN(lmin,lambda[2]);
-+      lmax = M_MAX(lambda[0],lambda[1]);
-+      lmax = M_MAX(lmax,lambda[2]);
-+      rao  = sqrt(lmax / lmin);
- 
+-
 -	  /*histo prescribed*/
 -	  ir   = (int)rao;
 -	  if ( rao > rapmax ) {
 -        rapmax = rao;
 -        iel     = k;
 -        ielreal = k - nex;
++      lmin = M_MIN(lambda[0],lambda[1]);
++      lmin = M_MIN(lmin,lambda[2]);
++      lmax = M_MAX(lambda[0],lambda[1]);
++      lmax = M_MAX(lmax,lambda[2]);
++      rao  = sqrt(lmax / lmin);
++
 +      /*histo prescribed*/
 +      ir   = (int)rao;
 +      if ( rao > rapmax ) {
@@ -18407,7 +18415,7 @@
        }
  
      }
-@@ -283,21 +282,21 @@
+@@ -283,21 +282,21 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
      if (rapmax < 1.e4) {
        fprintf(stdout,"      LARGEST RATIO       %12.4f\n",rapmax);
      } else {
@@ -18434,7 +18442,7 @@
  
    }
  
-@@ -313,18 +312,18 @@
+@@ -313,18 +312,18 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
    for (k=0; k<10; k++)  his[k] = 0;
  
    for(k=1 ; k<=mesh->ne ; k++) {
@@ -18458,7 +18466,7 @@
        rapmax = rao;
        iel     = k;
        ielreal = k - nex;
-@@ -335,13 +334,13 @@
+@@ -335,13 +334,13 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
      if ( rao < 17e10 ) {
        rapmin = M_MIN(rapmin,rao);
        if (rao < bd[3]) {
@@ -18477,20 +18485,13 @@
        }
        else if (rao < bd[6])    his[6]++;
        else if (rao < bd[7])    his[7]++;
-@@ -354,35 +353,29 @@
+@@ -354,35 +353,29 @@ int MMG_ratio(pMesh mesh, pSol sol,char*
    if(inm) fclose(inm);
  
    /* print histo ratio obtained*/
 -  if (mesh->info.imprim < 0){
 -    fprintf(stdout,"        ANISOTROPIC RATIO (MEAN = %6.2g, MAX = %6.2g, MIN = %6.2f)\n",rapavg / rapnum, rapmax, rapmin);
-+  fprintf(stdout,"\n  -- ANISOTROPIC RATIO OBTAINED   %d\n",rapnum);
-+  fprintf(stdout,"      AVERAGE RATIO       %12.4f\n",rapavg / rapnum);
-+  fprintf(stdout,"     SMALLEST RATIO       %12.4f\n",rapmin);
-+  if (rapmax < 1.e4) {
-+    fprintf(stdout,"      LARGEST RATIO       %12.4f\n",rapmax);
-+  } else {
-+    fprintf(stdout,"      LARGEST RATIO       %12.4e\n",rapmax);
-   }
+-  }
 -  else if (mesh->info.imprim < 0){
 -    fprintf(stdout,"\n  -- ANISOTROPIC RATIO OBTAINED   %d\n",rapnum);
 -    fprintf(stdout,"      AVERAGE RATIO       %12.4f\n",rapavg / rapnum);
@@ -18501,17 +18502,24 @@
 -      fprintf(stdout,"      LARGEST RATIO       %12.4e\n",rapmax);
 -    }
 -    pt = &mesh->tetra[iel];
+-
+-    fprintf(stdout,"           ELEMENT   %d (%d)   %d %d %d %d\n",
+-	    iel,ielreal,pt->v[0],pt->v[1],pt->v[2],pt->v[3]);
++  fprintf(stdout,"\n  -- ANISOTROPIC RATIO OBTAINED   %d\n",rapnum);
++  fprintf(stdout,"      AVERAGE RATIO       %12.4f\n",rapavg / rapnum);
++  fprintf(stdout,"     SMALLEST RATIO       %12.4f\n",rapmin);
++  if (rapmax < 1.e4) {
++    fprintf(stdout,"      LARGEST RATIO       %12.4f\n",rapmax);
++  } else {
++    fprintf(stdout,"      LARGEST RATIO       %12.4e\n",rapmax);
+   }
 +  pt = &mesh->tetra[iel];
 +  fprintf(stdout,"           ELEMENT   %d (%d)   %d %d %d %d\n",
 +	  iel,ielreal,pt->v[0],pt->v[1],pt->v[2],pt->v[3]);
  
--    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 1;
 +  if ( abs(mesh->info.imprim) < 5 )  return(1);
  
--  if ( abs(mesh->info.imprim) < 5 )  return 1;
--
    fprintf(stdout,"\n     HISTOGRAMM\n");
    for (k=1; k<9; k++) {
      if ( his[k] > 0 )
@@ -18526,7 +18534,7 @@
  
    return(1);
  }
-@@ -392,50 +385,50 @@
+@@ -392,50 +385,50 @@ int MMG_gauss(double mat[6][6],double rh
    int i,j,l;
    double tmp,piv;
    /*printf("begin : \n");
@@ -18548,18 +18556,9 @@
 -	  tmp    = rhs[i];
 -	  rhs[i] = rhs[l];
 -	  rhs[l] = tmp;
-+      for (j=0 ; j<6 ; j++) {
-+	tmp = mat[i][j];
-+	mat[i][j] = mat[l][j];
-+	mat[l][j] = tmp;
-+      }
-+      tmp    = rhs[i];
-+      rhs[i] = rhs[l];
-+      rhs[l] = tmp;
- 
+-
 -	  l++;
-+      l++;
-     }
+-    }
 -	if ((fabs(mat[i][i]) < 1e-8)) {
 -	   //puts("WARNING PIV");
 -		met[0] = 1;
@@ -18570,6 +18569,17 @@
 -		met[5] = 1e7;
 -		return(1);
 -	}
++      for (j=0 ; j<6 ; j++) {
++	tmp = mat[i][j];
++	mat[i][j] = mat[l][j];
++	mat[l][j] = tmp;
++      }
++      tmp    = rhs[i];
++      rhs[i] = rhs[l];
++      rhs[l] = tmp;
++
++      l++;
++    }
 +    if ((fabs(mat[i][i]) < 1e-8)) {
 +      //puts("WARNING PIV");
 +      met[0] = 1;
@@ -18609,11 +18619,11 @@
    }
  
    return(1);
-Index: contrib/mmg3d/build/sources/scalem.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/scalem.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/scalem.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/scalem.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/scalem.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/scalem.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -18648,7 +18658,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -18659,7 +18668,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -18668,7 +18677,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -53,7 +53,7 @@
+@@ -53,7 +53,7 @@ int MMG_scaleMesh(pMesh mesh,pSol sol) {
    double    dd,d1;
    double    *m,*mold;
    int       i,k,iadr,alloc,ii,jj,kk;
@@ -18677,7 +18686,7 @@
  
    /* mark used vertices */
    for (k=1; k<=mesh->ne; k++) {
-@@ -64,11 +64,11 @@
+@@ -64,11 +64,11 @@ int MMG_scaleMesh(pMesh mesh,pSol sol) {
        ppt->tag &= ~M_UNUSED;
      }
    }
@@ -18692,7 +18701,7 @@
    /* compute bounding box */
    info = &mesh->info;
    for (i=0; i<3; i++) {
-@@ -112,6 +112,7 @@
+@@ -112,6 +112,7 @@ int MMG_scaleMesh(pMesh mesh,pSol sol) {
      for (k=1; k<=mesh->np; k++) {
        ppt = &mesh->point[k];
        if ( ppt->tag & M_UNUSED )  continue;
@@ -18700,7 +18709,7 @@
        ppt->c[0] = dd * (ppt->c[0] - info->min[0]);
        ppt->c[1] = dd * (ppt->c[1] - info->min[1]);
        ppt->c[2] = dd * (ppt->c[2] - info->min[2]);
-@@ -121,8 +122,8 @@
+@@ -121,20 +122,20 @@ int MMG_scaleMesh(pMesh mesh,pSol sol) {
        pd->mv[3*(k-1) + 1 + 2] *= dd;
  
        d1 = pd->mv[3*(k-1) + 1 + 0]*pd->mv[3*(k-1) + 1 + 0]
@@ -18711,7 +18720,6 @@
        if ( d1 > EPS2 )  ppt->tag  |= M_MOVE;
      }
    }
-@@ -129,12 +130,12 @@
  
    /* normalize metric */
    if ( !sol->np ) return(1);
@@ -18726,7 +18734,7 @@
      break;
  
    case 6:
-@@ -142,32 +143,32 @@
+@@ -142,32 +143,32 @@ int MMG_scaleMesh(pMesh mesh,pSol sol) {
      for (k=1; k<=mesh->np; k++) {
        iadr = (k-1)*sol->offset + 1;
        m    = &sol->met[iadr];
@@ -18777,7 +18785,7 @@
        }
      }
      break;
-@@ -175,17 +176,16 @@
+@@ -175,17 +176,16 @@ int MMG_scaleMesh(pMesh mesh,pSol sol) {
      fprintf(stderr,"  ## SPECIFIC DATA NOT USED.\n");
      exit(2);
    }
@@ -18799,18 +18807,18 @@
    return(1);
  }
  
-@@ -225,6 +225,3 @@
+@@ -225,6 +225,3 @@ int MMG_unscaleMesh(pMesh mesh,pSol sol)
  
    return(1);
  }
 -
 -
 -
-Index: contrib/mmg3d/build/sources/simu23.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu23.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/simu23.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/simu23.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/simu23.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu23.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -18845,7 +18853,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -18856,7 +18863,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -18865,7 +18872,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -59,6 +59,9 @@
+@@ -59,6 +59,9 @@ int MMG_simu23(pMesh mesh,pSol sol,int i
    jel  = adja[i] / 4;
    j    = adja[i] % 4;
    pt1  = &mesh->tetra[jel];
@@ -18875,7 +18882,7 @@
  
    ia = pt->v[i];
    ib = pt1->v[j];
-@@ -92,9 +95,9 @@
+@@ -92,9 +95,9 @@ int MMG_simu23(pMesh mesh,pSol sol,int i
    }
  
    memset(pt1,0,sizeof(Tetra));
@@ -18887,11 +18894,11 @@
    return(1);
  }
  
-Index: contrib/mmg3d/build/sources/simu44.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu44.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/simu44.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/simu44.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/simu44.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu44.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -18926,7 +18933,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -18937,7 +18943,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,17 +41,17 @@
+@@ -41,17 +41,17 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -18962,7 +18968,7 @@
    iel = list->tetra[1] / 6;
    iar = list->tetra[1] % 6;
    pt  = &mesh->tetra[iel];
-@@ -76,38 +76,38 @@
+@@ -76,38 +76,38 @@ int MMG_simu44(pMesh mesh,pSol sol,pList
    s4   = pt1->v[voy];
  
    do {
@@ -19032,7 +19038,7 @@
    /* alternate config */
    pt1 = &mesh->tetra[0];
    pt1->v[0] = ia;
-@@ -128,7 +128,7 @@
+@@ -128,7 +128,7 @@ int MMG_simu44(pMesh mesh,pSol sol,pList
    pt1->v[3] = s4;
    if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
      memset(pt1,0,sizeof(Tetra));
@@ -19041,16 +19047,16 @@
    }
    list->qual[3] = caltab[0];
    list->qual[4] = caltab[1];
-@@ -137,4 +137,3 @@
+@@ -137,4 +137,3 @@ int MMG_simu44(pMesh mesh,pSol sol,pList
    MMG_swpptr = MMG_swap44_2;
    return(42);
  }
 -
-Index: contrib/mmg3d/build/sources/simu56.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu56.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/simu56.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/simu56.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/simu56.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu56.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -19085,7 +19091,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -19096,7 +19101,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,21 +41,21 @@
+@@ -41,21 +41,21 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -19126,7 +19131,7 @@
    iel = list->tetra[1] / 6;
    iar = list->tetra[1] % 6;
    pt  = &mesh->tetra[iel];
-@@ -63,8 +63,8 @@
+@@ -63,8 +63,8 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
    ia  = pt->v[ MMG_iare[iar][0] ];
    ib  = pt->v[ MMG_iare[iar][1] ];
    s1  = pt->v[ MMG_isar[iar][0] ];
@@ -19137,7 +19142,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][0];
-@@ -76,20 +76,20 @@
+@@ -76,20 +76,20 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
    iadr = (adj-1)*4 + 1;
    adja = &mesh->adja[iadr];
    if(pt1->v[MMG_idir[voy][0]]==s2) {
@@ -19163,7 +19168,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][1];
-@@ -97,100 +97,100 @@
+@@ -97,100 +97,100 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s5   = pt1->v[voy];
@@ -19354,7 +19359,7 @@
    do {
      if(!qual[5]) break;
      else if(qual[5] == -1) {
-@@ -200,9 +200,9 @@
+@@ -200,16 +200,16 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19367,7 +19372,6 @@
        }
        qual[5] = caltab[0];
        qual[6] = caltab[1];
-@@ -209,7 +209,7 @@
      }
      list->qual[1] = qual[5];
      list->qual[2] = qual[6];
@@ -19376,7 +19380,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -224,7 +224,7 @@
+@@ -224,7 +224,7 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
      qual[12] = caltab[1];
      list->qual[3] = qual[11];
      list->qual[4] = qual[12];
@@ -19385,7 +19389,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -239,13 +239,13 @@
+@@ -239,13 +239,13 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
      qual[14] = caltab[1];
      list->qual[5] = qual[13];
      list->qual[6] = qual[14];
@@ -19405,7 +19409,7 @@
    do {
      if(!qual[11]) break;
      else if(qual[11] == -1) {
-@@ -255,13 +255,13 @@
+@@ -255,13 +255,13 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19423,7 +19427,7 @@
      list->qual[3] = qual[11];
      list->qual[4] = qual[12];
  
-@@ -280,8 +280,8 @@
+@@ -280,8 +280,8 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
      qual[16] = caltab[1];
      list->qual[1] = qual[15];
      list->qual[2] = qual[16];
@@ -19434,7 +19438,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -296,14 +296,14 @@
+@@ -296,14 +296,14 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
      qual[18] = caltab[1];
      list->qual[5] = qual[17];
      list->qual[6] = qual[18];
@@ -19456,7 +19460,7 @@
    if(!qual[15]) return(0);
    else if(qual[15] == -1) {
      pt1 = &mesh->tetra[0];
-@@ -321,7 +321,7 @@
+@@ -321,7 +321,7 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
    }
    list->qual[1] = qual[15];
    list->qual[2] = qual[16];
@@ -19465,7 +19469,7 @@
    if(!qual[9]) return(0);
    else if(qual[9] == -1) {
      pt1 = &mesh->tetra[0];
-@@ -336,10 +336,10 @@
+@@ -336,10 +336,10 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
      }
      qual[9] = caltab[0];
      qual[10] = caltab[1];
@@ -19478,22 +19482,20 @@
    pt1 = &mesh->tetra[0];
    pt1->v[0] = ia;
    pt1->v[1] = s2;
-@@ -354,9 +354,9 @@
+@@ -354,7 +354,7 @@ int MMG_simu56(pMesh mesh,pSol sol,pList
    qual[20] = caltab[1];
    list->qual[3] = qual[19];
    list->qual[4] = qual[20];
 - 
- 
- 
-+
++
+ 
+ 
    /* set function ptr */
-   memset(pt1,0,sizeof(Tetra));
-   MMG_swpptr = MMG_swap56_5;
-Index: contrib/mmg3d/build/sources/simu68.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu68.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/simu68.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/simu68.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/simu68.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu68.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -19528,7 +19530,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -19539,7 +19540,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,11 +41,11 @@
+@@ -41,11 +41,11 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -19553,7 +19554,7 @@
  int MMG_simu68(pMesh mesh,pSol sol,pList list,double crit) {
    pTetra pt,pt1;
    int ia,ib,s1,s2,s3,s4,s5,s6;
-@@ -58,57 +58,57 @@
+@@ -58,57 +58,57 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
  
    for(k=0 ; k<41 ; k++)
      qual[k] = -1;
@@ -19629,7 +19630,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][1];
-@@ -116,7 +116,7 @@
+@@ -116,7 +116,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s6   = pt1->v[voy];
@@ -19638,7 +19639,7 @@
    /*cas 1*/
    do {
      pt1 = &mesh->tetra[0];
-@@ -133,7 +133,7 @@
+@@ -133,7 +133,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[2] = caltab[1];
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
@@ -19647,7 +19648,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -148,7 +148,7 @@
+@@ -148,7 +148,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[4] = caltab[1];
      list->qual[3] = qual[3];
      list->qual[4] = qual[4];
@@ -19656,7 +19657,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -163,7 +163,7 @@
+@@ -163,7 +163,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[6] = caltab[1];
      list->qual[5] = qual[5];
      list->qual[6] = qual[6];
@@ -19665,7 +19666,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -178,14 +178,14 @@
+@@ -178,14 +178,14 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[8] = caltab[1];
      list->qual[7] = qual[7];
      list->qual[8] = qual[8];
@@ -19683,7 +19684,7 @@
    /*cas 2*/
    do {
      if(!qual[1]) break;
-@@ -200,16 +200,16 @@
+@@ -200,16 +200,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19705,7 +19706,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -224,7 +224,7 @@
+@@ -224,7 +224,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[10] = caltab[1];
      list->qual[5] = qual[9];
      list->qual[6] = qual[10];
@@ -19714,7 +19715,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s4;
-@@ -240,12 +240,12 @@
+@@ -240,12 +240,12 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      list->qual[7] = qual[11];
      list->qual[8] = qual[12];
  
@@ -19732,7 +19733,7 @@
    /*cas 3*/
    do {
      if(!qual[1]) break;
-@@ -266,7 +266,7 @@
+@@ -266,7 +266,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[14] = caltab[1];
      list->qual[3] = qual[13];
      list->qual[4] = qual[14];
@@ -19741,7 +19742,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s3;
-@@ -281,7 +281,7 @@
+@@ -281,7 +281,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[16] = caltab[1];
      list->qual[5] = qual[15];
      list->qual[6] = qual[16];
@@ -19750,7 +19751,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s3;
-@@ -296,18 +296,18 @@
+@@ -296,18 +296,18 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[18] = caltab[1];
      list->qual[7] = qual[17];
      list->qual[8] = qual[18];
@@ -19775,7 +19776,7 @@
      if(!qual[11]) break;
      else if(qual[11] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -316,9 +316,9 @@
+@@ -316,16 +316,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19788,7 +19789,6 @@
        }
        qual[11] = caltab[0];
        qual[12] = caltab[1];
-@@ -325,7 +325,7 @@
      }
      list->qual[7] = qual[11];
      list->qual[8] = qual[12];
@@ -19797,7 +19797,7 @@
      if(!qual[13]) break;
      else if(qual[13] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -334,9 +334,9 @@
+@@ -334,16 +334,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19809,7 +19809,6 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -343,7 +343,7 @@
      }
      list->qual[3] = qual[13];
      list->qual[4] = qual[14];
@@ -19818,7 +19817,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s3;
-@@ -358,14 +358,14 @@
+@@ -358,14 +358,14 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[20] = caltab[1];
      list->qual[5] = qual[19];
      list->qual[6] = qual[20];
@@ -19840,7 +19839,7 @@
    /*cas 5*/
    do {
      if(!qual[9]) break;
-@@ -376,12 +376,12 @@
+@@ -376,12 +376,12 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19857,7 +19856,7 @@
      }
      list->qual[5] = qual[9];
      list->qual[6] = qual[10];
-@@ -394,16 +394,16 @@
+@@ -394,16 +394,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19879,7 +19878,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -418,7 +418,7 @@
+@@ -418,7 +418,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[22] = caltab[1];
      list->qual[1] = qual[21];
      list->qual[2] = qual[22];
@@ -19888,7 +19887,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -433,18 +433,18 @@
+@@ -433,52 +433,52 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[24] = caltab[1];
      list->qual[3] = qual[23];
      list->qual[4] = qual[24];
@@ -19915,7 +19914,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s1;
-@@ -451,18 +451,18 @@
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19939,7 +19937,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s1;
-@@ -469,16 +469,16 @@
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19961,7 +19958,7 @@
      if(!qual[21]) break;
      else if(qual[21] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -487,18 +487,18 @@
+@@ -487,78 +487,78 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -19986,7 +19983,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s1;
-@@ -505,26 +505,26 @@
        pt1->v[2] = s2;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20024,7 +20020,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s1;
-@@ -531,18 +531,18 @@
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20049,7 +20044,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s3;
-@@ -549,16 +549,16 @@
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20071,7 +20065,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -573,7 +573,7 @@
+@@ -573,7 +573,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[26] = caltab[1];
      list->qual[3] = qual[25];
      list->qual[4] = qual[26];
@@ -20080,7 +20074,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -588,15 +588,15 @@
+@@ -588,15 +588,15 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[28] = caltab[1];
      list->qual[5] = qual[27];
      list->qual[6] = qual[28];
@@ -20104,7 +20098,7 @@
      if(!qual[11]) break;
      else if(qual[11] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -605,16 +605,16 @@
+@@ -605,16 +605,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -20125,7 +20119,7 @@
      if(!qual[19]) break;
      else if(qual[19] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -623,16 +623,16 @@
+@@ -623,16 +623,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -20147,7 +20141,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -647,7 +647,7 @@
+@@ -647,7 +647,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[30] = caltab[1];
      list->qual[1] = qual[29];
      list->qual[2] = qual[30];
@@ -20156,7 +20150,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -662,15 +662,15 @@
+@@ -662,15 +662,15 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[32] = caltab[1];
      list->qual[3] = qual[31];
      list->qual[4] = qual[32];
@@ -20179,7 +20173,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -683,16 +683,16 @@
+@@ -683,16 +683,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20201,7 +20195,7 @@
      if(!qual[17]) break;
      else if(qual[17] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -701,16 +701,16 @@
+@@ -701,16 +701,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20223,7 +20217,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s1;
-@@ -725,12 +725,12 @@
+@@ -725,12 +725,12 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[34] = caltab[1];
      list->qual[7] = qual[33];
      list->qual[8] = qual[34];
@@ -20241,7 +20235,7 @@
    /*cas 10*/
    do {
      if(!qual[7]) break;
-@@ -741,9 +741,9 @@
+@@ -741,9 +741,9 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20254,7 +20248,7 @@
        }
        qual[7] = caltab[0];
        qual[8] = caltab[1];
-@@ -759,9 +759,9 @@
+@@ -759,16 +759,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20266,7 +20260,6 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -768,7 +768,7 @@
      }
      list->qual[1] = qual[21];
      list->qual[2] = qual[22];
@@ -20275,7 +20268,7 @@
      if(!qual[25]) break;
      else if(qual[25] == -1){
        pt1 = &mesh->tetra[0];
-@@ -777,9 +777,9 @@
+@@ -777,16 +777,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s2;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20288,7 +20281,6 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -786,7 +786,7 @@
      }
      list->qual[5] = qual[25];
      list->qual[6] = qual[26];
@@ -20297,7 +20289,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -801,13 +801,13 @@
+@@ -801,13 +801,13 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[36] = caltab[1];
      list->qual[3] = qual[35];
      list->qual[4] = qual[36];
@@ -20317,7 +20309,7 @@
    /*cas 11*/
    do {
      if(!qual[21]) break;
-@@ -818,9 +818,9 @@
+@@ -818,16 +818,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20329,7 +20321,6 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -827,7 +827,7 @@
      }
      list->qual[1] = qual[21];
      list->qual[2] = qual[22];
@@ -20338,7 +20329,7 @@
      if(!qual[29]) break;
      else if(qual[29] == -1){
        pt1 = &mesh->tetra[0];
-@@ -836,9 +836,9 @@
+@@ -836,9 +836,9 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20350,7 +20341,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -854,9 +854,9 @@
+@@ -854,16 +854,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -20363,7 +20354,6 @@
        }
        qual[35] = caltab[0];
        qual[36] = caltab[1];
-@@ -863,7 +863,7 @@
      }
      list->qual[3] = qual[35];
      list->qual[4] = qual[36];
@@ -20372,7 +20362,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -878,13 +878,13 @@
+@@ -878,13 +878,13 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[38] = caltab[1];
      list->qual[5] = qual[37];
      list->qual[6] = qual[38];
@@ -20392,7 +20382,7 @@
    /*cas 12*/
    do {
      if(!qual[17]) break;
-@@ -895,9 +895,9 @@
+@@ -895,16 +895,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20404,7 +20394,6 @@
        }
        qual[17] = caltab[0];
        qual[18] = caltab[1];
-@@ -904,7 +904,7 @@
      }
      list->qual[7] = qual[17];
      list->qual[8] = qual[18];
@@ -20413,7 +20402,7 @@
      if(!qual[27]) break;
      else if(qual[27] == -1){
        pt1 = &mesh->tetra[0];
-@@ -913,9 +913,9 @@
+@@ -913,9 +913,9 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20426,7 +20415,7 @@
        }
        qual[27] = caltab[0];
        qual[28] = caltab[1];
-@@ -923,7 +923,7 @@
+@@ -923,7 +923,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      list->qual[5] = qual[27];
      list->qual[6] = qual[28];
  
@@ -20435,7 +20424,7 @@
      else if(qual[29] == -1){
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
-@@ -931,9 +931,9 @@
+@@ -931,9 +931,9 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20447,7 +20436,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -941,7 +941,7 @@
+@@ -941,7 +941,7 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
  
      list->qual[1] = qual[29];
      list->qual[2] = qual[30];
@@ -20456,7 +20445,7 @@
      if(!qual[37]) break;
      else if(qual[37] == -1){
        pt1 = &mesh->tetra[0];
-@@ -950,9 +950,9 @@
+@@ -950,23 +950,23 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20469,7 +20458,6 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -959,14 +959,14 @@
      }
      list->qual[3] = qual[37];
      list->qual[4] = qual[38];
@@ -20491,7 +20479,7 @@
    /*cas 13*/
    do {
      if(!qual[15]) break;
-@@ -977,9 +977,9 @@
+@@ -977,16 +977,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20504,7 +20492,6 @@
        }
        qual[15] = caltab[0];
        qual[16] = caltab[1];
-@@ -986,7 +986,7 @@
      }
      list->qual[5] = qual[15];
      list->qual[6] = qual[16];
@@ -20513,7 +20500,7 @@
      if(!qual[17]) break;
      else if(qual[17] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -995,9 +995,9 @@
+@@ -995,9 +995,9 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20525,7 +20512,7 @@
        }
        qual[17] = caltab[0];
        qual[18] = caltab[1];
-@@ -1013,9 +1013,9 @@
+@@ -1013,16 +1013,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20538,7 +20525,6 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -1022,7 +1022,7 @@
      }
      list->qual[1] = qual[29];
      list->qual[2] = qual[30];
@@ -20547,7 +20533,7 @@
      if(!qual[31]) break;
      else if(qual[31] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1031,9 +1031,9 @@
+@@ -1031,23 +1031,23 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20559,7 +20545,6 @@
        }
        qual[31] = caltab[0];
        qual[32] = caltab[1];
-@@ -1040,14 +1040,14 @@
      }
      list->qual[3] = qual[31];
      list->qual[4] = qual[32];
@@ -20581,7 +20566,7 @@
    /*cas 14*/
    do {
      if(!qual[11]) break;
-@@ -1058,9 +1058,9 @@
+@@ -1058,16 +1058,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20594,7 +20579,6 @@
        }
        qual[11] = caltab[0];
        qual[12] = caltab[1];
-@@ -1067,7 +1067,7 @@
      }
      list->qual[5] = qual[11];
      list->qual[6] = qual[12];
@@ -20603,7 +20587,7 @@
      if(!qual[21]) break;
      else if(qual[21] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1076,9 +1076,9 @@
+@@ -1076,16 +1076,16 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20616,7 +20600,6 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -1085,7 +1085,7 @@
      }
      list->qual[3] = qual[21];
      list->qual[4] = qual[22];
@@ -20625,7 +20608,7 @@
      if(!qual[29]) break;
      else if(qual[29] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1094,9 +1094,9 @@
+@@ -1094,17 +1094,17 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20638,7 +20621,6 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -1103,8 +1103,8 @@
      }
      list->qual[1] = qual[29];
      list->qual[2] = qual[30];
@@ -20649,7 +20631,7 @@
      pt1 = &mesh->tetra[0];
      pt1->v[0] = ia;
      pt1->v[1] = s2;
-@@ -1119,12 +1119,12 @@
+@@ -1119,12 +1119,12 @@ int MMG_simu68(pMesh mesh,pSol sol,pList
      qual[40] = caltab[1];
      list->qual[7] = qual[39];
      list->qual[8] = qual[40];
@@ -20664,15 +20646,15 @@
    } while(0);
 -  
 -   return(0);
- 
++
 +  return(0);
-+
+ 
  }
-Index: contrib/mmg3d/build/sources/simu710.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu710.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/simu710.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/simu710.c	(working copy)
-@@ -45,15 +45,15 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/simu710.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/simu710.c
+@@ -45,15 +45,15 @@ along with MMG3D. If not, see <http://ww
  ****************************************************************************/
  #include "mesh.h"
  
@@ -20694,7 +20676,7 @@
  
    iel = list->tetra[1] / 6;
    iar = list->tetra[1] % 6;
-@@ -77,11 +77,11 @@
+@@ -77,11 +77,11 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
    iadr = (adj-1)*4 + 1;
    adja = &mesh->adja[iadr];
    if(pt1->v[MMG_idir[voy][0]]==s2) {
@@ -20709,7 +20691,7 @@
    } else {
      puts("MMG_simu710: point s2 non existant");
      exit(0);
-@@ -94,11 +94,11 @@
+@@ -94,11 +94,11 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
    iadr = (adj-1)*4 + 1;
    adja = &mesh->adja[iadr];
    if(pt1->v[MMG_idir[voy][0]]==s3) {
@@ -20724,7 +20706,7 @@
    } else {
      printf("MMG_simu710: point s3 non existant %d \n",s3);
      exit(0);
-@@ -112,11 +112,11 @@
+@@ -112,11 +112,11 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
    iadr = (adj-1)*4 + 1;
    adja = &mesh->adja[iadr];
    if(pt1->v[MMG_idir[voy][0]]==s4) {
@@ -20739,7 +20721,7 @@
    } else {
      puts("MMG_simu710: point s4 non existant");
      exit(0);
-@@ -134,99 +134,99 @@
+@@ -134,99 +134,99 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
    pt1  = &mesh->tetra[adj];
    s7   = pt1->v[voy];
  
@@ -20919,7 +20901,7 @@
    } while(0);
  
    /*cas 2*/
-@@ -243,10 +243,10 @@
+@@ -243,10 +243,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20933,7 +20915,7 @@
        }
        qual[3] = caltab[0];
        qual[4] = caltab[1];
-@@ -262,10 +262,10 @@
+@@ -262,10 +262,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20947,7 +20929,7 @@
        }
        qual[5] = caltab[0];
        qual[6] = caltab[1];
-@@ -324,10 +324,10 @@
+@@ -324,10 +324,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20961,7 +20943,7 @@
        }
        qual[3] = caltab[0];
        qual[4] = caltab[1];
-@@ -343,10 +343,10 @@
+@@ -343,10 +343,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20975,7 +20957,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -404,10 +404,10 @@
+@@ -404,10 +404,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -20989,7 +20971,7 @@
        }
        qual[3] = caltab[0];
        qual[4] = caltab[1];
-@@ -423,10 +423,10 @@
+@@ -423,10 +423,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21003,7 +20985,7 @@
        }
        qual[17] = caltab[0];
        qual[18] = caltab[1];
-@@ -484,10 +484,10 @@
+@@ -484,10 +484,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21017,7 +20999,7 @@
        }
        qual[3] = caltab[0];
        qual[4] = caltab[1];
-@@ -503,10 +503,10 @@
+@@ -503,10 +503,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21031,7 +21013,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -522,10 +522,10 @@
+@@ -522,10 +522,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21046,7 +21028,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -563,10 +563,10 @@
+@@ -563,10 +563,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21060,7 +21042,7 @@
        }
        qual[5] = caltab[0];
        qual[6] = caltab[1];
-@@ -582,10 +582,10 @@
+@@ -582,10 +582,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -21074,7 +21056,7 @@
        }
        qual[7] = caltab[0];
        qual[8] = caltab[1];
-@@ -601,10 +601,10 @@
+@@ -601,10 +601,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21088,7 +21070,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -647,23 +647,23 @@
+@@ -647,23 +647,23 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      return(76);
    } while(0);
  
@@ -21129,7 +21111,7 @@
      }
      list->qual[1] = qual[5];
      list->qual[2] = qual[6];
-@@ -676,10 +676,10 @@
+@@ -676,10 +676,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -21144,7 +21126,7 @@
        }
        qual[11] = caltab[0];
        qual[12] = caltab[1];
-@@ -695,10 +695,10 @@
+@@ -695,10 +695,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21158,7 +21140,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -714,10 +714,10 @@
+@@ -714,10 +714,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21173,7 +21155,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -733,10 +733,10 @@
+@@ -733,10 +733,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21188,7 +21170,7 @@
        }
        qual[27] = caltab[0];
        qual[28] = caltab[1];
-@@ -745,12 +745,12 @@
+@@ -745,22 +745,22 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      list->qual[10] = qual[28];
      MMG_swpptr = MMG_swap710_7;
      return(77);
@@ -21206,7 +21188,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s5;
-@@ -757,10 +757,10 @@
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21220,7 +21201,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -776,10 +776,10 @@
+@@ -776,10 +776,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21235,7 +21216,7 @@
        }
        qual[15] = caltab[0];
        qual[16] = caltab[1];
-@@ -795,10 +795,10 @@
+@@ -795,10 +795,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21249,7 +21230,7 @@
        }
        qual[17] = caltab[0];
        qual[18] = caltab[1];
-@@ -814,10 +814,10 @@
+@@ -814,10 +814,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21264,7 +21245,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -833,10 +833,10 @@
+@@ -833,10 +833,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21279,7 +21260,7 @@
        }
        qual[27] = caltab[0];
        qual[28] = caltab[1];
-@@ -845,10 +845,10 @@
+@@ -845,10 +845,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      list->qual[10] = qual[28];
      MMG_swpptr = MMG_swap710_8;
      return(78);
@@ -21293,7 +21274,7 @@
      if(!qual[17]) break;
      else if(qual[17] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -857,10 +857,10 @@
+@@ -857,10 +857,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21307,7 +21288,7 @@
        }
        qual[17] = caltab[0];
        qual[18] = caltab[1];
-@@ -876,10 +876,10 @@
+@@ -876,10 +876,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21322,7 +21303,7 @@
        }
        qual[19] = caltab[0];
        qual[20] = caltab[1];
-@@ -895,10 +895,10 @@
+@@ -895,10 +895,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21337,7 +21318,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -914,10 +914,10 @@
+@@ -914,10 +914,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21352,7 +21333,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -933,10 +933,10 @@
+@@ -933,10 +933,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21367,7 +21348,7 @@
        }
        qual[27] = caltab[0];
        qual[28] = caltab[1];
-@@ -945,10 +945,10 @@
+@@ -945,10 +945,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      list->qual[10] = qual[28];
      MMG_swpptr = MMG_swap710_9;
      return(79);
@@ -21381,7 +21362,7 @@
      if(!qual[9]) break;
      else if(qual[9] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -957,10 +957,10 @@
+@@ -957,10 +957,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21395,7 +21376,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -976,10 +976,10 @@
+@@ -976,10 +976,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21410,7 +21391,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -995,10 +995,10 @@
+@@ -995,10 +995,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21425,7 +21406,7 @@
        }
        qual[23] = caltab[0];
        qual[24] = caltab[1];
-@@ -1014,10 +1014,10 @@
+@@ -1014,10 +1014,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21440,7 +21421,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -1033,10 +1033,10 @@
+@@ -1033,10 +1033,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21455,7 +21436,7 @@
        }
        qual[27] = caltab[0];
        qual[28] = caltab[1];
-@@ -1047,10 +1047,10 @@
+@@ -1047,10 +1047,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_10;
      memset(pt1,0,sizeof(Tetra));
      return(80);
@@ -21469,7 +21450,7 @@
      if(!qual[25]) break;
      else if(qual[25] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1059,10 +1059,10 @@
+@@ -1059,10 +1059,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21484,7 +21465,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -1137,10 +1137,10 @@
+@@ -1137,10 +1137,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      memset(pt1,0,sizeof(Tetra));
      MMG_swpptr = MMG_swap710_11;
      return(81);
@@ -21498,7 +21479,7 @@
      if(!qual[29]) break;
      else if(qual[29] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1149,10 +1149,10 @@
+@@ -1149,10 +1149,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21513,7 +21494,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -1168,10 +1168,10 @@
+@@ -1168,10 +1168,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21528,7 +21509,7 @@
        }
        qual[31] = caltab[0];
        qual[32] = caltab[1];
-@@ -1187,10 +1187,10 @@
+@@ -1187,10 +1187,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21543,7 +21524,7 @@
        }
        qual[33] = caltab[0];
        qual[34] = caltab[1];
-@@ -1234,10 +1234,10 @@
+@@ -1234,10 +1234,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      memset(pt1,0,sizeof(Tetra));
      return(82);
  
@@ -21557,7 +21538,7 @@
      if(!qual[29]) break;
      else if(qual[29] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1246,10 +1246,10 @@
+@@ -1246,10 +1246,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21572,7 +21553,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -1265,10 +1265,10 @@
+@@ -1265,10 +1265,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21587,7 +21568,7 @@
        }
        qual[31] = caltab[0];
        qual[32] = caltab[1];
-@@ -1284,10 +1284,10 @@
+@@ -1284,10 +1284,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21602,7 +21583,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -1329,10 +1329,10 @@
+@@ -1329,10 +1329,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_13;
      memset(pt1,0,sizeof(Tetra));
      return(84);
@@ -21616,7 +21597,7 @@
      if(!qual[21]) break;
      else if(qual[21] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1341,10 +1341,10 @@
+@@ -1341,10 +1341,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21631,7 +21612,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -1360,10 +1360,10 @@
+@@ -1360,10 +1360,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21646,7 +21627,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -1379,10 +1379,10 @@
+@@ -1379,10 +1379,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21661,7 +21642,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -1398,10 +1398,10 @@
+@@ -1398,10 +1398,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21676,7 +21657,7 @@
        }
        qual[31] = caltab[0];
        qual[32] = caltab[1];
-@@ -1428,10 +1428,10 @@
+@@ -1428,10 +1428,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_15;
      memset(pt1,0,sizeof(Tetra));
      return(85);
@@ -21690,7 +21671,7 @@
      if(!qual[9]) break;
      else if(qual[9] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1440,10 +1440,10 @@
+@@ -1440,10 +1440,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21704,7 +21685,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -1459,10 +1459,10 @@
+@@ -1459,10 +1459,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21719,7 +21700,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -1478,10 +1478,10 @@
+@@ -1478,10 +1478,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21734,7 +21715,7 @@
        }
        qual[33] = caltab[0];
        qual[34] = caltab[1];
-@@ -1497,10 +1497,10 @@
+@@ -1497,10 +1497,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21749,7 +21730,7 @@
        }
        qual[35] = caltab[0];
        qual[36] = caltab[1];
-@@ -1527,10 +1527,10 @@
+@@ -1527,10 +1527,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_16;
      memset(pt1,0,sizeof(Tetra));
      return(86);
@@ -21763,7 +21744,7 @@
      if(!qual[9]) break;
      else if(qual[9] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1539,10 +1539,10 @@
+@@ -1539,10 +1539,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21777,7 +21758,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -1558,10 +1558,10 @@
+@@ -1558,10 +1558,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21792,7 +21773,7 @@
        }
        qual[33] = caltab[0];
        qual[34] = caltab[1];
-@@ -1577,10 +1577,10 @@
+@@ -1577,10 +1577,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21807,7 +21788,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -1596,10 +1596,10 @@
+@@ -1596,10 +1596,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21822,7 +21803,7 @@
        }
        qual[39] = caltab[0];
        qual[40] = caltab[1];
-@@ -1615,10 +1615,10 @@
+@@ -1615,10 +1615,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21837,7 +21818,7 @@
        }
        qual[49] = caltab[0];
        qual[50] = caltab[1];
-@@ -1629,10 +1629,10 @@
+@@ -1629,10 +1629,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_17;
      memset(pt1,0,sizeof(Tetra));
      return(87);
@@ -21851,7 +21832,7 @@
      if(!qual[9]) break;
      else if(qual[9] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1641,10 +1641,10 @@
+@@ -1641,10 +1641,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21865,7 +21846,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -1660,10 +1660,10 @@
+@@ -1660,10 +1660,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21880,7 +21861,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -1671,7 +1671,7 @@
+@@ -1671,7 +1671,7 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      list->qual[3] = qual[37];
      list->qual[4] = qual[38];
  
@@ -21889,7 +21870,7 @@
      else if(qual[41] == -1) {
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
-@@ -1679,10 +1679,10 @@
+@@ -1679,10 +1679,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21904,7 +21885,7 @@
        }
        qual[41] = caltab[0];
        qual[42] = caltab[1];
-@@ -1698,10 +1698,10 @@
+@@ -1698,10 +1698,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21919,7 +21900,7 @@
        }
        qual[43] = caltab[0];
        qual[44] = caltab[1];
-@@ -1717,10 +1717,10 @@
+@@ -1717,10 +1717,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21934,7 +21915,7 @@
        }
        qual[49] = caltab[0];
        qual[50] = caltab[1];
-@@ -1731,10 +1731,10 @@
+@@ -1731,10 +1731,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_18;
      memset(pt1,0,sizeof(Tetra));
      return(88);
@@ -21948,7 +21929,7 @@
      if(!qual[9]) break;
      else if(qual[9] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1743,10 +1743,10 @@
+@@ -1743,10 +1743,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21962,7 +21943,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -1762,10 +1762,10 @@
+@@ -1762,10 +1762,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -21977,7 +21958,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -1781,10 +1781,10 @@
+@@ -1781,10 +1781,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -21992,7 +21973,7 @@
        }
        qual[41] = caltab[0];
        qual[42] = caltab[1];
-@@ -1800,10 +1800,10 @@
+@@ -1800,10 +1800,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22007,7 +21988,7 @@
        }
        qual[45] = caltab[0];
        qual[46] = caltab[1];
-@@ -1819,10 +1819,10 @@
+@@ -1819,10 +1819,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22022,7 +22003,7 @@
        }
        qual[49] = caltab[0];
        qual[50] = caltab[1];
-@@ -1834,10 +1834,10 @@
+@@ -1834,10 +1834,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_19;
      memset(pt1,0,sizeof(Tetra));
      return(89);
@@ -22036,7 +22017,7 @@
      if(!qual[9]) break;
      else if(qual[9] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -1846,10 +1846,10 @@
+@@ -1846,10 +1846,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22050,7 +22031,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -1865,10 +1865,10 @@
+@@ -1865,10 +1865,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22065,7 +22046,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -1884,10 +1884,10 @@
+@@ -1884,10 +1884,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22080,7 +22061,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -1903,10 +1903,10 @@
+@@ -1903,10 +1903,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22095,7 +22076,7 @@
        }
        qual[47] = caltab[0];
        qual[48] = caltab[1];
-@@ -1921,10 +1921,10 @@
+@@ -1921,10 +1921,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
        pt1->v[2] = s2;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22110,7 +22091,7 @@
        }
        qual[49] = caltab[0];
        qual[50] = caltab[1];
-@@ -1935,10 +1935,10 @@
+@@ -1935,10 +1935,10 @@ int MMG_simu710(pMesh mesh,pSol sol,pLis
      MMG_swpptr = MMG_swap710_20;
      memset(pt1,0,sizeof(Tetra));
      return(90);
@@ -22124,7 +22105,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -1951,10 +1951,10 @@
+@@ -1951,10 +1951,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22139,7 +22120,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -1970,10 +1970,10 @@
+@@ -1970,10 +1970,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22154,7 +22135,7 @@
        }
        qual[43] = caltab[0];
        qual[44] = caltab[1];
-@@ -1989,10 +1989,10 @@
+@@ -1989,10 +1989,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22169,7 +22150,7 @@
        }
        qual[69] = caltab[0];
        qual[70] = caltab[1];
-@@ -2019,10 +2019,10 @@
+@@ -2019,10 +2019,10 @@ do {
      MMG_swpptr = MMG_swap710_21;
      memset(pt1,0,sizeof(Tetra));
      return(91);
@@ -22183,7 +22164,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -2035,10 +2035,10 @@
+@@ -2035,10 +2035,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22198,7 +22179,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -2054,10 +2054,10 @@
+@@ -2054,10 +2054,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22213,7 +22194,7 @@
        }
        qual[45] = caltab[0];
        qual[46] = caltab[1];
-@@ -2073,10 +2073,10 @@
+@@ -2073,10 +2073,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22228,7 +22209,7 @@
        }
        qual[51] = caltab[0];
        qual[52] = caltab[1];
-@@ -2092,10 +2092,10 @@
+@@ -2092,10 +2092,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22243,7 +22224,7 @@
        }
        qual[69] = caltab[0];
        qual[70] = caltab[1];
-@@ -2106,10 +2106,10 @@
+@@ -2106,10 +2106,10 @@ do {
      MMG_swpptr = MMG_swap710_22;
      memset(pt1,0,sizeof(Tetra));
      return(92);
@@ -22257,7 +22238,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -2122,10 +2122,10 @@
+@@ -2122,10 +2122,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22272,7 +22253,7 @@
        }
        qual[19] = caltab[0];
        qual[20] = caltab[1];
-@@ -2141,10 +2141,10 @@
+@@ -2141,10 +2141,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22287,7 +22268,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -2160,10 +2160,10 @@
+@@ -2160,10 +2160,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22302,7 +22283,7 @@
        }
        qual[51] = caltab[0];
        qual[52] = caltab[1];
-@@ -2191,10 +2191,10 @@
+@@ -2191,10 +2191,10 @@ do {
      MMG_swpptr = MMG_swap710_23;
      memset(pt1,0,sizeof(Tetra));
      return(93);
@@ -22316,7 +22297,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -2207,10 +2207,10 @@
+@@ -2207,10 +2207,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22330,7 +22311,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -2226,10 +2226,10 @@
+@@ -2226,10 +2226,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22345,7 +22326,7 @@
        }
        qual[15] = caltab[0];
        qual[16] = caltab[1];
-@@ -2245,10 +2245,10 @@
+@@ -2245,10 +2245,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22360,7 +22341,7 @@
        }
        qual[51] = caltab[0];
        qual[52] = caltab[1];
-@@ -2264,10 +2264,10 @@
+@@ -2264,10 +2264,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22375,7 +22356,7 @@
        }
        qual[53] = caltab[0];
        qual[54] = caltab[1];
-@@ -2278,10 +2278,10 @@
+@@ -2278,10 +2278,10 @@ do {
      MMG_swpptr = MMG_swap710_24;
      memset(pt1,0,sizeof(Tetra));
      return(94);
@@ -22389,7 +22370,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -2294,10 +2294,10 @@
+@@ -2294,10 +2294,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22403,7 +22384,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -2313,10 +2313,10 @@
+@@ -2313,10 +2313,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22418,7 +22399,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -2332,10 +2332,10 @@
+@@ -2332,10 +2332,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22433,7 +22414,7 @@
        }
        qual[51] = caltab[0];
        qual[52] = caltab[1];
-@@ -2363,10 +2363,10 @@
+@@ -2363,10 +2363,10 @@ do {
      MMG_swpptr = MMG_swap710_25;
      memset(pt1,0,sizeof(Tetra));
      return(95);
@@ -22447,7 +22428,7 @@
      if(!qual[29]) break;
      else if(qual[29] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -2375,10 +2375,10 @@
+@@ -2375,10 +2375,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22462,7 +22443,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -2394,10 +2394,10 @@
+@@ -2394,10 +2394,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22477,7 +22458,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -2413,10 +2413,10 @@
+@@ -2413,10 +2413,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22492,7 +22473,7 @@
        }
        qual[43] = caltab[0];
        qual[44] = caltab[1];
-@@ -2432,10 +2432,10 @@
+@@ -2432,10 +2432,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22507,7 +22488,7 @@
        }
        qual[69] = caltab[0];
        qual[70] = caltab[1];
-@@ -2462,10 +2462,10 @@
+@@ -2462,10 +2462,10 @@ do {
      MMG_swpptr = MMG_swap710_26;
      memset(pt1,0,sizeof(Tetra));
      return(96);
@@ -22521,7 +22502,7 @@
      if(!qual[21]) break;
      else if(qual[21] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -2474,10 +2474,10 @@
+@@ -2474,10 +2474,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22536,7 +22517,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -2493,10 +2493,10 @@
+@@ -2493,10 +2493,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22551,7 +22532,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -2512,10 +2512,10 @@
+@@ -2512,10 +2512,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22566,7 +22547,7 @@
        }
        qual[45] = caltab[0];
        qual[46] = caltab[1];
-@@ -2531,10 +2531,10 @@
+@@ -2531,10 +2531,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22581,7 +22562,7 @@
        }
        qual[57] = caltab[0];
        qual[58] = caltab[1];
-@@ -2560,10 +2560,10 @@
+@@ -2560,10 +2560,10 @@ do {
      MMG_swpptr = MMG_swap710_27;
      memset(pt1,0,sizeof(Tetra));
      return(97);
@@ -22595,7 +22576,7 @@
      if(!qual[19]) break;
      else if(qual[19] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -2572,10 +2572,10 @@
+@@ -2572,10 +2572,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22610,7 +22591,7 @@
        }
        qual[19] = caltab[0];
        qual[20] = caltab[1];
-@@ -2591,10 +2591,10 @@
+@@ -2591,10 +2591,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22625,7 +22606,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -2610,10 +2610,10 @@
+@@ -2610,10 +2610,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22640,7 +22621,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -2629,10 +2629,10 @@
+@@ -2629,10 +2629,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22655,7 +22636,7 @@
        }
        qual[53] = caltab[0];
        qual[54] = caltab[1];
-@@ -2648,10 +2648,10 @@
+@@ -2648,10 +2648,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22670,7 +22651,7 @@
        }
        qual[57] = caltab[0];
        qual[58] = caltab[1];
-@@ -2662,12 +2662,12 @@
+@@ -2662,22 +2662,22 @@ do {
      MMG_swpptr = MMG_swap710_28;
      memset(pt1,0,sizeof(Tetra));
      return(98);
@@ -22688,7 +22669,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s5;
-@@ -2674,10 +2674,10 @@
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22702,7 +22682,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -2693,10 +2693,10 @@
+@@ -2693,10 +2693,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22717,7 +22697,7 @@
        }
        qual[15] = caltab[0];
        qual[16] = caltab[1];
-@@ -2712,10 +2712,10 @@
+@@ -2712,10 +2712,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22732,7 +22712,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -2731,10 +2731,10 @@
+@@ -2731,10 +2731,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22747,7 +22727,7 @@
        }
        qual[53] = caltab[0];
        qual[54] = caltab[1];
-@@ -2750,10 +2750,10 @@
+@@ -2750,10 +2750,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22762,7 +22742,7 @@
        }
        qual[57] = caltab[0];
        qual[58] = caltab[1];
-@@ -2764,12 +2764,12 @@
+@@ -2764,22 +2764,22 @@ do {
      MMG_swpptr = MMG_swap710_29;
      memset(pt1,0,sizeof(Tetra));
      return(99);
@@ -22780,7 +22760,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s5;
-@@ -2776,10 +2776,10 @@
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22794,7 +22773,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -2795,10 +2795,10 @@
+@@ -2795,10 +2795,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22809,7 +22788,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -2814,10 +2814,10 @@
+@@ -2814,10 +2814,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22824,7 +22803,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -2833,10 +2833,10 @@
+@@ -2833,10 +2833,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22839,7 +22818,7 @@
        }
        qual[55] = caltab[0];
        qual[56] = caltab[1];
-@@ -2852,10 +2852,10 @@
+@@ -2852,10 +2852,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22854,7 +22833,7 @@
        }
        qual[57] = caltab[0];
        qual[58] = caltab[1];
-@@ -2866,10 +2866,10 @@
+@@ -2866,10 +2866,10 @@ do {
      MMG_swpptr = MMG_swap710_30;
      memset(pt1,0,sizeof(Tetra));
      return(100);
@@ -22868,7 +22847,7 @@
      if(!qual[19]) break;
      else if(qual[19] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -2878,10 +2878,10 @@
+@@ -2878,10 +2878,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22883,7 +22862,7 @@
        }
        qual[19] = caltab[0];
        qual[20] = caltab[1];
-@@ -2897,10 +2897,10 @@
+@@ -2897,10 +2897,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22898,7 +22877,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -2916,10 +2916,10 @@
+@@ -2916,10 +2916,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22913,7 +22892,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -2935,10 +2935,10 @@
+@@ -2935,10 +2935,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22928,7 +22907,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -2965,12 +2965,12 @@
+@@ -2965,22 +2965,22 @@ do {
      MMG_swpptr = MMG_swap710_31;
      memset(pt1,0,sizeof(Tetra));
      return(101);
@@ -22946,7 +22925,6 @@
        pt1 = &mesh->tetra[0];
        pt1->v[0] = ia;
        pt1->v[1] = s5;
-@@ -2977,10 +2977,10 @@
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22960,7 +22938,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -2996,10 +2996,10 @@
+@@ -2996,10 +2996,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -22975,7 +22953,7 @@
        }
        qual[15] = caltab[0];
        qual[16] = caltab[1];
-@@ -3015,10 +3015,10 @@
+@@ -3015,10 +3015,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -22990,7 +22968,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -3034,10 +3034,10 @@
+@@ -3034,10 +3034,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23005,7 +22983,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -3053,10 +3053,10 @@
+@@ -3053,10 +3053,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23020,7 +22998,7 @@
        }
        qual[59] = caltab[0];
        qual[60] = caltab[1];
-@@ -3067,10 +3067,10 @@
+@@ -3067,10 +3067,10 @@ do {
      MMG_swpptr = MMG_swap710_32;
      memset(pt1,0,sizeof(Tetra));
      return(102);
@@ -23034,7 +23012,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -3083,10 +3083,10 @@
+@@ -3083,10 +3083,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -23048,7 +23026,7 @@
        }
        qual[7] = caltab[0];
        qual[8] = caltab[1];
-@@ -3102,10 +3102,10 @@
+@@ -3102,10 +3102,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23062,7 +23040,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -3121,10 +3121,10 @@
+@@ -3121,10 +3121,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23077,7 +23055,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -3151,10 +3151,10 @@
+@@ -3151,10 +3151,10 @@ do {
      MMG_swpptr = MMG_swap710_33;
      memset(pt1,0,sizeof(Tetra));
      return(103);
@@ -23091,7 +23069,7 @@
      if(!qual[7]) break;
      else if(qual[7] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -3163,10 +3163,10 @@
+@@ -3163,10 +3163,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -23105,7 +23083,7 @@
        }
        qual[7] = caltab[0];
        qual[8] = caltab[1];
-@@ -3182,10 +3182,10 @@
+@@ -3182,10 +3182,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23119,7 +23097,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -3201,10 +3201,10 @@
+@@ -3201,10 +3201,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23134,7 +23112,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -3220,10 +3220,10 @@
+@@ -3220,10 +3220,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23149,7 +23127,7 @@
        }
        qual[39] = caltab[0];
        qual[40] = caltab[1];
-@@ -3250,10 +3250,10 @@
+@@ -3250,10 +3250,10 @@ do {
      MMG_swpptr = MMG_swap710_34;
      memset(pt1,0,sizeof(Tetra));
      return(104);
@@ -23163,7 +23141,7 @@
      if(!qual[7]) break;
      else if(qual[7] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -3262,10 +3262,10 @@
+@@ -3262,10 +3262,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -23177,7 +23155,7 @@
        }
        qual[7] = caltab[0];
        qual[8] = caltab[1];
-@@ -3281,10 +3281,10 @@
+@@ -3281,10 +3281,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23191,7 +23169,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -3300,10 +3300,10 @@
+@@ -3300,10 +3300,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23206,7 +23184,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -3319,10 +3319,10 @@
+@@ -3319,10 +3319,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23221,7 +23199,7 @@
        }
        qual[35] = caltab[0];
        qual[36] = caltab[1];
-@@ -3338,10 +3338,10 @@
+@@ -3338,10 +3338,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23236,7 +23214,7 @@
        }
        qual[63] = caltab[0];
        qual[64] = caltab[1];
-@@ -3352,10 +3352,10 @@
+@@ -3352,10 +3352,10 @@ do {
      MMG_swpptr = MMG_swap710_35;
      memset(pt1,0,sizeof(Tetra));
      return(105);
@@ -23250,7 +23228,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -3368,10 +3368,10 @@
+@@ -3368,10 +3368,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -23265,7 +23243,7 @@
        }
        qual[11] = caltab[0];
        qual[12] = caltab[1];
-@@ -3387,10 +3387,10 @@
+@@ -3387,10 +3387,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23279,7 +23257,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -3406,10 +3406,10 @@
+@@ -3406,10 +3406,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23294,7 +23272,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -3425,10 +3425,10 @@
+@@ -3425,10 +3425,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23309,7 +23287,7 @@
        }
        qual[61] = caltab[0];
        qual[62] = caltab[1];
-@@ -3439,10 +3439,10 @@
+@@ -3439,10 +3439,10 @@ do {
      MMG_swpptr = MMG_swap710_36;
      memset(pt1,0,sizeof(Tetra));
      return(106);
@@ -23323,7 +23301,7 @@
      if(!qual[11]) break;
      else if (qual[11] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -3451,10 +3451,10 @@
+@@ -3451,10 +3451,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -23338,7 +23316,7 @@
        }
        qual[11] = caltab[0];
        qual[12] = caltab[1];
-@@ -3470,10 +3470,10 @@
+@@ -3470,10 +3470,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23352,7 +23330,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -3489,10 +3489,10 @@
+@@ -3489,10 +3489,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23367,7 +23345,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -3508,10 +3508,10 @@
+@@ -3508,10 +3508,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23382,7 +23360,7 @@
        }
        qual[39] = caltab[0];
        qual[40] = caltab[1];
-@@ -3527,10 +3527,10 @@
+@@ -3527,10 +3527,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23397,7 +23375,7 @@
        }
        qual[63] = caltab[0];
        qual[64] = caltab[1];
-@@ -3541,10 +3541,10 @@
+@@ -3541,10 +3541,10 @@ do {
      MMG_swpptr = MMG_swap710_37;
      memset(pt1,0,sizeof(Tetra));
      return(107);
@@ -23411,7 +23389,7 @@
      if(!qual[11]) break;
      else if (qual[11] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -3553,10 +3553,10 @@
+@@ -3553,10 +3553,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab))  {
@@ -23426,7 +23404,7 @@
        }
        qual[11] = caltab[0];
        qual[12] = caltab[1];
-@@ -3572,10 +3572,10 @@
+@@ -3572,10 +3572,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23440,7 +23418,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -3591,10 +3591,10 @@
+@@ -3591,10 +3591,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23455,7 +23433,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -3610,10 +3610,10 @@
+@@ -3610,10 +3610,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23470,7 +23448,7 @@
        }
        qual[35] = caltab[0];
        qual[36] = caltab[1];
-@@ -3629,10 +3629,10 @@
+@@ -3629,10 +3629,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23485,7 +23463,7 @@
        }
        qual[63] = caltab[0];
        qual[64] = caltab[1];
-@@ -3643,10 +3643,10 @@
+@@ -3643,10 +3643,10 @@ do {
      MMG_swpptr = MMG_swap710_38;
      memset(pt1,0,sizeof(Tetra));
      return(108);
@@ -23499,7 +23477,7 @@
      if(!qual[13]) break;
      else if(qual[13] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -3655,10 +3655,10 @@
+@@ -3655,10 +3655,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23513,7 +23491,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -3674,10 +3674,10 @@
+@@ -3674,10 +3674,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23528,7 +23506,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -3693,10 +3693,10 @@
+@@ -3693,10 +3693,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23543,7 +23521,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -3712,10 +3712,10 @@
+@@ -3712,10 +3712,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23558,7 +23536,7 @@
        }
        qual[39] = caltab[0];
        qual[40] = caltab[1];
-@@ -3742,10 +3742,10 @@
+@@ -3742,10 +3742,10 @@ do {
      MMG_swpptr = MMG_swap710_39;
      memset(pt1,0,sizeof(Tetra));
      return(109);
@@ -23572,7 +23550,7 @@
      if(!qual[13]) break;
      else if(qual[13] == -1) {
        pt1 = &mesh->tetra[0];
-@@ -3754,10 +3754,10 @@
+@@ -3754,10 +3754,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23586,7 +23564,7 @@
        }
        qual[13] = caltab[0];
        qual[14] = caltab[1];
-@@ -3773,10 +3773,10 @@
+@@ -3773,10 +3773,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s4;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23601,7 +23579,7 @@
        }
        qual[25] = caltab[0];
        qual[26] = caltab[1];
-@@ -3792,10 +3792,10 @@
+@@ -3792,10 +3792,10 @@ do {
        pt1->v[2] = s2;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23616,7 +23594,7 @@
        }
        qual[29] = caltab[0];
        qual[30] = caltab[1];
-@@ -3811,10 +3811,10 @@
+@@ -3811,10 +3811,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23631,7 +23609,7 @@
        }
        qual[35] = caltab[0];
        qual[36] = caltab[1];
-@@ -3830,10 +3830,10 @@
+@@ -3830,10 +3830,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23646,7 +23624,7 @@
        }
        qual[65] = caltab[0];
        qual[66] = caltab[1];
-@@ -3844,10 +3844,10 @@
+@@ -3844,10 +3844,10 @@ do {
      MMG_swpptr = MMG_swap710_40;
      memset(pt1,0,sizeof(Tetra));
      return(110);
@@ -23660,7 +23638,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -3860,10 +3860,10 @@
+@@ -3860,10 +3860,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -23674,7 +23652,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -3879,10 +3879,10 @@
+@@ -3879,10 +3879,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -23689,7 +23667,7 @@
        }
        qual[21] = caltab[0];
        qual[22] = caltab[1];
-@@ -3898,10 +3898,10 @@
+@@ -3898,10 +3898,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23704,7 +23682,7 @@
        }
        qual[45] = caltab[0];
        qual[46] = caltab[1];
-@@ -3928,10 +3928,10 @@
+@@ -3928,10 +3928,10 @@ do {
      MMG_swpptr = MMG_swap710_41;
      memset(pt1,0,sizeof(Tetra));
      return(111);
@@ -23718,7 +23696,7 @@
      if(!qual[1]) break;
      list->qual[1] = qual[1];
      list->qual[2] = qual[2];
-@@ -3944,10 +3944,10 @@
+@@ -3944,10 +3944,10 @@ do {
        pt1->v[2] = s6;
        pt1->v[3] = s7;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)){
@@ -23732,7 +23710,7 @@
        }
        qual[9]  = caltab[0];
        qual[10] = caltab[1];
-@@ -3963,10 +3963,10 @@
+@@ -3963,10 +3963,10 @@ do {
        pt1->v[2] = s4;
        pt1->v[3] = s5;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23747,7 +23725,7 @@
        }
        qual[37] = caltab[0];
        qual[38] = caltab[1];
-@@ -3982,10 +3982,10 @@
+@@ -3982,10 +3982,10 @@ do {
        pt1->v[2] = s5;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23762,7 +23740,7 @@
        }
        qual[43] = caltab[0];
        qual[44] = caltab[1];
-@@ -4001,10 +4001,10 @@
+@@ -4001,10 +4001,10 @@ do {
        pt1->v[2] = s3;
        pt1->v[3] = s6;
        if(!MMG_caltet2(mesh,sol,0,ib,crit,caltab)) {
@@ -23777,7 +23755,7 @@
        }
        qual[67] = caltab[0];
        qual[68] = caltab[1];
-@@ -4015,7 +4015,7 @@
+@@ -4015,7 +4015,7 @@ do {
      MMG_swpptr = MMG_swap710_42;
      memset(pt1,0,sizeof(Tetra));
      return(112);
@@ -23787,11 +23765,11 @@
 - return(0);
 +  return(0);
  }
-Index: contrib/mmg3d/build/sources/solmap.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/solmap.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/solmap.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/solmap.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/solmap.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/solmap.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -23826,7 +23804,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -23837,7 +23814,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -23846,7 +23823,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -107,12 +107,12 @@
+@@ -107,12 +107,12 @@ int MMG_doSol(pMesh mesh,pSol sol) {
        dd  = sqrt(ux*ux + uy*uy + uz*uz);
  
        //if ( !(p1->tag & M_BDRY) ) {
@@ -23863,7 +23840,7 @@
        //}
      }
    }
-@@ -125,7 +125,7 @@
+@@ -125,7 +125,7 @@ int MMG_doSol(pMesh mesh,pSol sol) {
      if ( !p1->mark )  continue;
  
      sol->met[k] = sol->met[k] / (double)p1->mark;
@@ -23872,7 +23849,7 @@
      if ( sol->met[k] < sol->hmin )
        sol->hmin = sol->met[k];
      else if ( sol->met[k] > sol->hmax )
-@@ -135,29 +135,29 @@
+@@ -135,74 +135,73 @@ int MMG_doSol(pMesh mesh,pSol sol) {
    }
  
    if ( mesh->info.imprim < -4 )
@@ -23914,7 +23891,6 @@
    ppt = &mesh->point[ip];
    base = ++mesh->mark;
    ktet = MMG_loctet(mesh,ppt->tmp,base,coor,cb);
-@@ -164,10 +164,10 @@
    if(!ktet) return(-1);
    assert(ktet < mesh->ne + 1);
    pt = &mesh->tetra[ktet];
@@ -23927,7 +23903,6 @@
      for(k = 1 ; k < 4 ; k++) {
        sol->met[ip] += cb[k] * sol->metold[pt->v[k]];
      }
-@@ -174,35 +174,34 @@
    } else {
      iadr = (ip-1)*sol->offset + 1;
      mp   = &sol->met[iadr];
@@ -23975,11 +23950,11 @@
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/spledg.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/spledg.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/spledg.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/spledg.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/spledg.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/spledg.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -24014,7 +23989,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -24025,7 +23999,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -24034,7 +24008,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -55,7 +55,7 @@
+@@ -55,7 +55,7 @@ int MMG_spledg(pMesh mesh,pSol sol,pQueu
    double    *ca,*cb,c[3],*ma,*mb,*mip,mp[6];
    int       l,ipa,ipb,ip,jel,na,nbt,iel,iar,ret,iadr;
    short     ia,ib;
@@ -24043,7 +24017,7 @@
    iel = list->tetra[1] / 6;
    iar = list->tetra[1] % 6;
    ia  = MMG_iare[iar][0];
-@@ -66,19 +66,19 @@
+@@ -66,28 +66,28 @@ int MMG_spledg(pMesh mesh,pSol sol,pQueu
    ipb = pt->v[ib];
    pa  = &mesh->point[ipa];
    pb  = &mesh->point[ipb];
@@ -24067,7 +24041,6 @@
    c[0] = 0.5*(ca[0] + cb[0]);
    c[1] = 0.5*(ca[1] + cb[1]);
    c[2] = 0.5*(ca[2] + cb[2]);
-@@ -85,9 +85,9 @@
    ip   = MMG_newPt(mesh,c);
    if ( ip < 1 ) return(0);
    iadr = (ip-1)*sol->offset + 1;
@@ -24079,7 +24052,7 @@
    /* eval coquille */
    pt0  = &mesh->tetra[0];
    nbt  = 0;
-@@ -96,6 +96,9 @@
+@@ -96,6 +96,9 @@ int MMG_spledg(pMesh mesh,pSol sol,pQueu
      na  = list->tetra[l] % 6;
      pt1 = &mesh->tetra[jel];
  
@@ -24089,7 +24062,7 @@
      memcpy(pt0->v,pt1->v,4*sizeof(int));
      ipb = MMG_iare[na][0];
      pt0->v[ipb] = ip;
-@@ -125,8 +128,7 @@
+@@ -125,8 +128,7 @@ int MMG_spledg(pMesh mesh,pSol sol,pQueu
      MMG_delPt(mesh,ip);
      return(0);
    }
@@ -24100,11 +24073,11 @@
    }
  }
 -
-Index: contrib/mmg3d/build/sources/sproto.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/sproto.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/sproto.h	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/sproto.h	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/sproto.h
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/sproto.h
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -24139,7 +24112,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -24150,7 +24122,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -24159,7 +24131,7 @@
  ****************************************************************************/
  
  int MMG_cassar(pMesh mesh,pSol sol,int ipa,int ipb,float t);
-@@ -56,8 +56,8 @@
+@@ -56,8 +56,8 @@ int MMG_spledg(pMesh ,pSol ,pQueue ,pLis
  int MMG_correction(pMesh ,int ,pList ,int ,int ,char );
  int MMG_delone(pMesh ,pSol ,int ,pList ,int );
  int MMG_delons(pMesh ,pSol ,pQueue ,int ,pList ,int ,float );
@@ -24170,7 +24142,7 @@
  
  int MMG_colpoi(pMesh ,pSol ,int ,int ,int ,float );
  
-@@ -109,7 +109,7 @@
+@@ -109,7 +109,7 @@ int  MMG_optlap(pMesh ,pSol );
  
  /* swapar */
  typedef int (*MMG_Swap)(pMesh ,pSol ,pList );
@@ -24179,16 +24151,16 @@
  
  int  MMG_swapar(pMesh ,pSol ,pQueue ,List *,int ,float ,float );
  
-@@ -237,4 +237,3 @@
+@@ -237,4 +237,3 @@ void   MMG_kiufree(pQueue );
  int MMG_invmat(double *,double *);
  
  double MMG_calte3_ani(pMesh mesh,pSol sol,int iel);
 -
-Index: contrib/mmg3d/build/sources/swap23.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap23.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swap23.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swap23.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swap23.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap23.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -24223,7 +24195,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -24234,7 +24205,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -24243,7 +24214,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -56,7 +56,7 @@
+@@ -56,7 +56,7 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
    iadr = 4*(iel-1) + 1;
    adja = &mesh->adja[iadr];
    v    = pt->v[iar];
@@ -24252,7 +24223,7 @@
    i_a = adja[iar] >> 2;
    assert(i_a);
    voy_a = adja[iar] % 4;
-@@ -64,10 +64,10 @@
+@@ -64,10 +64,10 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
    v_a = pt_a->v[voy_a];
    iadr = 4*(i_a-1) + 1;
    adja_a = &mesh->adja[iadr];
@@ -24266,7 +24237,7 @@
    n0 = MMG_idir[iar][0];
    n1 = MMG_idir[iar][1];
    n2 = MMG_idir[iar][2];
-@@ -75,7 +75,7 @@
+@@ -75,7 +75,7 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
    s[0] = pt->v[n0];
    s[1] = pt->v[n1];
    s[2] = pt->v[n2];
@@ -24275,7 +24246,7 @@
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
    pt1->v[1] = v_a;
-@@ -86,13 +86,13 @@
+@@ -86,13 +86,13 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
    if ( pt1->qual >= declic )  MMG_kiuput(q,jel);
@@ -24291,7 +24262,7 @@
    pt2->qual = MMG_caltet(mesh,sol,kel);
    pt2->flag = mesh->flag;
    pt2->ref  = ref;
-@@ -103,151 +103,151 @@
+@@ -103,151 +103,151 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
    pt3->v[1] = v_a;
    pt3->v[0] = v;
    pt3->v[2] = s[2];
@@ -24546,7 +24517,7 @@
    }
  
    adj0 = MMG_idir[voy_a][0];
-@@ -257,163 +257,163 @@
+@@ -257,209 +257,209 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
    if(pt_a->v[MMG_idir[MMG_idir[voy_a][0]][0]] == v_a) {
      if(pt_a->v[MMG_idir[MMG_idir[voy_a][0]][1]] == s[0]
         || pt_a->v[MMG_idir[MMG_idir[voy_a][0]][2]] == s[0]) {
@@ -24821,7 +24792,6 @@
    iadr = 4*(kel-1) + 1;
    adja1 = &mesh->adja[iadr];
    adja1[1] = adja[a1];
-@@ -420,23 +420,23 @@
    adja1[0] = adja_a[adj1];
    adja1[2] = 4*lel + 3;
    adja1[3] = 4*jel + 2;
@@ -24854,7 +24824,6 @@
    iadr = 4*(lel-1) + 1;
    adja1 = &mesh->adja[iadr];
    adja1[1] = adja[a2];
-@@ -443,23 +443,23 @@
    adja1[0] = adja_a[adj2];
    adja1[2] = 4*jel + 3;
    adja1[3] = 4*kel + 2;
@@ -24887,7 +24856,7 @@
    /*del*/
    MMG_delElt(mesh,iel);
    MMG_delElt(mesh,i_a);
-@@ -473,15 +473,15 @@
+@@ -473,30 +473,30 @@ int MMG_swap23(pMesh mesh,pSol sol,pQueu
  
  /* remove edge AB */
  int MMG_swap32(pMesh mesh,pSol sol,pList list) {
@@ -24909,7 +24878,6 @@
  
    /* face s1 s2 s3 */
    iel  = list->tetra[1] / 6;
-@@ -488,15 +488,15 @@
    iar  = list->tetra[1] % 6;
    pt   = &mesh->tetra[iel];
    ref  = pt->ref;
@@ -24930,7 +24898,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][0];
-@@ -505,9 +505,9 @@
+@@ -505,9 +505,9 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
    pt1  = &mesh->tetra[adj];
    s3   = pt1->v[voy];
  
@@ -24942,7 +24910,7 @@
    pt1 = &mesh->tetra[jel];
    pt1->v[0] = ia;
    pt1->v[1] = s1;
-@@ -516,7 +516,7 @@
+@@ -516,7 +516,7 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -24951,7 +24919,7 @@
    /* 2nd elt */
    /*edge : ibs2 -- ibs1 -- ibs3 -- s2s1 -- s2s3 -- s2s3*/
    kel = MMG_newElt(mesh);
-@@ -535,11 +535,11 @@
+@@ -535,11 +535,11 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
      iadr = (old-1)*4 + 1;
      adja = &mesh->adja[iadr];
  
@@ -24968,7 +24936,7 @@
      iarold = list->tetra[k] % 6;
      kk     = MMG_iare[iarold][1];
      if( pt0->v[kk] == ib ) {
-@@ -549,66 +549,66 @@
+@@ -549,66 +549,66 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] >> 2;
        voy_b  = adja[kk] % 4;
@@ -25067,7 +25035,7 @@
    }
  
    /* du tetra 1 de la liste pour ia */
-@@ -617,16 +617,16 @@
+@@ -617,16 +617,16 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
    k    = MMG_iare[iar][1];
    adj  = adja[k] >> 2;
    voy  = adja[k] % 4;
@@ -25087,7 +25055,7 @@
    }
  
    /* du tetra 1 de la liste pour ib */
-@@ -635,16 +635,16 @@
+@@ -635,16 +635,16 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
    k    = MMG_iare[iar][0];
    adj  = adja[k] >> 2;
    voy  = adja[k] % 4;
@@ -25107,7 +25075,7 @@
    }
  
    /* internal face */
-@@ -655,15 +655,15 @@
+@@ -655,14 +655,14 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
    iadr = (kel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = jel*4 + 0;
@@ -25119,7 +25087,7 @@
 -		pt2->bdryinfo[i] = MMG_edgePut(&hed,pt2->v[MMG_iare[i][0]],pt2->v[MMG_iare[i][1]],1);
 -		assert(pt2->bdryinfo[i]!=1);
 -	}
- 
++
 +  for(i=0 ; i<6 ; i++) {
 +    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 +    //printf("pas trouve %d %d\n",pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]]);
@@ -25127,11 +25095,10 @@
 +    pt2->bdryinfo[i] = MMG_edgePut(&hed,pt2->v[MMG_iare[i][0]],pt2->v[MMG_iare[i][1]],1);
 +    assert(pt2->bdryinfo[i]!=1);
 +  }
-+
+ 
    /* remove 3 old tetra */
    for (k=1; k<=3; k++)
-     MMG_delElt(mesh,list->tetra[k]/6);
-@@ -671,8 +671,7 @@
+@@ -671,8 +671,7 @@ int MMG_swap32(pMesh mesh,pSol sol,pList
    list->tetra[1] = jel;
    list->tetra[2] = kel;
    list->tetra[3] = 0;
@@ -25142,11 +25109,11 @@
    return(2);
  }
 -
-Index: contrib/mmg3d/build/sources/swap44.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap44.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swap44.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swap44.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swap44.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap44.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -25181,7 +25148,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -25192,7 +25158,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,21 +41,21 @@
+@@ -41,21 +41,21 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -25219,7 +25185,7 @@
  
    /* face s1 s2 s3 */
    iel  = list->tetra[1] / 6;
-@@ -63,14 +63,14 @@
+@@ -63,14 +63,14 @@ int MMG_swap44_1(pMesh mesh,pSol sol,pLi
    base = mesh->mark;
    pt   = &mesh->tetra[iel];
    ref  = pt->ref;
@@ -25237,7 +25203,7 @@
  
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
-@@ -85,7 +85,7 @@
+@@ -85,7 +85,7 @@ int MMG_swap44_1(pMesh mesh,pSol sol,pLi
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s4   = pt1->v[voy];
@@ -25246,7 +25212,7 @@
    /* create 4 new tetra */
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -96,7 +96,7 @@
+@@ -96,7 +96,7 @@ int MMG_swap44_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -25255,7 +25221,7 @@
    /* 2nd elt */
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
-@@ -136,36 +136,36 @@
+@@ -136,45 +136,45 @@ int MMG_swap44_1(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -25299,7 +25265,6 @@
    for(k=2 ; k<=4 ; k++) {
      old  = list->tetra[k] / 6;
      iadr = (old-1)*4 + 1;
-@@ -172,9 +172,9 @@
      adja = &mesh->adja[iadr];
  
      pt0 = &mesh->tetra[old];
@@ -25312,7 +25277,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -183,64 +183,64 @@
+@@ -183,145 +183,145 @@ int MMG_swap44_1(pMesh mesh,pSol sol,pLi
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
@@ -25402,7 +25367,6 @@
        }
      } else {
        iadr = (lel-1)*4 + 1;
-@@ -247,81 +247,81 @@
        adja = &mesh->adja[iadr];
        adja[1] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[1] = ref_a;
@@ -25435,6 +25399,18 @@
      }
 -  
 +
++  }
++
++  /*bdryinfo*/
++  pt1 = &mesh->tetra[jel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[kel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
    }
 -  
 -	/*bdryinfo*/           
@@ -25459,7 +25435,291 @@
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 -	}
 -	
-+
++  pt1 = &mesh->tetra[lel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[mel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++
+   /* internal face */
+   iadr = (jel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+   adja[0] = kel*4 + 0;
+   adja[2] = lel*4 + 3;
+-  
++
+   iadr = (kel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+   adja[0] = jel*4 + 0;
+   adja[3] = mel*4 + 2;
+-  
++
+   iadr = (lel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+   adja[0] = mel*4 + 0;
+   adja[3] = jel*4 + 2;
+-  
++
+   iadr = (mel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+   adja[0] = lel*4 + 0;
+   adja[2] = kel*4 + 3;
+-  
++
+   /* remove 4 old tetra */
+   for (k=1; k<=4; k++)
+     MMG_delElt(mesh,list->tetra[k]/6);
+-    
++
+   list->tetra[1] = jel;
+   list->tetra[2] = kel;
+   list->tetra[3] = lel;
+   list->tetra[4] = mel;
+   list->tetra[5] = 0;
+-  
+-	M_free(hed.item);
++
++  M_free(hed.item);
+   return(4);
+ }
+ 
+@@ -329,14 +329,14 @@ int MMG_swap44_1(pMesh mesh,pSol sol,pLi
+ /* remove edge iar of iel */
+ int MMG_swap44_2(pMesh mesh,pSol sol,pList list) {
+   pTetra    pt,pt0,pt1;
+-	Hedge			hed;
++  Hedge                 hed;
+   int      *adja,i,k,jel,kel,lel,mel,adj,base,iadr,ia,ib,s1,s2,s3,s4;
+   int       old,iarold,kk,adj_a,adj_b,iel,iar,ref,ref_a,ref_b;
+   short     voy,voy_a,voy_b;
+ 
+   if ( !MMG_zaldy4(&hed,13) ) {
+-    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
+-  }   
++    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
++  }
+ 
+   /* face s1 s2 s3 */
+   iel  = list->tetra[1] / 6;
+@@ -344,15 +344,15 @@ int MMG_swap44_2(pMesh mesh,pSol sol,pLi
+   base = mesh->mark;
+   pt   = &mesh->tetra[iel];
+   ref  = pt->ref;
+-  
++
+   ia  = pt->v[ MMG_iare[iar][0] ];
+   ib  = pt->v[ MMG_iare[iar][1] ];
+   s1  = pt->v[ MMG_isar[iar][0] ];
+   s2  = pt->v[ MMG_isar[iar][1] ];
+-	for(i=0 ; i<6 ; i++) { 
+-		//printf("on insere %d %d -- %d\n",pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
+-		MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
+-	}
++  for(i=0 ; i<6 ; i++) {
++    //printf("on insere %d %d -- %d\n",pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
++    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
++  }
+ 
+   iadr = (iel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+@@ -367,7 +367,7 @@ int MMG_swap44_2(pMesh mesh,pSol sol,pLi
+   voy  = adja[k] % 4;
+   pt1  = &mesh->tetra[adj];
+   s4   = pt1->v[voy];
+- 
++
+   /* create 4 new tetra */
+   jel = MMG_newElt(mesh);
+   pt1 = &mesh->tetra[jel];
+@@ -410,7 +410,7 @@ int MMG_swap44_2(pMesh mesh,pSol sol,pLi
+   pt1->qual = list->qual[4];
+   pt1->flag = mesh->flag;
+   pt1->ref  = ref;
+- 
++
+   /* external faces*/
+   /*tetra iel*/
+   iadr = (iel-1)*4 + 1;
+@@ -418,18 +418,18 @@ int MMG_swap44_2(pMesh mesh,pSol sol,pLi
+   k    = MMG_iare[iar][1];
+   adj  = adja[k] / 4;
+   voy  = adja[k] % 4;
+-  
++
+   iadr = (jel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+   adja[3] = adj*4 + voy;
+   mesh->tetra[jel].bdryref[3] = pt->bdryref[k];
+-    
++
+   if (adj) {
+     iadr = (adj-1)*4 + 1;
+     adja = &mesh->adja[iadr];
+-    adja[voy] = jel*4 + 3;  
++    adja[voy] = jel*4 + 3;
+   }
+-  
++
+   iadr = (iel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
+   k    = MMG_iare[iar][0];
+@@ -440,28 +440,28 @@ int MMG_swap44_2(pMesh mesh,pSol sol,pLi
+   adja = &mesh->adja[iadr];
+   adja[2] = adj*4 + voy;
+   mesh->tetra[kel].bdryref[2] = pt->bdryref[k];
+-    
++
+   if (adj) {
+     iadr = (adj-1)*4 + 1;
+     adja = &mesh->adja[iadr];
+     adja[voy] = kel*4 + 2;
+   }
+-  
++
+   for(k=2 ; k<=4 ; k++) {
+     old  = list->tetra[k] / 6;
+     iadr = (old-1)*4 + 1;
+     adja = &mesh->adja[iadr];
+ 
+     pt0 = &mesh->tetra[old];
+-		for(i=0 ; i<6 ; i++) {
+-			//printf("2. on insere %d %d -- %d\n",pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
+-			MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
+-		}
++    for(i=0 ; i<6 ; i++) {
++      //printf("2. on insere %d %d -- %d\n",pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
++      MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
++    }
+     iarold = list->tetra[k] % 6;
+     kk    = MMG_iare[iarold][1];
+     if(pt0->v[kk]==ib) {
+       adj_a  = adja[kk] / 4;
+-      voy_a  = adja[kk] % 4; 
++      voy_a  = adja[kk] % 4;
+       ref_a  = pt0->bdryref[kk];
+       kk    = MMG_iare[iarold][0];
+       adj_b  = adja[kk] / 4;
+@@ -470,139 +470,139 @@ int MMG_swap44_2(pMesh mesh,pSol sol,pLi
+     } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
+       adj_b  = adja[kk] / 4;
+       voy_b  = adja[kk] % 4;
+-      ref_b  = pt0->bdryref[kk]; 
++      ref_b  = pt0->bdryref[kk];
+       kk    = MMG_iare[iarold][0];
+       adj_a  = adja[kk] / 4;
+       voy_a  = adja[kk] % 4;
+       ref_a  = pt0->bdryref[kk];
+-    } 
+-  
++    }
++
+     iadr = (iel-1)*4 + 1;
+     adja = &mesh->adja[iadr];
+-    if(old==(adja[MMG_isar[iar][0]]/4)) {  
++    if(old==(adja[MMG_isar[iar][0]]/4)) {
+       iadr = (lel-1)*4 + 1;
+       adja = &mesh->adja[iadr];
+       adja[3] = adj_a*4 + voy_a;
+       mesh->tetra[lel].bdryref[3]  = ref_a;
+-        
++
+       if (adj_a) {
+-        iadr = (adj_a-1)*4 + 1;
+-        adja = &mesh->adja[iadr];
+-        adja[voy_a] = lel*4 + 3; 
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = lel*4 + 3;
+       }
+-       
++
+       iadr = (mel-1)*4 + 1;
+       adja = &mesh->adja[iadr];
+       adja[2] = adj_b*4 + voy_b;
+       mesh->tetra[mel].bdryref[2]  = ref_b;
+-        
++
+       if (adj_b) {
+-        iadr = (adj_b-1)*4 + 1;
+-        adja = &mesh->adja[iadr];
+-        adja[voy_b] = mel*4 + 2; 
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = mel*4 + 2;
+       }
+-      
++
+     } else if(old==(adja[MMG_isar[iar][1]]/4)){
+       iadr = (jel-1)*4 + 1;
+       adja = &mesh->adja[iadr];
+       adja[2] = adj_a*4 + voy_a;
+       mesh->tetra[jel].bdryref[2]  = ref_a;
+-        
++
+       if (adj_a) {
+-        iadr = (adj_a-1)*4 + 1;
+-        adja = &mesh->adja[iadr];
+-        adja[voy_a] = jel*4 + 2; 
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = jel*4 + 2;
+       }
+-      
++
+       iadr = (kel-1)*4 + 1;
+       adja = &mesh->adja[iadr];
+       adja[3] = adj_b*4 + voy_b;
+       mesh->tetra[kel].bdryref[3]  = ref_b;
+-        
++
+       if (adj_b){
+-        iadr = (adj_b-1)*4 + 1;
+-        adja = &mesh->adja[iadr];
+-        adja[voy_b] = kel*4 + 3;
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = kel*4 + 3;
+       }
+     } else {
+       iadr = (lel-1)*4 + 1;
+       adja = &mesh->adja[iadr];
+       adja[1] = adj_a*4 + voy_a;
+       mesh->tetra[lel].bdryref[1]  = ref_a;
+-        
++
+       if (adj_a) {
+-        iadr = (adj_a-1)*4 + 1;
+-        adja = &mesh->adja[iadr];
+-        adja[voy_a] = lel*4 + 1; 
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = lel*4 + 1;
+       }
+-      
++
+       iadr = (mel-1)*4 + 1;
+       adja = &mesh->adja[iadr];
+       adja[1] = adj_b*4 + voy_b;
+       mesh->tetra[mel].bdryref[1]  = ref_b;
+-        
++
+       if (adj_b) {
+-        iadr = (adj_b-1)*4 + 1;
+-        adja = &mesh->adja[iadr];
+-        adja[voy_b] = mel*4 + 1;
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = mel*4 + 1;
+       }
+     }
+-  
++
++  }
 +  /*bdryinfo*/
 +  pt1 = &mesh->tetra[jel];
 +  for(i=0 ; i<6 ; i++) {
@@ -25480,283 +25740,6 @@
 +  for(i=0 ; i<6 ; i++) {
 +    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 +    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+
-   /* internal face */
-   iadr = (jel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-   adja[0] = kel*4 + 0;
-   adja[2] = lel*4 + 3;
--  
-+
-   iadr = (kel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-   adja[0] = jel*4 + 0;
-   adja[3] = mel*4 + 2;
--  
-+
-   iadr = (lel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-   adja[0] = mel*4 + 0;
-   adja[3] = jel*4 + 2;
--  
-+
-   iadr = (mel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-   adja[0] = lel*4 + 0;
-   adja[2] = kel*4 + 3;
--  
-+
-   /* remove 4 old tetra */
-   for (k=1; k<=4; k++)
-     MMG_delElt(mesh,list->tetra[k]/6);
--    
-+
-   list->tetra[1] = jel;
-   list->tetra[2] = kel;
-   list->tetra[3] = lel;
-   list->tetra[4] = mel;
-   list->tetra[5] = 0;
--  
--	M_free(hed.item);
-+
-+  M_free(hed.item);
-   return(4);
- }
- 
-@@ -329,14 +329,14 @@
- /* remove edge iar of iel */
- int MMG_swap44_2(pMesh mesh,pSol sol,pList list) {
-   pTetra    pt,pt0,pt1;
--	Hedge			hed;
-+  Hedge                 hed;
-   int      *adja,i,k,jel,kel,lel,mel,adj,base,iadr,ia,ib,s1,s2,s3,s4;
-   int       old,iarold,kk,adj_a,adj_b,iel,iar,ref,ref_a,ref_b;
-   short     voy,voy_a,voy_b;
- 
-   if ( !MMG_zaldy4(&hed,13) ) {
--    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
--  }   
-+    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
-+  }
- 
-   /* face s1 s2 s3 */
-   iel  = list->tetra[1] / 6;
-@@ -344,15 +344,15 @@
-   base = mesh->mark;
-   pt   = &mesh->tetra[iel];
-   ref  = pt->ref;
--  
-+
-   ia  = pt->v[ MMG_iare[iar][0] ];
-   ib  = pt->v[ MMG_iare[iar][1] ];
-   s1  = pt->v[ MMG_isar[iar][0] ];
-   s2  = pt->v[ MMG_isar[iar][1] ];
--	for(i=0 ; i<6 ; i++) { 
--		//printf("on insere %d %d -- %d\n",pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
--		MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
--	}
-+  for(i=0 ; i<6 ; i++) {
-+    //printf("on insere %d %d -- %d\n",pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
-+    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
-+  }
- 
-   iadr = (iel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-@@ -367,7 +367,7 @@
-   voy  = adja[k] % 4;
-   pt1  = &mesh->tetra[adj];
-   s4   = pt1->v[voy];
-- 
-+
-   /* create 4 new tetra */
-   jel = MMG_newElt(mesh);
-   pt1 = &mesh->tetra[jel];
-@@ -410,7 +410,7 @@
-   pt1->qual = list->qual[4];
-   pt1->flag = mesh->flag;
-   pt1->ref  = ref;
-- 
-+
-   /* external faces*/
-   /*tetra iel*/
-   iadr = (iel-1)*4 + 1;
-@@ -418,18 +418,18 @@
-   k    = MMG_iare[iar][1];
-   adj  = adja[k] / 4;
-   voy  = adja[k] % 4;
--  
-+
-   iadr = (jel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-   adja[3] = adj*4 + voy;
-   mesh->tetra[jel].bdryref[3] = pt->bdryref[k];
--    
-+
-   if (adj) {
-     iadr = (adj-1)*4 + 1;
-     adja = &mesh->adja[iadr];
--    adja[voy] = jel*4 + 3;  
-+    adja[voy] = jel*4 + 3;
-   }
--  
-+
-   iadr = (iel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
-   k    = MMG_iare[iar][0];
-@@ -440,13 +440,13 @@
-   adja = &mesh->adja[iadr];
-   adja[2] = adj*4 + voy;
-   mesh->tetra[kel].bdryref[2] = pt->bdryref[k];
--    
-+
-   if (adj) {
-     iadr = (adj-1)*4 + 1;
-     adja = &mesh->adja[iadr];
-     adja[voy] = kel*4 + 2;
-   }
--  
-+
-   for(k=2 ; k<=4 ; k++) {
-     old  = list->tetra[k] / 6;
-     iadr = (old-1)*4 + 1;
-@@ -453,15 +453,15 @@
-     adja = &mesh->adja[iadr];
- 
-     pt0 = &mesh->tetra[old];
--		for(i=0 ; i<6 ; i++) {
--			//printf("2. on insere %d %d -- %d\n",pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
--			MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
--		}
-+    for(i=0 ; i<6 ; i++) {
-+      //printf("2. on insere %d %d -- %d\n",pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
-+      MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
-+    }
-     iarold = list->tetra[k] % 6;
-     kk    = MMG_iare[iarold][1];
-     if(pt0->v[kk]==ib) {
-       adj_a  = adja[kk] / 4;
--      voy_a  = adja[kk] % 4; 
-+      voy_a  = adja[kk] % 4;
-       ref_a  = pt0->bdryref[kk];
-       kk    = MMG_iare[iarold][0];
-       adj_b  = adja[kk] / 4;
-@@ -470,59 +470,59 @@
-     } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
-       adj_b  = adja[kk] / 4;
-       voy_b  = adja[kk] % 4;
--      ref_b  = pt0->bdryref[kk]; 
-+      ref_b  = pt0->bdryref[kk];
-       kk    = MMG_iare[iarold][0];
-       adj_a  = adja[kk] / 4;
-       voy_a  = adja[kk] % 4;
-       ref_a  = pt0->bdryref[kk];
--    } 
--  
-+    }
-+
-     iadr = (iel-1)*4 + 1;
-     adja = &mesh->adja[iadr];
--    if(old==(adja[MMG_isar[iar][0]]/4)) {  
-+    if(old==(adja[MMG_isar[iar][0]]/4)) {
-       iadr = (lel-1)*4 + 1;
-       adja = &mesh->adja[iadr];
-       adja[3] = adj_a*4 + voy_a;
-       mesh->tetra[lel].bdryref[3]  = ref_a;
--        
-+
-       if (adj_a) {
--        iadr = (adj_a-1)*4 + 1;
--        adja = &mesh->adja[iadr];
--        adja[voy_a] = lel*4 + 3; 
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = lel*4 + 3;
-       }
--       
-+
-       iadr = (mel-1)*4 + 1;
-       adja = &mesh->adja[iadr];
-       adja[2] = adj_b*4 + voy_b;
-       mesh->tetra[mel].bdryref[2]  = ref_b;
--        
-+
-       if (adj_b) {
--        iadr = (adj_b-1)*4 + 1;
--        adja = &mesh->adja[iadr];
--        adja[voy_b] = mel*4 + 2; 
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = mel*4 + 2;
-       }
--      
-+
-     } else if(old==(adja[MMG_isar[iar][1]]/4)){
-       iadr = (jel-1)*4 + 1;
-       adja = &mesh->adja[iadr];
-       adja[2] = adj_a*4 + voy_a;
-       mesh->tetra[jel].bdryref[2]  = ref_a;
--        
-+
-       if (adj_a) {
--        iadr = (adj_a-1)*4 + 1;
--        adja = &mesh->adja[iadr];
--        adja[voy_a] = jel*4 + 2; 
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = jel*4 + 2;
-       }
--      
-+
-       iadr = (kel-1)*4 + 1;
-       adja = &mesh->adja[iadr];
-       adja[3] = adj_b*4 + voy_b;
-       mesh->tetra[kel].bdryref[3]  = ref_b;
--        
-+
-       if (adj_b){
--        iadr = (adj_b-1)*4 + 1;
--        adja = &mesh->adja[iadr];
--        adja[voy_b] = kel*4 + 3;
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = kel*4 + 3;
-       }
-     } else {
-       iadr = (lel-1)*4 + 1;
-@@ -529,80 +529,80 @@
-       adja = &mesh->adja[iadr];
-       adja[1] = adj_a*4 + voy_a;
-       mesh->tetra[lel].bdryref[1]  = ref_a;
--        
-+
-       if (adj_a) {
--        iadr = (adj_a-1)*4 + 1;
--        adja = &mesh->adja[iadr];
--        adja[voy_a] = lel*4 + 1; 
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = lel*4 + 1;
-       }
--      
-+
-       iadr = (mel-1)*4 + 1;
-       adja = &mesh->adja[iadr];
-       adja[1] = adj_b*4 + voy_b;
-       mesh->tetra[mel].bdryref[1]  = ref_b;
--        
-+
-       if (adj_b) {
--        iadr = (adj_b-1)*4 + 1;
--        adja = &mesh->adja[iadr];
--        adja[voy_b] = mel*4 + 1;
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = mel*4 + 1;
-       }
-     }
--  
-+
    }
 -  /*bdryinfo*/           
 -	pt1 = &mesh->tetra[jel];
@@ -25780,27 +25763,6 @@
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 -	}
 -	
-+  /*bdryinfo*/
-+  pt1 = &mesh->tetra[jel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[kel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[lel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[mel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
 +
    /* internal face */
    iadr = (jel-1)*4 + 1;
@@ -25845,11 +25807,11 @@
 +
    return(4);
  }
-Index: contrib/mmg3d/build/sources/swap56.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap56.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swap56.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swap56.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swap56.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap56.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -25884,7 +25846,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -25895,7 +25856,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,35 +41,35 @@
+@@ -41,35 +41,35 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -25942,7 +25903,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][0];
-@@ -81,20 +81,20 @@
+@@ -81,20 +81,20 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    iadr = (adj-1)*4 + 1;
    adja = &mesh->adja[iadr];
    if(pt1->v[MMG_idir[voy][0]]==s2) {
@@ -25968,7 +25929,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][1];
-@@ -102,7 +102,7 @@
+@@ -102,7 +102,7 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s5   = pt1->v[voy];
@@ -25977,7 +25938,7 @@
    /* create 6 new tetra */
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -113,7 +113,7 @@
+@@ -113,7 +113,7 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -25986,7 +25947,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -123,7 +123,7 @@
+@@ -123,7 +123,7 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[2];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -25995,7 +25956,7 @@
    lel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[lel];
    pt1->v[0] = ia;
-@@ -143,7 +143,7 @@
+@@ -143,7 +143,7 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[4];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -26004,7 +25965,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -153,7 +153,7 @@
+@@ -153,7 +153,7 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -26013,7 +25974,7 @@
    pel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[pel];
    pt1->v[0] = ib;
-@@ -161,9 +161,9 @@
+@@ -161,9 +161,9 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s5;
    pt1->v[3] = s4;
    pt1->qual = list->qual[6];
@@ -26025,7 +25986,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -171,24 +171,24 @@
+@@ -171,24 +171,24 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -26055,7 +26016,7 @@
    iadr = (kel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[2] = adj*4 + voy;
-@@ -199,22 +199,22 @@
+@@ -199,22 +199,22 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
      adja = &mesh->adja[iadr];
      adja[voy] = kel*4 + 2;
    }
@@ -26084,7 +26045,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -223,13 +223,13 @@
+@@ -223,13 +223,13 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
        voy_b  = adja[kk] % 4;
@@ -26101,7 +26062,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      if(old==(adja[MMG_isar[iar][0]]/4)) {
-@@ -237,48 +237,48 @@
+@@ -237,563 +237,180 @@ int MMG_swap56_1(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[1] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[1] = ref_a;
@@ -26171,7 +26132,6 @@
        iadr = (iel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        j    = MMG_isar[iar][0];
-@@ -285,132 +285,132 @@
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -26214,7 +26174,29 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = mel*4 + 1;
 -         }
--      } else {
++
++	iadr = (lel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_a*4 + voy_a;
++	mesh->tetra[lel].bdryref[1] = ref_a;
++
++	if (adj_a){
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = lel*4 + 1;
++	}
++
++	iadr = (mel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_b*4 + voy_b;
++	mesh->tetra[mel].bdryref[1] = ref_b;
++
++	if (adj_b) {
++	  iadr = (adj_b-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_b] = mel*4 + 1;
++	}
+       } else {
 -         iadr = (nel-1)*4 + 1;
 -         adja = &mesh->adja[iadr];
 -         adja[1] = adj_a*4 + voy_a;
@@ -26236,10 +26218,32 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = pel*4 + 1;
 -         }
--      }
--    }
--  
--  }
++	iadr = (nel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_a*4 + voy_a;
++	mesh->tetra[nel].bdryref[1] = ref_a;
++
++	if (adj_a) {
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = nel*4 + 1;
++	}
++
++	iadr = (pel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_b*4 + voy_b;
++	mesh->tetra[pel].bdryref[1] = ref_b;
++
++	if (adj_b) {
++	  iadr = (adj_b-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_b] = pel*4 + 1;
++	}
+       }
+     }
+-  
++
+   }
 -  
 -   /*internal faces*/
 -   iadr = (jel-1)*4 + 1;
@@ -26278,62 +26282,22 @@
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);   
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (lel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_a*4 + voy_a;
-+	mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	if (adj_a){
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = lel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[kel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (mel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_b*4 + voy_b;
-+	mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	if (adj_b) {
-+	  iadr = (adj_b-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = mel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[lel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+      } else {
-+	iadr = (nel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_a*4 + voy_a;
-+	mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	if (adj_a) {
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = nel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[mel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (pel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_b*4 + voy_b;
-+	mesh->tetra[pel].bdryref[1] = ref_b;
-+
-+	if (adj_b) {
-+	  iadr = (adj_b-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = pel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[nel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
@@ -26344,10 +26308,6 @@
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 -	}
-+      }
-+    }
- 
-+  }
  
 +  /*internal faces*/
 +  iadr = (jel-1)*4 + 1;
@@ -26358,29 +26318,159 @@
 +  adja = &mesh->adja[iadr];
 +  adja[0] = jel*4 + 0;
 +  adja[3] = mel*4 + 2;
-+
+ 
+-  /* remove 5 old tetra */
+-  for (k=1; k<=5; k++)
+-    MMG_delElt(mesh,list->tetra[k]/6);
 +  iadr = (lel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = mel*4 + 0;
 +  adja[3] = jel*4 + 2;
 +  adja[2] = nel*4 + 3;
-+
+ 
+-  list->tetra[1] = jel;
+-  list->tetra[2] = kel;
+-  list->tetra[3] = lel;
+-  list->tetra[4] = mel;
+-  list->tetra[5] = nel;
+-  list->tetra[6] = pel;
+-  list->tetra[7] = 0;
+-	M_free(hed.item);
+-  return(6);
+-}
 +  iadr = (mel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = lel*4 + 0;
 +  adja[2] = kel*4 + 3;
 +  adja[3] = pel*4 + 2;
-+
+ 
 +  iadr = (nel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = pel*4 + 0;
 +  adja[3] = lel*4 + 2;
-+
+ 
+-int MMG_swap56_2(pMesh mesh,pSol sol,pList list) {
+-   pTetra pt,pt1,pt0;
+-	 Hedge			hed;
+-   int i,ia,ib,s1,s2,s3,s4,s5;
+-   int jel,kel,lel,mel,nel,pel;
+-   int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
+-   short voy,voy_a,voy_b;
 +  iadr = (pel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = nel*4 + 0;
 +  adja[2] = mel*4 + 3;
-+
+ 
+-  if ( !MMG_zaldy4(&hed,17) ) {
+-    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
+-  }   
+-   
+-  iel = list->tetra[1] / 6;
+-  iar = list->tetra[1] % 6;
+-  pt  = &mesh->tetra[iel];
+-  ref = pt->ref;
+-  
+-  ia  = pt->v[ MMG_iare[iar][0] ];
+-  ib  = pt->v[ MMG_iare[iar][1] ];
+-  s1  = pt->v[ MMG_isar[iar][0] ];
+-  s2  = pt->v[ MMG_isar[iar][1] ]; 
+-	for(i=0 ; i<6 ; i++) { 
+-		MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
+-	}
+-  
+-   iadr = (iel-1)*4 + 1;
+-   adja = &mesh->adja[iadr];
+-   k    = MMG_isar[iar][0];
+-   adj  = adja[k] / 4;
+-   voy  = adja[k] % 4;
+-   pt1  = &mesh->tetra[adj];
+-   s3   = pt1->v[voy];
+-
+-   iadr = (adj-1)*4 + 1;
+-   adja = &mesh->adja[iadr];
+-   if(pt1->v[MMG_idir[voy][0]]==s2) {
+-      k = MMG_idir[voy][0];
+-   } else if(pt1->v[MMG_idir[voy][1]]==s2) {
+-      k = MMG_idir[voy][1];
+-   } else if(pt1->v[MMG_idir[voy][2]]==s2) {
+-      k = MMG_idir[voy][2];
+-   } else {
+-     puts("point non existant");
+-     exit(0);
+-   }   
+-   adj  = adja[k] / 4;
+-   voy  = adja[k] % 4;
+-   pt1  = &mesh->tetra[adj];
+-   s4   = pt1->v[voy];
+-  
+-   iadr = (iel-1)*4 + 1;
+-   adja = &mesh->adja[iadr];
+-   k    = MMG_isar[iar][1];
+-   adj  = adja[k] / 4;
+-   voy  = adja[k] % 4;
+-   pt1  = &mesh->tetra[adj];
+-   s5   = pt1->v[voy];
+-
+-   /* create 6 new tetra */
+-   jel = MMG_newElt(mesh);
+-   pt1 = &mesh->tetra[jel];
+-   pt1->v[0] = ia;
+-   pt1->v[1] = s1;
+-   pt1->v[2] = s2;
+-   pt1->v[3] = s5;
+-   pt1->qual = list->qual[1];
+-   pt1->flag = mesh->flag;
+-   pt1->ref  = ref;
+-  
+-   kel = MMG_newElt(mesh);
+-   pt1 = &mesh->tetra[kel];
+-   pt1->v[0] = ib;
+-   pt1->v[1] = s1;
+-   pt1->v[2] = s5;
+-   pt1->v[3] = s2;
+-   pt1->qual = list->qual[2];
+-   pt1->flag = mesh->flag;
+-   pt1->ref  = ref;
+-      
+-   lel = MMG_newElt(mesh);
+-   pt1 = &mesh->tetra[lel];
+-   pt1->v[0] = ia;
+-   pt1->v[1] = s2;
+-   pt1->v[2] = s3;
+-   pt1->v[3] = s4;
+-   pt1->qual = list->qual[3];
+-   pt1->flag = mesh->flag;
+-   pt1->ref  = ref;
+-
+-   mel = MMG_newElt(mesh);
+-   pt1 = &mesh->tetra[mel];
+-   pt1->v[0] = ib;
+-   pt1->v[1] = s2;
+-   pt1->v[2] = s4;
+-   pt1->v[3] = s3;
+-   pt1->qual = list->qual[4];
+-   pt1->flag = mesh->flag;
+-   pt1->ref  = ref;
+-
+-   nel = MMG_newElt(mesh);
+-   pt1 = &mesh->tetra[nel];
+-   pt1->v[0] = ia;
+-   pt1->v[1] = s2;
+-   pt1->v[2] = s4;
+-   pt1->v[3] = s5;
+-   pt1->qual = list->qual[5];
+-   pt1->flag = mesh->flag;
+-   pt1->ref  = ref;
+-
+-   pel = MMG_newElt(mesh);
+-   pt1 = &mesh->tetra[pel];
+-   pt1->v[0] = ib;
+-   pt1->v[1] = s2;
+-   pt1->v[2] = s5;
+-   pt1->v[3] = s4;
+-   pt1->qual = list->qual[6];
+-   pt1->flag = mesh->flag; 
+-   pt1->ref  = ref;
 +  /*bdryinfo*/
 +  pt1 = &mesh->tetra[jel];
 +  for(i=0 ; i<6 ; i++) {
@@ -26412,244 +26502,8 @@
 +    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 +    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 +  }
-+
-+
-   /* remove 5 old tetra */
-   for (k=1; k<=5; k++)
-     MMG_delElt(mesh,list->tetra[k]/6);
-@@ -422,378 +422,378 @@
-   list->tetra[5] = nel;
-   list->tetra[6] = pel;
-   list->tetra[7] = 0;
--	M_free(hed.item);
-+  M_free(hed.item);
-   return(6);
- }
- 
- 
- int MMG_swap56_2(pMesh mesh,pSol sol,pList list) {
--   pTetra pt,pt1,pt0;
--	 Hedge			hed;
--   int i,ia,ib,s1,s2,s3,s4,s5;
--   int jel,kel,lel,mel,nel,pel;
--   int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
--   short voy,voy_a,voy_b;
-+  pTetra pt,pt1,pt0;
-+  Hedge                 hed;
-+  int i,ia,ib,s1,s2,s3,s4,s5;
-+  int jel,kel,lel,mel,nel,pel;
-+  int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
-+  short voy,voy_a,voy_b;
- 
-   if ( !MMG_zaldy4(&hed,17) ) {
--    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
--  }   
--   
-+    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
-+  }
-+
-   iel = list->tetra[1] / 6;
-   iar = list->tetra[1] % 6;
-   pt  = &mesh->tetra[iel];
-   ref = pt->ref;
--  
-+
-   ia  = pt->v[ MMG_iare[iar][0] ];
-   ib  = pt->v[ MMG_iare[iar][1] ];
-   s1  = pt->v[ MMG_isar[iar][0] ];
--  s2  = pt->v[ MMG_isar[iar][1] ]; 
--	for(i=0 ; i<6 ; i++) { 
--		MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
--	}
--  
--   iadr = (iel-1)*4 + 1;
--   adja = &mesh->adja[iadr];
--   k    = MMG_isar[iar][0];
--   adj  = adja[k] / 4;
--   voy  = adja[k] % 4;
--   pt1  = &mesh->tetra[adj];
--   s3   = pt1->v[voy];
-+  s2  = pt->v[ MMG_isar[iar][1] ];
-+  for(i=0 ; i<6 ; i++) {
-+    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
-+  }
- 
--   iadr = (adj-1)*4 + 1;
--   adja = &mesh->adja[iadr];
--   if(pt1->v[MMG_idir[voy][0]]==s2) {
--      k = MMG_idir[voy][0];
--   } else if(pt1->v[MMG_idir[voy][1]]==s2) {
--      k = MMG_idir[voy][1];
--   } else if(pt1->v[MMG_idir[voy][2]]==s2) {
--      k = MMG_idir[voy][2];
--   } else {
--     puts("point non existant");
--     exit(0);
--   }   
--   adj  = adja[k] / 4;
--   voy  = adja[k] % 4;
--   pt1  = &mesh->tetra[adj];
--   s4   = pt1->v[voy];
--  
--   iadr = (iel-1)*4 + 1;
--   adja = &mesh->adja[iadr];
--   k    = MMG_isar[iar][1];
--   adj  = adja[k] / 4;
--   voy  = adja[k] % 4;
--   pt1  = &mesh->tetra[adj];
--   s5   = pt1->v[voy];
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_isar[iar][0];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s3   = pt1->v[voy];
- 
--   /* create 6 new tetra */
--   jel = MMG_newElt(mesh);
--   pt1 = &mesh->tetra[jel];
--   pt1->v[0] = ia;
--   pt1->v[1] = s1;
--   pt1->v[2] = s2;
--   pt1->v[3] = s5;
--   pt1->qual = list->qual[1];
--   pt1->flag = mesh->flag;
--   pt1->ref  = ref;
--  
--   kel = MMG_newElt(mesh);
--   pt1 = &mesh->tetra[kel];
--   pt1->v[0] = ib;
--   pt1->v[1] = s1;
--   pt1->v[2] = s5;
--   pt1->v[3] = s2;
--   pt1->qual = list->qual[2];
--   pt1->flag = mesh->flag;
--   pt1->ref  = ref;
--      
--   lel = MMG_newElt(mesh);
--   pt1 = &mesh->tetra[lel];
--   pt1->v[0] = ia;
--   pt1->v[1] = s2;
--   pt1->v[2] = s3;
--   pt1->v[3] = s4;
--   pt1->qual = list->qual[3];
--   pt1->flag = mesh->flag;
--   pt1->ref  = ref;
-+  iadr = (adj-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  if(pt1->v[MMG_idir[voy][0]]==s2) {
-+    k = MMG_idir[voy][0];
-+  } else if(pt1->v[MMG_idir[voy][1]]==s2) {
-+    k = MMG_idir[voy][1];
-+  } else if(pt1->v[MMG_idir[voy][2]]==s2) {
-+    k = MMG_idir[voy][2];
-+  } else {
-+    puts("point non existant");
-+    exit(0);
-+  }
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s4   = pt1->v[voy];
- 
--   mel = MMG_newElt(mesh);
--   pt1 = &mesh->tetra[mel];
--   pt1->v[0] = ib;
--   pt1->v[1] = s2;
--   pt1->v[2] = s4;
--   pt1->v[3] = s3;
--   pt1->qual = list->qual[4];
--   pt1->flag = mesh->flag;
--   pt1->ref  = ref;
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_isar[iar][1];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s5   = pt1->v[voy];
- 
--   nel = MMG_newElt(mesh);
--   pt1 = &mesh->tetra[nel];
--   pt1->v[0] = ia;
--   pt1->v[1] = s2;
--   pt1->v[2] = s4;
--   pt1->v[3] = s5;
--   pt1->qual = list->qual[5];
--   pt1->flag = mesh->flag;
--   pt1->ref  = ref;
-+  /* create 6 new tetra */
-+  jel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[jel];
-+  pt1->v[0] = ia;
-+  pt1->v[1] = s1;
-+  pt1->v[2] = s2;
-+  pt1->v[3] = s5;
-+  pt1->qual = list->qual[1];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
- 
--   pel = MMG_newElt(mesh);
--   pt1 = &mesh->tetra[pel];
--   pt1->v[0] = ib;
--   pt1->v[1] = s2;
--   pt1->v[2] = s5;
--   pt1->v[3] = s4;
--   pt1->qual = list->qual[6];
--   pt1->flag = mesh->flag; 
--   pt1->ref  = ref;
-+  kel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[kel];
-+  pt1->v[0] = ib;
-+  pt1->v[1] = s1;
-+  pt1->v[2] = s5;
-+  pt1->v[3] = s2;
-+  pt1->qual = list->qual[2];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
- 
-+  lel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[lel];
-+  pt1->v[0] = ia;
-+  pt1->v[1] = s2;
-+  pt1->v[2] = s3;
-+  pt1->v[3] = s4;
-+  pt1->qual = list->qual[3];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  mel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[mel];
-+  pt1->v[0] = ib;
-+  pt1->v[1] = s2;
-+  pt1->v[2] = s4;
-+  pt1->v[3] = s3;
-+  pt1->qual = list->qual[4];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  nel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[nel];
-+  pt1->v[0] = ia;
-+  pt1->v[1] = s2;
-+  pt1->v[2] = s4;
-+  pt1->v[3] = s5;
-+  pt1->qual = list->qual[5];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  pel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[pel];
-+  pt1->v[0] = ib;
-+  pt1->v[1] = s2;
-+  pt1->v[2] = s5;
-+  pt1->v[3] = s4;
-+  pt1->qual = list->qual[6];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-   /*external faces*/
+ 
+-  /*external faces*/
 -     /*tetra iel*/
 -   iadr = (iel-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
@@ -26690,13 +26544,7 @@
 -     old  = list->tetra[k] / 6;
 -     iadr = (old-1)*4 + 1;
 -     adja = &mesh->adja[iadr];
-+  /*tetra iel*/
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_iare[iar][1];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
- 
+-
 -     pt0 = &mesh->tetra[old];
 -		  for(i=0 ; i<6 ; i++) {
 -		  	MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
@@ -26769,11 +26617,7 @@
 -         adja[voy_b] = kel*4 + 3;
 -       }
 -     } else {
-+  iadr = (jel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[3] = adj*4 + voy;
-+  mesh->tetra[jel].bdryref[3] = pt->bdryref[k];
- 
+-
 -     /*old n'est pas un voisin de iel*/
 -       iadr = (iel-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
@@ -26782,126 +26626,13 @@
 -       voy  = adja[j] % 4;
 -       pt1  = &mesh->tetra[adj];
 -    
-+  if (adj) {
-+    iadr = (adj-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+    adja[voy] = jel*4 + 3;
-+  }
-+
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_iare[iar][0];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+
-+  iadr = (kel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[2] = adj*4 + voy;
-+  mesh->tetra[kel].bdryref[2] = pt->bdryref[k];
-+
-+  if (adj) {
-+    iadr = (adj-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+    adja[voy] = kel*4 + 2;
-+  }
-+
-+  for(k=2 ; k<=5 ; k++) {
-+
-+    old  = list->tetra[k] / 6;
-+    iadr = (old-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+
-+    pt0 = &mesh->tetra[old];
-+    for(i=0 ; i<6 ; i++) {
-+      MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
-+    }
-+    iarold = list->tetra[k] % 6;
-+    kk    = MMG_iare[iarold][1];
-+    if(pt0->v[kk]==ib) {
-+      adj_a  = adja[kk] / 4;
-+      voy_a  = adja[kk] % 4;
-+      ref_a  = pt0->bdryref[kk];
-+      kk    = MMG_iare[iarold][0];
-+      adj_b  = adja[kk] / 4;
-+      voy_b  = adja[kk] % 4;
-+      ref_b  = pt0->bdryref[kk];
-+    } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
-+      adj_b  = adja[kk] / 4;
-+      voy_b  = adja[kk] % 4;
-+      ref_b  = pt0->bdryref[kk];
-+      kk    = MMG_iare[iarold][0];
-+      adj_a  = adja[kk] / 4;
-+      voy_a  = adja[kk] % 4;
-+      ref_a  = pt0->bdryref[kk];
-+    }
-+
-+    iadr = (iel-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+    if(old==(adja[MMG_isar[iar][0]]/4)) {
-+      iadr = (lel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[3] = adj_a*4 + voy_a;
-+      mesh->tetra[lel].bdryref[3] = ref_a;
-+
-+      if (adj_a) {
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = lel*4 + 3;
-+      }
-+
-+      iadr = (mel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[2] = adj_b*4 + voy_b;
-+      mesh->tetra[mel].bdryref[2] = ref_b;
-+
-+      if (adj_b) {
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = mel*4 + 2;
-+      }
-+
-+    } else if(old==(adja[MMG_isar[iar][1]]/4)){
-+      iadr = (jel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[2] = adj_a*4 + voy_a;
-+      mesh->tetra[jel].bdryref[2] = ref_a;
-+
-+      if (adj_a) {
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = jel*4 + 2;
-+      }
-+
-+      iadr = (kel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[3] = adj_b*4 + voy_b;
-+      mesh->tetra[kel].bdryref[3] = ref_b;
-+
-+      if (adj_b) {
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = kel*4 + 3;
-+      }
-+    } else {
-+
-+      /*old n'est pas un voisin de iel*/
-+      iadr = (iel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      j    = MMG_isar[iar][0];
-+      adj  = adja[j] / 4;
-+      voy  = adja[j] % 4;
-+      pt1  = &mesh->tetra[adj];
-+
-       if(pt1->v[MMG_idir[voy][0]]==s2) {
+-      if(pt1->v[MMG_idir[voy][0]]==s2) {
 -          j = MMG_idir[voy][0];
-+	j = MMG_idir[voy][0];
-       } else if(pt1->v[MMG_idir[voy][1]]==s2) {
+-      } else if(pt1->v[MMG_idir[voy][1]]==s2) {
 -          j = MMG_idir[voy][1];
-+	j = MMG_idir[voy][1];
-       } else if(pt1->v[MMG_idir[voy][2]]==s2) {
+-      } else if(pt1->v[MMG_idir[voy][2]]==s2) {
 -          j = MMG_idir[voy][2];
-+	j = MMG_idir[voy][2];
-       }
+-      }
  
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
@@ -26960,10 +26691,7 @@
 -   adja = &mesh->adja[iadr];
 -   adja[0] = kel*4 + 0;
 -   adja[1] = nel*4 + 2;
-+      iadr = (adj-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      if(old==adja[j] / 4) {
- 
+-
 -   iadr = (kel-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
 -   adja[0] = jel*4 + 0;
@@ -26997,61 +26725,22 @@
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);   
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+	iadr = (lel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_a*4 + voy_a;
-+	mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	if (adj_a) {
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = lel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[kel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (mel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_b*4 + voy_b;
-+	mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	if (adj_b) {
-+	  iadr = (adj_b-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = mel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[lel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+      } else {
-+	iadr = (nel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_a*4 + voy_a;
-+	mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	if (adj_a) {
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = nel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[mel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (pel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_b*4 + voy_b;
-+	mesh->tetra[pel].bdryref[1] = ref_b;
-+
-+	if (adj_b) {
-+	  iadr = (adj_b-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = pel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[nel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
@@ -27062,91 +26751,22 @@
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 -	}
-+      }
-+    }
-+
-+  }
-+
-+  /*internal faces*/
-+  iadr = (jel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = kel*4 + 0;
-+  adja[1] = nel*4 + 2;
-+
-+  iadr = (kel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = jel*4 + 0;
-+  adja[1] = pel*4 + 3;
-+
-+  iadr = (lel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = mel*4 + 0;
-+  adja[2] = nel*4 + 3;
-+
-+
-+  iadr = (mel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = lel*4 + 0;
-+  adja[3] = pel*4 + 2;
-+
-+  iadr = (nel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = pel*4 + 0;
-+  adja[2] = jel*4 + 1;
-+  adja[3] = lel*4 + 2;
-+
-+  iadr = (pel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = nel*4 + 0;
-+  adja[3] = kel*4 + 1;
-+  adja[2] = mel*4 + 3;
-+
-+  /*bdryinfo*/
-+  pt1 = &mesh->tetra[jel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[kel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[lel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[mel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[nel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[pel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
    /* remove 5 old tetra */
    for (k=1; k<=5; k++)
      MMG_delElt(mesh,list->tetra[k]/6);
-@@ -805,7 +805,7 @@
+@@ -805,23 +422,22 @@ int MMG_swap56_2(pMesh mesh,pSol sol,pLi
    list->tetra[5] = nel;
    list->tetra[6] = pel;
    list->tetra[7] = 0;
 -	M_free(hed.item);
+-
 +  M_free(hed.item);
- 
    return(6);
  }
-@@ -813,15 +813,15 @@
- 
- int MMG_swap56_3(pMesh mesh,pSol sol,pList list) {
+ 
+ 
+-int MMG_swap56_3(pMesh mesh,pSol sol,pList list) {
++int MMG_swap56_2(pMesh mesh,pSol sol,pList list) {
    pTetra pt,pt1,pt0;
 -	Hedge			hed;
 +  Hedge                 hed;
@@ -27164,7 +26784,7 @@
  
    iel = list->tetra[1] / 6;
    iar = list->tetra[1] % 6;
-@@ -831,11 +831,11 @@
+@@ -831,11 +447,11 @@ int MMG_swap56_3(pMesh mesh,pSol sol,pLi
    ia  = pt->v[ MMG_iare[iar][0] ];
    ib  = pt->v[ MMG_iare[iar][1] ];
    s1  = pt->v[ MMG_isar[iar][0] ];
@@ -27181,7 +26801,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][0];
-@@ -843,24 +843,24 @@
+@@ -843,24 +459,24 @@ int MMG_swap56_3(pMesh mesh,pSol sol,pLi
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s3   = pt1->v[voy];
@@ -27212,7 +26832,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][1];
-@@ -868,7 +868,7 @@
+@@ -868,68 +484,68 @@ int MMG_swap56_3(pMesh mesh,pSol sol,pLi
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s5   = pt1->v[voy];
@@ -27221,7 +26841,11 @@
    /* create 6 new tetra */
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -879,7 +879,7 @@
+   pt1->v[0] = ia;
+   pt1->v[1] = s1;
+   pt1->v[2] = s2;
+-  pt1->v[3] = s3;
++  pt1->v[3] = s5;
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -27230,7 +26854,10 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -889,7 +889,7 @@
+   pt1->v[1] = s1;
+-  pt1->v[2] = s3;
++  pt1->v[2] = s5;
+   pt1->v[3] = s2;
    pt1->qual = list->qual[2];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -27239,7 +26866,11 @@
    lel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[lel];
    pt1->v[0] = ia;
-@@ -899,7 +899,7 @@
+-  pt1->v[1] = s1;
++  pt1->v[1] = s2;
+   pt1->v[2] = s3;
+-  pt1->v[3] = s5;
++  pt1->v[3] = s4;
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -27248,7 +26879,11 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -909,7 +909,7 @@
+-  pt1->v[1] = s1;
+-  pt1->v[2] = s5;
++  pt1->v[1] = s2;
++  pt1->v[2] = s4;
+   pt1->v[3] = s3;
    pt1->qual = list->qual[4];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -27257,7 +26892,10 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -919,7 +919,7 @@
+-  pt1->v[1] = s3;
++  pt1->v[1] = s2;
+   pt1->v[2] = s4;
+   pt1->v[3] = s5;
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -27266,7 +26904,8 @@
    pel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[pel];
    pt1->v[0] = ib;
-@@ -927,9 +927,9 @@
+-  pt1->v[1] = s3;
++  pt1->v[1] = s2;
    pt1->v[2] = s5;
    pt1->v[3] = s4;
    pt1->qual = list->qual[6];
@@ -27278,7 +26917,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -937,44 +937,44 @@
+@@ -937,44 +553,45 @@ int MMG_swap56_3(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -27320,6 +26959,7 @@
 -  
 +
    for(k=2 ; k<=5 ; k++) {
++
      old  = list->tetra[k] / 6;
      iadr = (old-1)*4 + 1;
      adja = &mesh->adja[iadr];
@@ -27335,7 +26975,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -988,13 +988,13 @@
+@@ -988,577 +605,195 @@ int MMG_swap56_3(pMesh mesh,pSol sol,pLi
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
        voy_b  = adja[kk] % 4;
@@ -27352,27 +26992,34 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      if(old==(adja[MMG_isar[iar][0]]/4)) {
-@@ -1002,49 +1002,49 @@
+-      iadr = (jel-1)*4 + 1;
++      iadr = (lel-1)*4 + 1;
        adja = &mesh->adja[iadr];
-       adja[1] = adj_a*4 + voy_a;
-       mesh->tetra[jel].bdryref[1] = ref_a;
+-      adja[1] = adj_a*4 + voy_a;
+-      mesh->tetra[jel].bdryref[1] = ref_a;
 -      
-+
-       if (adj_a){
+-      if (adj_a){
 -        iadr = (adj_a-1)*4 + 1;
 -        adja = &mesh->adja[iadr];
 -        adja[voy_a] = jel*4 + 1; 
++      adja[3] = adj_a*4 + voy_a;
++      mesh->tetra[lel].bdryref[3] = ref_a;
++
++      if (adj_a) {
 +	iadr = (adj_a-1)*4 + 1;
 +	adja = &mesh->adja[iadr];
-+	adja[voy_a] = jel*4 + 1;
++	adja[voy_a] = lel*4 + 3;
        }
 -     
-+
-       iadr = (kel-1)*4 + 1;
+-      iadr = (kel-1)*4 + 1;
++
++      iadr = (mel-1)*4 + 1;
        adja = &mesh->adja[iadr];
-       adja[1] = adj_b*4 + voy_b;
-       mesh->tetra[kel].bdryref[1] = ref_b;
+-      adja[1] = adj_b*4 + voy_b;
+-      mesh->tetra[kel].bdryref[1] = ref_b;
 -      
++      adja[2] = adj_b*4 + voy_b;
++      mesh->tetra[mel].bdryref[2] = ref_b;
 +
        if (adj_b) {
 -        iadr = (adj_b-1)*4 + 1;
@@ -27380,16 +27027,18 @@
 -        adja[voy_b] = kel*4 + 1; 
 +	iadr = (adj_b-1)*4 + 1;
 +	adja = &mesh->adja[iadr];
-+	adja[voy_b] = kel*4 + 1;
++	adja[voy_b] = mel*4 + 2;
        }
 -     
 +
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
-       iadr = (lel-1)*4 + 1;
+-      iadr = (lel-1)*4 + 1;
++      iadr = (jel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
-       mesh->tetra[lel].bdryref[2] = ref_a;
+-      mesh->tetra[lel].bdryref[2] = ref_a;
 -      
++      mesh->tetra[jel].bdryref[2] = ref_a;
 +
        if (adj_a) {
 -        iadr = (adj_a-1)*4 + 1;
@@ -27397,15 +27046,17 @@
 -        adja[voy_a] = lel*4 + 2; 
 +	iadr = (adj_a-1)*4 + 1;
 +	adja = &mesh->adja[iadr];
-+	adja[voy_a] = lel*4 + 2;
++	adja[voy_a] = jel*4 + 2;
        }
 -     
-+
-       iadr = (mel-1)*4 + 1;
+-      iadr = (mel-1)*4 + 1;
++
++      iadr = (kel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        adja[3] = adj_b*4 + voy_b;
-       mesh->tetra[mel].bdryref[3] = ref_b;
+-      mesh->tetra[mel].bdryref[3] = ref_b;
 -      
++      mesh->tetra[kel].bdryref[3] = ref_b;
 +
        if (adj_b) {
 -        iadr = (adj_b-1)*4 + 1;
@@ -27413,7 +27064,7 @@
 -        adja[voy_b] = mel*4 + 3; 
 +	iadr = (adj_b-1)*4 + 1;
 +	adja = &mesh->adja[iadr];
-+	adja[voy_b] = mel*4 + 3;
++	adja[voy_b] = kel*4 + 3;
        }
      } else {
 -  
@@ -27423,7 +27074,6 @@
        iadr = (iel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        j    = MMG_isar[iar][0];
-@@ -1051,132 +1051,132 @@
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -27502,7 +27152,7 @@
 -   adja = &mesh->adja[iadr];
 -   adja[0] = kel*4 + 0;
 -   adja[2] = lel*4 + 3;
- 
+-
 -   iadr = (kel-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
 -   adja[0] = jel*4 + 0;
@@ -27529,37 +27179,55 @@
 -   adja = &mesh->adja[iadr];
 -   adja[0] = nel*4 + 0;
 -   adja[3] = mel*4 + 1;
-+	iadr = (nel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[3] = adj_a*4 + voy_a;
-+	mesh->tetra[nel].bdryref[3] = ref_a;
- 
+-
 -  /*bdryinfo*/           
 -	pt1 = &mesh->tetra[jel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);   
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+	if (adj_a) {
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = nel*4 + 3;
- 	}
+-	}
 -	pt1 = &mesh->tetra[kel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (pel-1)*4 + 1;
+-	}
+-	pt1 = &mesh->tetra[lel];
+-	for(i=0 ; i<6 ; i++) { 
+-		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
+-		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
+-	}
+-	pt1 = &mesh->tetra[mel];
+-	for(i=0 ; i<6 ; i++) { 
+-		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
+-		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
+-	}
+-	pt1 = &mesh->tetra[nel];
+-	for(i=0 ; i<6 ; i++) { 
+-		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
+-		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++
++	iadr = (lel-1)*4 + 1;
 +	adja = &mesh->adja[iadr];
-+	adja[2] = adj_b*4 + voy_b;
-+	mesh->tetra[pel].bdryref[2] = ref_b;
++	adja[1] = adj_a*4 + voy_a;
++	mesh->tetra[lel].bdryref[1] = ref_a;
++
++	if (adj_a) {
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = lel*4 + 1;
++	}
++
++	iadr = (mel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_b*4 + voy_b;
++	mesh->tetra[mel].bdryref[1] = ref_b;
 +
 +	if (adj_b) {
 +	  iadr = (adj_b-1)*4 + 1;
 +	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = pel*4 + 2;
++	  adja[voy_b] = mel*4 + 1;
  	}
--	pt1 = &mesh->tetra[lel];
+-	pt1 = &mesh->tetra[pel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
@@ -27573,11 +27241,7 @@
 +	  iadr = (adj_a-1)*4 + 1;
 +	  adja = &mesh->adja[iadr];
 +	  adja[voy_a] = nel*4 + 1;
- 	}
--	pt1 = &mesh->tetra[mel];
--	for(i=0 ; i<6 ; i++) { 
--		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
--		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++	}
 +
 +	iadr = (pel-1)*4 + 1;
 +	adja = &mesh->adja[iadr];
@@ -27589,126 +27253,55 @@
 +	  adja = &mesh->adja[iadr];
 +	  adja[voy_b] = pel*4 + 1;
  	}
--	pt1 = &mesh->tetra[nel];
--	for(i=0 ; i<6 ; i++) { 
--		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
--		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
--	}
--	pt1 = &mesh->tetra[pel];
--	for(i=0 ; i<6 ; i++) { 
--		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
--		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
--	}
--  
+-  
+-  /* remove 5 old tetra */
+-  for (k=1; k<=5; k++)
+-    MMG_delElt(mesh,list->tetra[k]/6);
 +      }
 +    }
-+
+ 
+-  list->tetra[1] = jel;
+-  list->tetra[2] = kel;
+-  list->tetra[3] = lel;
+-  list->tetra[4] = mel;
+-  list->tetra[5] = nel;
+-  list->tetra[6] = pel;
+-  list->tetra[7] = 0;
+- 	M_free(hed.item);
 +  }
-+
+ 
+-  return(6);
+-}
 +  /*internal faces*/
 +  iadr = (jel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = kel*4 + 0;
-+  adja[2] = lel*4 + 3;
-+
++  adja[1] = nel*4 + 2;
+ 
 +  iadr = (kel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = jel*4 + 0;
-+  adja[3] = mel*4 + 2;
-+
-+  iadr = (lel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = mel*4 + 0;
-+  adja[3] = jel*4 + 2;
-+  adja[1] = nel*4 + 2;
-+
-+  iadr = (mel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = lel*4 + 0;
-+  adja[2] = kel*4 + 3;
 +  adja[1] = pel*4 + 3;
-+
-+  iadr = (nel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = pel*4 + 0;
-+  adja[2] = lel*4 + 1;
-+
-+  iadr = (pel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = nel*4 + 0;
-+  adja[3] = mel*4 + 1;
-+
-+  /*bdryinfo*/
-+  pt1 = &mesh->tetra[jel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[kel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[lel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[mel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[nel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[pel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+
-   /* remove 5 old tetra */
-   for (k=1; k<=5; k++)
-     MMG_delElt(mesh,list->tetra[k]/6);
-@@ -1188,7 +1188,7 @@
-   list->tetra[5] = nel;
-   list->tetra[6] = pel;
-   list->tetra[7] = 0;
-- 	M_free(hed.item);
-+  M_free(hed.item);
- 
-   return(6);
- }
-@@ -1195,370 +1195,370 @@
- 
- 
- int MMG_swap56_4(pMesh mesh,pSol sol,pList list) {
+ 
+-int MMG_swap56_4(pMesh mesh,pSol sol,pList list) {
 -   pTetra pt,pt1,pt0;
 - 	 Hedge			hed;
 -   int i,ia,ib,s1,s2,s3,s4,s5;
 -   int jel,kel,lel,mel,nel,pel;
 -   int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
 -   short voy,voy_a,voy_b;
-+  pTetra pt,pt1,pt0;
-+  Hedge                 hed;
-+  int i,ia,ib,s1,s2,s3,s4,s5;
-+  int jel,kel,lel,mel,nel,pel;
-+  int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
-+  short voy,voy_a,voy_b;
-   if ( !MMG_zaldy4(&hed,17) ) {
+-  if ( !MMG_zaldy4(&hed,17) ) {
 -    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
 -  }   
 -  
-+    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
-+  }
-+
-   iel = list->tetra[1] / 6;
-   iar = list->tetra[1] % 6;
-   pt  = &mesh->tetra[iel];
-   ref = pt->ref;
+-  iel = list->tetra[1] / 6;
+-  iar = list->tetra[1] % 6;
+-  pt  = &mesh->tetra[iel];
+-  ref = pt->ref;
++  iadr = (lel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = mel*4 + 0;
++  adja[2] = nel*4 + 3;
  
 -   ia  = pt->v[ MMG_iare[iar][0] ];
 -   ib  = pt->v[ MMG_iare[iar][1] ];
@@ -27725,14 +27318,7 @@
 -   voy  = adja[k] % 4;
 -   pt1  = &mesh->tetra[adj];
 -   s3   = pt1->v[voy];
-+  ia  = pt->v[ MMG_iare[iar][0] ];
-+  ib  = pt->v[ MMG_iare[iar][1] ];
-+  s1  = pt->v[ MMG_isar[iar][0] ];
-+  s2  = pt->v[ MMG_isar[iar][1] ];
-+  for(i=0 ; i<6 ; i++) {
-+    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
-+  }
- 
+-
 -   iadr = (adj-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
 -   if(pt1->v[MMG_idir[voy][0]]==s2) {
@@ -27757,14 +27343,7 @@
 -   voy  = adja[k] % 4;
 -   pt1  = &mesh->tetra[adj];
 -   s5   = pt1->v[voy];
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_isar[iar][0];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s3   = pt1->v[voy];
- 
+-
 -   /* create 6 new tetra */
 -   jel = MMG_newElt(mesh);
 -   pt1 = &mesh->tetra[jel];
@@ -27775,23 +27354,7 @@
 -   pt1->qual = list->qual[1];
 -   pt1->flag = mesh->flag;
 -   pt1->ref  = ref;
-+  iadr = (adj-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  if(pt1->v[MMG_idir[voy][0]]==s2) {
-+    k = MMG_idir[voy][0];
-+  } else if(pt1->v[MMG_idir[voy][1]]==s2) {
-+    k = MMG_idir[voy][1];
-+  } else if(pt1->v[MMG_idir[voy][2]]==s2) {
-+    k = MMG_idir[voy][2];
-+  } else {
-+    puts("point non existant");
-+    exit(0);
-+  }
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s4   = pt1->v[voy];
- 
+-
 -   kel = MMG_newElt(mesh);
 -   pt1 = &mesh->tetra[kel];
 -   pt1->v[0] = ib;
@@ -27841,76 +27404,8 @@
 -   pt1->qual = list->qual[6];
 -   pt1->flag = mesh->flag; 
 -   pt1->ref  = ref;
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_isar[iar][1];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s5   = pt1->v[voy];
- 
-+  /* create 6 new tetra */
-+  jel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[jel];
-+  pt1->v[0] = ia;
-+  pt1->v[1] = s1;
-+  pt1->v[2] = s4;
-+  pt1->v[3] = s5;
-+  pt1->qual = list->qual[1];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  kel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[kel];
-+  pt1->v[0] = ib;
-+  pt1->v[1] = s1;
-+  pt1->v[2] = s5;
-+  pt1->v[3] = s4;
-+  pt1->qual = list->qual[2];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  lel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[lel];
-+  pt1->v[0] = ia;
-+  pt1->v[1] = s2;
-+  pt1->v[2] = s3;
-+  pt1->v[3] = s4;
-+  pt1->qual = list->qual[3];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  mel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[mel];
-+  pt1->v[0] = ib;
-+  pt1->v[1] = s2;
-+  pt1->v[2] = s4;
-+  pt1->v[3] = s3;
-+  pt1->qual = list->qual[4];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  nel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[nel];
-+  pt1->v[0] = ia;
-+  pt1->v[1] = s1;
-+  pt1->v[2] = s2;
-+  pt1->v[3] = s4;
-+  pt1->qual = list->qual[5];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-+  pel = MMG_newElt(mesh);
-+  pt1 = &mesh->tetra[pel];
-+  pt1->v[0] = ib;
-+  pt1->v[1] = s1;
-+  pt1->v[2] = s4;
-+  pt1->v[3] = s2;
-+  pt1->qual = list->qual[6];
-+  pt1->flag = mesh->flag;
-+  pt1->ref  = ref;
-+
-   /*external faces*/
+ 
+-  /*external faces*/
 -     /*tetra iel*/
 -   iadr = (iel-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
@@ -27951,13 +27446,7 @@
 -     old  = list->tetra[k] / 6;
 -     iadr = (old-1)*4 + 1;
 -     adja = &mesh->adja[iadr];
-+  /*tetra iel*/
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_iare[iar][1];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
- 
+-
 -     pt0 = &mesh->tetra[old];
 -		  for(i=0 ; i<6 ; i++) {
 -		  	MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
@@ -28030,11 +27519,7 @@
 -         adja[voy_b] = kel*4 + 3; 
 -       }
 -     } else {
-+  iadr = (nel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[3] = adj*4 + voy;
-+  mesh->tetra[nel].bdryref[3] = pt->bdryref[k];
- 
+-
 -     /*old n'est pas un voisin de iel*/
 -       iadr = (iel-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
@@ -28043,126 +27528,17 @@
 -       voy  = adja[j] % 4;
 -       pt1  = &mesh->tetra[adj];
 -    
-+  if (adj) {
-+    iadr = (adj-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+    adja[voy] = nel*4 + 3;
-+  }
-+
-+  iadr = (iel-1)*4 + 1;
+-      if(pt1->v[MMG_idir[voy][0]]==s2) {
+-          j = MMG_idir[voy][0];
+-      } else if(pt1->v[MMG_idir[voy][1]]==s2) {
+-          j = MMG_idir[voy][1];
+-      } else if(pt1->v[MMG_idir[voy][2]]==s2) {
+-          j = MMG_idir[voy][2];
+-      }
++  iadr = (mel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
-+  k    = MMG_iare[iar][0];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+
-+  iadr = (pel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[2] = adj*4 + voy;
-+  mesh->tetra[pel].bdryref[2] = pt->bdryref[k];
-+
-+  if (adj) {
-+    iadr = (adj-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+    adja[voy] = pel*4 + 2;
-+  }
-+
-+  for(k=2 ; k<=5 ; k++) {
-+
-+    old  = list->tetra[k] / 6;
-+    iadr = (old-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+
-+    pt0 = &mesh->tetra[old];
-+    for(i=0 ; i<6 ; i++) {
-+      MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
-+    }
-+    iarold = list->tetra[k] % 6;
-+    kk    = MMG_iare[iarold][1];
-+    if(pt0->v[kk]==ib) {
-+      adj_a  = adja[kk] / 4;
-+      voy_a  = adja[kk] % 4;
-+      ref_a  = pt0->bdryref[kk];
-+      kk    = MMG_iare[iarold][0];
-+      adj_b  = adja[kk] / 4;
-+      voy_b  = adja[kk] % 4;
-+      ref_b  = pt0->bdryref[kk];
-+    } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
-+      adj_b  = adja[kk] / 4;
-+      voy_b  = adja[kk] % 4;
-+      ref_b  = pt0->bdryref[kk];
-+      kk    = MMG_iare[iarold][0];
-+      adj_a  = adja[kk] / 4;
-+      voy_a  = adja[kk] % 4;
-+      ref_a  = pt0->bdryref[kk];
-+    }
-+
-+    iadr = (iel-1)*4 + 1;
-+    adja = &mesh->adja[iadr];
-+    if(old==(adja[MMG_isar[iar][0]]/4)) {
-+      iadr = (lel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[3] = adj_a*4 + voy_a;
-+      mesh->tetra[lel].bdryref[3] = ref_a;
-+
-+      if (adj_a) {
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = lel*4 + 3;
-+      }
-+
-+      iadr = (mel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[2] = adj_b*4 + voy_b;
-+      mesh->tetra[mel].bdryref[2] = ref_b;
-+
-+      if (adj_b) {
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = mel*4 + 2;
-+      }
-+
-+    } else if(old==(adja[MMG_isar[iar][1]]/4)){
-+      iadr = (jel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[2] = adj_a*4 + voy_a;
-+      mesh->tetra[jel].bdryref[2] = ref_a;
-+
-+      if (adj_a) {
-+	iadr = (adj_a-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_a] = jel*4 + 2;
-+      }
-+
-+      iadr = (kel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      adja[3] = adj_b*4 + voy_b;
-+      mesh->tetra[kel].bdryref[3] = ref_b;
-+
-+      if (adj_b) {
-+	iadr = (adj_b-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[voy_b] = kel*4 + 3;
-+      }
-+    } else {
-+
-+      /*old n'est pas un voisin de iel*/
-+      iadr = (iel-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      j    = MMG_isar[iar][0];
-+      adj  = adja[j] / 4;
-+      voy  = adja[j] % 4;
-+      pt1  = &mesh->tetra[adj];
-+
-       if(pt1->v[MMG_idir[voy][0]]==s2) {
--          j = MMG_idir[voy][0];
-+	j = MMG_idir[voy][0];
-       } else if(pt1->v[MMG_idir[voy][1]]==s2) {
--          j = MMG_idir[voy][1];
-+	j = MMG_idir[voy][1];
-       } else if(pt1->v[MMG_idir[voy][2]]==s2) {
--          j = MMG_idir[voy][2];
-+	j = MMG_idir[voy][2];
-       }
++  adja[0] = lel*4 + 0;
++  adja[3] = pel*4 + 2;
  
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
@@ -28214,17 +27590,56 @@
 -       }
 -    }
 -  
--  }
++  iadr = (nel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = pel*4 + 0;
++  adja[2] = jel*4 + 1;
++  adja[3] = lel*4 + 2;
++
++  iadr = (pel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = nel*4 + 0;
++  adja[3] = kel*4 + 1;
++  adja[2] = mel*4 + 3;
++
++  /*bdryinfo*/
++  pt1 = &mesh->tetra[jel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[kel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[lel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[mel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[nel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[pel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
+   }
 -  
 -   /*internal faces*/
 -   iadr = (jel-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
 -   adja[0] = kel*4 + 0;
 -   adja[3] = nel*4 + 2;
-+      iadr = (adj-1)*4 + 1;
-+      adja = &mesh->adja[iadr];
-+      if(old==adja[j] / 4) {
- 
+-
 -   iadr = (kel-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
 -   adja[0] = jel*4 + 0;
@@ -28257,61 +27672,22 @@
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);   
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+	iadr = (lel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_a*4 + voy_a;
-+	mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	if (adj_a) {
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = lel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[kel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (mel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_b*4 + voy_b;
-+	mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	if (adj_b) {
-+	  iadr = (adj_b-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = mel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[lel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+      } else {
-+	iadr = (jel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_a*4 + voy_a;
-+	mesh->tetra[jel].bdryref[1] = ref_a;
-+
-+	if (adj_a) {
-+	  iadr = (adj_a-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_a] = jel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[mel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+
-+	iadr = (kel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	adja[1] = adj_b*4 + voy_b;
-+	mesh->tetra[kel].bdryref[1] = ref_b;
-+
-+	if (adj_b) {
-+	  iadr = (adj_b-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[voy_b] = kel*4 + 1;
- 	}
+-	}
 -	pt1 = &mesh->tetra[nel];
 -	for(i=0 ; i<6 ; i++) { 
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
@@ -28322,6 +27698,326 @@
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 -	}
+   /* remove 5 old tetra */
+   for (k=1; k<=5; k++)
+     MMG_delElt(mesh,list->tetra[k]/6);
+@@ -1570,182 +805,947 @@ int MMG_swap56_4(pMesh mesh,pSol sol,pLi
+   list->tetra[5] = nel;
+   list->tetra[6] = pel;
+   list->tetra[7] = 0;
+-  
+   M_free(hed.item);
+ 
+   return(6);
+ }
+ 
+ 
+-int MMG_swap56_5(pMesh mesh,pSol sol,pList list) {
+-   pTetra pt,pt1,pt0;
+-	 Hedge			hed;
+-   int i,ia,ib,s1,s2,s3,s4,s5;
+-   int jel,kel,lel,mel,nel,pel;
+-   int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
+-   short voy,voy_a,voy_b;
+-  if ( !MMG_zaldy4(&hed,17) ) {
+-    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
+-  }   
++int MMG_swap56_3(pMesh mesh,pSol sol,pList list) {
++  pTetra pt,pt1,pt0;
++  Hedge                 hed;
++  int i,ia,ib,s1,s2,s3,s4,s5;
++  int jel,kel,lel,mel,nel,pel;
++  int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
++  short voy,voy_a,voy_b;
++
++  if ( !MMG_zaldy4(&hed,17) ) {
++    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
++  }
++
++  iel = list->tetra[1] / 6;
++  iar = list->tetra[1] % 6;
++  pt  = &mesh->tetra[iel];
++  ref = pt->ref;
++
++  ia  = pt->v[ MMG_iare[iar][0] ];
++  ib  = pt->v[ MMG_iare[iar][1] ];
++  s1  = pt->v[ MMG_isar[iar][0] ];
++  s2  = pt->v[ MMG_isar[iar][1] ];
++  for(i=0 ; i<6 ; i++) {
++    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
++  }
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_isar[iar][0];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s3   = pt1->v[voy];
++
++  iadr = (adj-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  if(pt1->v[MMG_idir[voy][0]]==s2) {
++    k = MMG_idir[voy][0];
++  } else if(pt1->v[MMG_idir[voy][1]]==s2) {
++    k = MMG_idir[voy][1];
++  } else if(pt1->v[MMG_idir[voy][2]]==s2) {
++    k = MMG_idir[voy][2];
++  } else {
++    puts("point non existant");
++    exit(0);
++  }
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s4   = pt1->v[voy];
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_isar[iar][1];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s5   = pt1->v[voy];
++
++  /* create 6 new tetra */
++  jel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[jel];
++  pt1->v[0] = ia;
++  pt1->v[1] = s1;
++  pt1->v[2] = s2;
++  pt1->v[3] = s3;
++  pt1->qual = list->qual[1];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  kel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[kel];
++  pt1->v[0] = ib;
++  pt1->v[1] = s1;
++  pt1->v[2] = s3;
++  pt1->v[3] = s2;
++  pt1->qual = list->qual[2];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  lel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[lel];
++  pt1->v[0] = ia;
++  pt1->v[1] = s1;
++  pt1->v[2] = s3;
++  pt1->v[3] = s5;
++  pt1->qual = list->qual[3];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  mel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[mel];
++  pt1->v[0] = ib;
++  pt1->v[1] = s1;
++  pt1->v[2] = s5;
++  pt1->v[3] = s3;
++  pt1->qual = list->qual[4];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  nel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[nel];
++  pt1->v[0] = ia;
++  pt1->v[1] = s3;
++  pt1->v[2] = s4;
++  pt1->v[3] = s5;
++  pt1->qual = list->qual[5];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  pel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[pel];
++  pt1->v[0] = ib;
++  pt1->v[1] = s3;
++  pt1->v[2] = s5;
++  pt1->v[3] = s4;
++  pt1->qual = list->qual[6];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  /*external faces*/
++  /*tetra iel*/
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_iare[iar][1];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++
++  iadr = (jel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[3] = adj*4 + voy;
++  mesh->tetra[jel].bdryref[3] = pt->bdryref[k];
++
++  if (adj) {
++    iadr = (adj-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++    adja[voy] = jel*4 + 3;
++  }
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_iare[iar][0];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++
++  iadr = (kel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[2] = adj*4 + voy;
++  mesh->tetra[kel].bdryref[2] = pt->bdryref[k];
++
++  if (adj) {
++    iadr = (adj-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++    adja[voy] = kel*4 + 2;
++  }
++
++  for(k=2 ; k<=5 ; k++) {
++    old  = list->tetra[k] / 6;
++    iadr = (old-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++
++    pt0 = &mesh->tetra[old];
++    for(i=0 ; i<6 ; i++) {
++      MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
++    }
++    iarold = list->tetra[k] % 6;
++    kk    = MMG_iare[iarold][1];
++    if(pt0->v[kk]==ib) {
++      adj_a  = adja[kk] / 4;
++      voy_a  = adja[kk] % 4;
++      ref_a  = pt0->bdryref[kk];
++      kk    = MMG_iare[iarold][0];
++      adj_b  = adja[kk] / 4;
++      voy_b  = adja[kk] % 4;
++      ref_b  = pt0->bdryref[kk];
++    } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
++      adj_b  = adja[kk] / 4;
++      voy_b  = adja[kk] % 4;
++      ref_b  = pt0->bdryref[kk];
++      kk    = MMG_iare[iarold][0];
++      adj_a  = adja[kk] / 4;
++      voy_a  = adja[kk] % 4;
++      ref_a  = pt0->bdryref[kk];
++    }
++
++    iadr = (iel-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++    if(old==(adja[MMG_isar[iar][0]]/4)) {
++      iadr = (jel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[1] = adj_a*4 + voy_a;
++      mesh->tetra[jel].bdryref[1] = ref_a;
++
++      if (adj_a){
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = jel*4 + 1;
++      }
++
++      iadr = (kel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[1] = adj_b*4 + voy_b;
++      mesh->tetra[kel].bdryref[1] = ref_b;
++
++      if (adj_b) {
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = kel*4 + 1;
++      }
++
++    } else if(old==(adja[MMG_isar[iar][1]]/4)){
++      iadr = (lel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[2] = adj_a*4 + voy_a;
++      mesh->tetra[lel].bdryref[2] = ref_a;
++
++      if (adj_a) {
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = lel*4 + 2;
++      }
++
++      iadr = (mel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[3] = adj_b*4 + voy_b;
++      mesh->tetra[mel].bdryref[3] = ref_b;
++
++      if (adj_b) {
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = mel*4 + 3;
++      }
++    } else {
++
++      /*old n'est pas un voisin de iel*/
++      iadr = (iel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      j    = MMG_isar[iar][0];
++      adj  = adja[j] / 4;
++      voy  = adja[j] % 4;
++      pt1  = &mesh->tetra[adj];
++
++      if(pt1->v[MMG_idir[voy][0]]==s2) {
++	j = MMG_idir[voy][0];
++      } else if(pt1->v[MMG_idir[voy][1]]==s2) {
++	j = MMG_idir[voy][1];
++      } else if(pt1->v[MMG_idir[voy][2]]==s2) {
++	j = MMG_idir[voy][2];
++      }
++
++      iadr = (adj-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      if(old==adja[j] / 4) {
++
++	iadr = (nel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[3] = adj_a*4 + voy_a;
++	mesh->tetra[nel].bdryref[3] = ref_a;
++
++	if (adj_a) {
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = nel*4 + 3;
++	}
++
++	iadr = (pel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[2] = adj_b*4 + voy_b;
++	mesh->tetra[pel].bdryref[2] = ref_b;
++
++	if (adj_b) {
++	  iadr = (adj_b-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_b] = pel*4 + 2;
++	}
++      } else {
++	iadr = (nel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_a*4 + voy_a;
++	mesh->tetra[nel].bdryref[1] = ref_a;
++
++	if (adj_a) {
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = nel*4 + 1;
++	}
++
++	iadr = (pel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_b*4 + voy_b;
++	mesh->tetra[pel].bdryref[1] = ref_b;
++
++	if (adj_b) {
++	  iadr = (adj_b-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_b] = pel*4 + 1;
++	}
 +      }
 +    }
 +
@@ -28331,34 +28027,34 @@
 +  iadr = (jel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = kel*4 + 0;
-+  adja[3] = nel*4 + 2;
++  adja[2] = lel*4 + 3;
 +
 +  iadr = (kel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = jel*4 + 0;
-+  adja[2] = pel*4 + 3;
++  adja[3] = mel*4 + 2;
 +
 +  iadr = (lel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = mel*4 + 0;
-+  adja[2] = nel*4 + 1;
++  adja[3] = jel*4 + 2;
++  adja[1] = nel*4 + 2;
 +
 +  iadr = (mel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = lel*4 + 0;
-+  adja[3] = pel*4 + 1;
++  adja[2] = kel*4 + 3;
++  adja[1] = pel*4 + 3;
 +
 +  iadr = (nel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = pel*4 + 0;
-+  adja[2] = jel*4 + 3;
-+  adja[1] = lel*4 + 2;
++  adja[2] = lel*4 + 1;
 +
 +  iadr = (pel-1)*4 + 1;
 +  adja = &mesh->adja[iadr];
 +  adja[0] = nel*4 + 0;
-+  adja[3] = kel*4 + 2;
-+  adja[1] = mel*4 + 3;
++  adja[3] = mel*4 + 1;
 +
 +  /*bdryinfo*/
 +  pt1 = &mesh->tetra[jel];
@@ -28391,43 +28087,420 @@
 +    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 +    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 +  }
-   /* remove 5 old tetra */
-   for (k=1; k<=5; k++)
-     MMG_delElt(mesh,list->tetra[k]/6);
-@@ -1570,7 +1570,7 @@
-   list->tetra[5] = nel;
-   list->tetra[6] = pel;
-   list->tetra[7] = 0;
--  
-+
-   M_free(hed.item);
- 
-   return(6);
-@@ -1578,15 +1578,15 @@
- 
- 
- int MMG_swap56_5(pMesh mesh,pSol sol,pList list) {
--   pTetra pt,pt1,pt0;
--	 Hedge			hed;
--   int i,ia,ib,s1,s2,s3,s4,s5;
--   int jel,kel,lel,mel,nel,pel;
--   int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
--   short voy,voy_a,voy_b;
++
++  /* remove 5 old tetra */
++  for (k=1; k<=5; k++)
++    MMG_delElt(mesh,list->tetra[k]/6);
++
++  list->tetra[1] = jel;
++  list->tetra[2] = kel;
++  list->tetra[3] = lel;
++  list->tetra[4] = mel;
++  list->tetra[5] = nel;
++  list->tetra[6] = pel;
++  list->tetra[7] = 0;
++  M_free(hed.item);
++
++  return(6);
++}
++
++
++int MMG_swap56_4(pMesh mesh,pSol sol,pList list) {
 +  pTetra pt,pt1,pt0;
 +  Hedge                 hed;
 +  int i,ia,ib,s1,s2,s3,s4,s5;
 +  int jel,kel,lel,mel,nel,pel;
 +  int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
 +  short voy,voy_a,voy_b;
-   if ( !MMG_zaldy4(&hed,17) ) {
--    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n"); 
--  }   
++  if ( !MMG_zaldy4(&hed,17) ) {
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
 +  }
++
++  iel = list->tetra[1] / 6;
++  iar = list->tetra[1] % 6;
++  pt  = &mesh->tetra[iel];
++  ref = pt->ref;
++
++  ia  = pt->v[ MMG_iare[iar][0] ];
++  ib  = pt->v[ MMG_iare[iar][1] ];
++  s1  = pt->v[ MMG_isar[iar][0] ];
++  s2  = pt->v[ MMG_isar[iar][1] ];
++  for(i=0 ; i<6 ; i++) {
++    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
++  }
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_isar[iar][0];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s3   = pt1->v[voy];
++
++  iadr = (adj-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  if(pt1->v[MMG_idir[voy][0]]==s2) {
++    k = MMG_idir[voy][0];
++  } else if(pt1->v[MMG_idir[voy][1]]==s2) {
++    k = MMG_idir[voy][1];
++  } else if(pt1->v[MMG_idir[voy][2]]==s2) {
++    k = MMG_idir[voy][2];
++  } else {
++    puts("point non existant");
++    exit(0);
++  }
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s4   = pt1->v[voy];
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_isar[iar][1];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s5   = pt1->v[voy];
++
++  /* create 6 new tetra */
++  jel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[jel];
++  pt1->v[0] = ia;
++  pt1->v[1] = s1;
++  pt1->v[2] = s4;
++  pt1->v[3] = s5;
++  pt1->qual = list->qual[1];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  kel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[kel];
++  pt1->v[0] = ib;
++  pt1->v[1] = s1;
++  pt1->v[2] = s5;
++  pt1->v[3] = s4;
++  pt1->qual = list->qual[2];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  lel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[lel];
++  pt1->v[0] = ia;
++  pt1->v[1] = s2;
++  pt1->v[2] = s3;
++  pt1->v[3] = s4;
++  pt1->qual = list->qual[3];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  mel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[mel];
++  pt1->v[0] = ib;
++  pt1->v[1] = s2;
++  pt1->v[2] = s4;
++  pt1->v[3] = s3;
++  pt1->qual = list->qual[4];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  nel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[nel];
++  pt1->v[0] = ia;
++  pt1->v[1] = s1;
++  pt1->v[2] = s2;
++  pt1->v[3] = s4;
++  pt1->qual = list->qual[5];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  pel = MMG_newElt(mesh);
++  pt1 = &mesh->tetra[pel];
++  pt1->v[0] = ib;
++  pt1->v[1] = s1;
++  pt1->v[2] = s4;
++  pt1->v[3] = s2;
++  pt1->qual = list->qual[6];
++  pt1->flag = mesh->flag;
++  pt1->ref  = ref;
++
++  /*external faces*/
++  /*tetra iel*/
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_iare[iar][1];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++
++  iadr = (nel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[3] = adj*4 + voy;
++  mesh->tetra[nel].bdryref[3] = pt->bdryref[k];
++
++  if (adj) {
++    iadr = (adj-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++    adja[voy] = nel*4 + 3;
++  }
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_iare[iar][0];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++
++  iadr = (pel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[2] = adj*4 + voy;
++  mesh->tetra[pel].bdryref[2] = pt->bdryref[k];
++
++  if (adj) {
++    iadr = (adj-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++    adja[voy] = pel*4 + 2;
++  }
++
++  for(k=2 ; k<=5 ; k++) {
++
++    old  = list->tetra[k] / 6;
++    iadr = (old-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++
++    pt0 = &mesh->tetra[old];
++    for(i=0 ; i<6 ; i++) {
++      MMG_edgePut(&hed,pt0->v[MMG_iare[i][0]],pt0->v[MMG_iare[i][1]],pt0->bdryinfo[i]);
++    }
++    iarold = list->tetra[k] % 6;
++    kk    = MMG_iare[iarold][1];
++    if(pt0->v[kk]==ib) {
++      adj_a  = adja[kk] / 4;
++      voy_a  = adja[kk] % 4;
++      ref_a  = pt0->bdryref[kk];
++      kk    = MMG_iare[iarold][0];
++      adj_b  = adja[kk] / 4;
++      voy_b  = adja[kk] % 4;
++      ref_b  = pt0->bdryref[kk];
++    } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
++      adj_b  = adja[kk] / 4;
++      voy_b  = adja[kk] % 4;
++      ref_b  = pt0->bdryref[kk];
++      kk    = MMG_iare[iarold][0];
++      adj_a  = adja[kk] / 4;
++      voy_a  = adja[kk] % 4;
++      ref_a  = pt0->bdryref[kk];
++    }
++
++    iadr = (iel-1)*4 + 1;
++    adja = &mesh->adja[iadr];
++    if(old==(adja[MMG_isar[iar][0]]/4)) {
++      iadr = (lel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[3] = adj_a*4 + voy_a;
++      mesh->tetra[lel].bdryref[3] = ref_a;
++
++      if (adj_a) {
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = lel*4 + 3;
++      }
++
++      iadr = (mel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[2] = adj_b*4 + voy_b;
++      mesh->tetra[mel].bdryref[2] = ref_b;
++
++      if (adj_b) {
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = mel*4 + 2;
++      }
++
++    } else if(old==(adja[MMG_isar[iar][1]]/4)){
++      iadr = (jel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[2] = adj_a*4 + voy_a;
++      mesh->tetra[jel].bdryref[2] = ref_a;
++
++      if (adj_a) {
++	iadr = (adj_a-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_a] = jel*4 + 2;
++      }
++
++      iadr = (kel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      adja[3] = adj_b*4 + voy_b;
++      mesh->tetra[kel].bdryref[3] = ref_b;
++
++      if (adj_b) {
++	iadr = (adj_b-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[voy_b] = kel*4 + 3;
++      }
++    } else {
++
++      /*old n'est pas un voisin de iel*/
++      iadr = (iel-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      j    = MMG_isar[iar][0];
++      adj  = adja[j] / 4;
++      voy  = adja[j] % 4;
++      pt1  = &mesh->tetra[adj];
++
++      if(pt1->v[MMG_idir[voy][0]]==s2) {
++	j = MMG_idir[voy][0];
++      } else if(pt1->v[MMG_idir[voy][1]]==s2) {
++	j = MMG_idir[voy][1];
++      } else if(pt1->v[MMG_idir[voy][2]]==s2) {
++	j = MMG_idir[voy][2];
++      }
++
++      iadr = (adj-1)*4 + 1;
++      adja = &mesh->adja[iadr];
++      if(old==adja[j] / 4) {
++
++	iadr = (lel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_a*4 + voy_a;
++	mesh->tetra[lel].bdryref[1] = ref_a;
++
++	if (adj_a) {
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = lel*4 + 1;
++	}
++
++	iadr = (mel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_b*4 + voy_b;
++	mesh->tetra[mel].bdryref[1] = ref_b;
++
++	if (adj_b) {
++	  iadr = (adj_b-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_b] = mel*4 + 1;
++	}
++      } else {
++	iadr = (jel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_a*4 + voy_a;
++	mesh->tetra[jel].bdryref[1] = ref_a;
++
++	if (adj_a) {
++	  iadr = (adj_a-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_a] = jel*4 + 1;
++	}
++
++	iadr = (kel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	adja[1] = adj_b*4 + voy_b;
++	mesh->tetra[kel].bdryref[1] = ref_b;
++
++	if (adj_b) {
++	  iadr = (adj_b-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[voy_b] = kel*4 + 1;
++	}
++      }
++    }
++
++  }
++
++  /*internal faces*/
++  iadr = (jel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = kel*4 + 0;
++  adja[3] = nel*4 + 2;
++
++  iadr = (kel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = jel*4 + 0;
++  adja[2] = pel*4 + 3;
++
++  iadr = (lel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = mel*4 + 0;
++  adja[2] = nel*4 + 1;
++
++  iadr = (mel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = lel*4 + 0;
++  adja[3] = pel*4 + 1;
++
++  iadr = (nel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = pel*4 + 0;
++  adja[2] = jel*4 + 3;
++  adja[1] = lel*4 + 2;
++
++  iadr = (pel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = nel*4 + 0;
++  adja[3] = kel*4 + 2;
++  adja[1] = mel*4 + 3;
++
++  /*bdryinfo*/
++  pt1 = &mesh->tetra[jel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[kel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[lel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[mel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[nel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[pel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  /* remove 5 old tetra */
++  for (k=1; k<=5; k++)
++    MMG_delElt(mesh,list->tetra[k]/6);
++
++  list->tetra[1] = jel;
++  list->tetra[2] = kel;
++  list->tetra[3] = lel;
++  list->tetra[4] = mel;
++  list->tetra[5] = nel;
++  list->tetra[6] = pel;
++  list->tetra[7] = 0;
++
++  M_free(hed.item);
++
++  return(6);
++}
++
++
++int MMG_swap56_5(pMesh mesh,pSol sol,pList list) {
++  pTetra pt,pt1,pt0;
++  Hedge                 hed;
++  int i,ia,ib,s1,s2,s3,s4,s5;
++  int jel,kel,lel,mel,nel,pel;
++  int iadr,iarold,*adja,k,adj,old,kk,adj_a,adj_b,j,iel,iar,ref,ref_a,ref_b;
++  short voy,voy_a,voy_b;
++  if ( !MMG_zaldy4(&hed,17) ) {
++    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP442 IGNORED\n");
++  }
  
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
-@@ -1593,159 +1593,159 @@
    pt  = &mesh->tetra[iel];
    ref = pt->ref;
  
@@ -28446,14 +28519,7 @@
 -   voy  = adja[k] % 4;
 -   pt1  = &mesh->tetra[adj];
 -   s3   = pt1->v[voy];
-+  ia  = pt->v[ MMG_iare[iar][0] ];
-+  ib  = pt->v[ MMG_iare[iar][1] ];
-+  s1  = pt->v[ MMG_isar[iar][0] ];
-+  s2  = pt->v[ MMG_isar[iar][1] ];
-+  for(i=0 ; i<6 ; i++) {
-+    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
-+  }
- 
+-
 -   iadr = (adj-1)*4 + 1;
 -   adja = &mesh->adja[iadr];
 -   if(pt1->v[MMG_idir[voy][0]]==s2) {
@@ -28478,14 +28544,7 @@
 -   voy  = adja[k] % 4;
 -   pt1  = &mesh->tetra[adj];
 -   s5   = pt1->v[voy];
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  k    = MMG_isar[iar][0];
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s3   = pt1->v[voy];
- 
+-
 -   /* create 6 new tetra */
 -   jel = MMG_newElt(mesh);
 -   pt1 = &mesh->tetra[jel];
@@ -28526,23 +28585,7 @@
 -   pt1->qual = list->qual[4];
 -   pt1->flag = mesh->flag;
 -   pt1->ref  = ref;
-+  iadr = (adj-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  if(pt1->v[MMG_idir[voy][0]]==s2) {
-+    k = MMG_idir[voy][0];
-+  } else if(pt1->v[MMG_idir[voy][1]]==s2) {
-+    k = MMG_idir[voy][1];
-+  } else if(pt1->v[MMG_idir[voy][2]]==s2) {
-+    k = MMG_idir[voy][2];
-+  } else {
-+    puts("point non existant");
-+    exit(0);
-+  }
-+  adj  = adja[k] / 4;
-+  voy  = adja[k] % 4;
-+  pt1  = &mesh->tetra[adj];
-+  s4   = pt1->v[voy];
- 
+-
 -   nel = MMG_newElt(mesh);
 -   pt1 = &mesh->tetra[nel];
 -   pt1->v[0] = ia;
@@ -28565,8 +28608,41 @@
 -   
 -   /*external faces*/
 -     /*tetra iel*/
-   iadr = (iel-1)*4 + 1;
-   adja = &mesh->adja[iadr];
++  ia  = pt->v[ MMG_iare[iar][0] ];
++  ib  = pt->v[ MMG_iare[iar][1] ];
++  s1  = pt->v[ MMG_isar[iar][0] ];
++  s2  = pt->v[ MMG_isar[iar][1] ];
++  for(i=0 ; i<6 ; i++) {
++    MMG_edgePut(&hed,pt->v[MMG_iare[i][0]],pt->v[MMG_iare[i][1]],pt->bdryinfo[i]);
++  }
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  k    = MMG_isar[iar][0];
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s3   = pt1->v[voy];
++
++  iadr = (adj-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  if(pt1->v[MMG_idir[voy][0]]==s2) {
++    k = MMG_idir[voy][0];
++  } else if(pt1->v[MMG_idir[voy][1]]==s2) {
++    k = MMG_idir[voy][1];
++  } else if(pt1->v[MMG_idir[voy][2]]==s2) {
++    k = MMG_idir[voy][2];
++  } else {
++    puts("point non existant");
++    exit(0);
++  }
++  adj  = adja[k] / 4;
++  voy  = adja[k] % 4;
++  pt1  = &mesh->tetra[adj];
++  s4   = pt1->v[voy];
++
++  iadr = (iel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
 +  k    = MMG_isar[iar][1];
 +  adj  = adja[k] / 4;
 +  voy  = adja[k] % 4;
@@ -28636,8 +28712,8 @@
 +
 +  /*external faces*/
 +  /*tetra iel*/
-+  iadr = (iel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
+   iadr = (iel-1)*4 + 1;
+   adja = &mesh->adja[iadr];
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -28700,7 +28776,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -1753,13 +1753,13 @@
+@@ -1753,13 +1753,13 @@ int MMG_swap56_5(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -28716,7 +28792,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      if(old==(adja[MMG_isar[iar][0]]/4)) {
-@@ -1767,45 +1767,45 @@
+@@ -1767,45 +1767,45 @@ int MMG_swap56_5(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[3] = ref_a;
@@ -28781,7 +28857,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -1815,130 +1815,130 @@
+@@ -1815,130 +1815,130 @@ int MMG_swap56_5(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -28891,6 +28967,71 @@
      }
 -  
 +
++  }
++
++  /*internal faces*/
++  iadr = (jel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = kel*4 + 0;
++  adja[1] = lel*4 + 2;
++
++  iadr = (kel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = jel*4 + 0;
++  adja[1] = mel*4 + 3;
++
++  iadr = (lel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = mel*4 + 0;
++  adja[1] = nel*4 + 2;
++  adja[2] = jel*4 + 1;
++
++  iadr = (mel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = lel*4 + 0;
++  adja[1] = pel*4 + 3;
++  adja[3] = kel*4 + 1;
++
++  iadr = (nel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = pel*4 + 0;
++  adja[2] = lel*4 + 1;
++
++  iadr = (pel-1)*4 + 1;
++  adja = &mesh->adja[iadr];
++  adja[0] = nel*4 + 0;
++  adja[3] = mel*4 + 1;
++
++  /*bdryinfo*/
++  pt1 = &mesh->tetra[jel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[kel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[lel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[mel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[nel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
++  }
++  pt1 = &mesh->tetra[pel];
++  for(i=0 ; i<6 ; i++) {
++    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
++    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
    }
 -  
 -   /*internal faces*/
@@ -28957,75 +29098,10 @@
 -		pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
 -		if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
 -	}
-+
-+  /*internal faces*/
-+  iadr = (jel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = kel*4 + 0;
-+  adja[1] = lel*4 + 2;
-+
-+  iadr = (kel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = jel*4 + 0;
-+  adja[1] = mel*4 + 3;
-+
-+  iadr = (lel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = mel*4 + 0;
-+  adja[1] = nel*4 + 2;
-+  adja[2] = jel*4 + 1;
-+
-+  iadr = (mel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = lel*4 + 0;
-+  adja[1] = pel*4 + 3;
-+  adja[3] = kel*4 + 1;
-+
-+  iadr = (nel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = pel*4 + 0;
-+  adja[2] = lel*4 + 1;
-+
-+  iadr = (pel-1)*4 + 1;
-+  adja = &mesh->adja[iadr];
-+  adja[0] = nel*4 + 0;
-+  adja[3] = mel*4 + 1;
-+
-+  /*bdryinfo*/
-+  pt1 = &mesh->tetra[jel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[kel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[lel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[mel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[nel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
-+  pt1 = &mesh->tetra[pel];
-+  for(i=0 ; i<6 ; i++) {
-+    pt1->bdryinfo[i] = MMG_edgePut(&hed,pt1->v[MMG_iare[i][0]],pt1->v[MMG_iare[i][1]],1);
-+    if(pt1->bdryinfo[i]<2) pt1->bdryinfo[i]=0;
-+  }
    /* remove 5 old tetra */
    for (k=1; k<=5; k++)
      MMG_delElt(mesh,list->tetra[k]/6);
-@@ -1950,7 +1950,7 @@
+@@ -1950,7 +1950,7 @@ int MMG_swap56_5(pMesh mesh,pSol sol,pLi
    list->tetra[5] = nel;
    list->tetra[6] = pel;
    list->tetra[7] = 0;
@@ -29034,11 +29110,11 @@
  
    return(6);
  }
-Index: contrib/mmg3d/build/sources/swap68.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap68.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swap68.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swap68.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swap68.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap68.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -29073,7 +29149,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -29084,7 +29159,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,11 +41,11 @@
+@@ -41,11 +41,11 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -29098,7 +29173,7 @@
  static int MMG_findpolygone(pMesh mesh,int iel,int iar,int *s) {
    pTetra pt,pt1;
    int ia,ib;
-@@ -58,7 +58,7 @@
+@@ -58,27 +58,27 @@ static int MMG_findpolygone(pMesh mesh,i
    ia  = pt->v[ MMG_iare[iar][0] ];
    ib  = pt->v[ MMG_iare[iar][1] ];
    s1  = pt->v[ MMG_isar[iar][0] ];
@@ -29107,7 +29182,6 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][0];
-@@ -65,20 +65,20 @@
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
@@ -29133,7 +29207,7 @@
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
-@@ -86,20 +86,20 @@
+@@ -86,20 +86,20 @@ static int MMG_findpolygone(pMesh mesh,i
    iadr = (adj-1)*4 + 1;
    adja = &mesh->adja[iadr];
    if(pt1->v[MMG_idir[voy][0]]==s3) {
@@ -29160,7 +29234,7 @@
    iadr = (iel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    k    = MMG_isar[iar][1];
-@@ -107,7 +107,7 @@
+@@ -107,7 +107,7 @@ static int MMG_findpolygone(pMesh mesh,i
    voy  = adja[k] % 4;
    pt1  = &mesh->tetra[adj];
    s6   = pt1->v[voy];
@@ -29169,7 +29243,7 @@
    /*printf("polygone : %d %d %d %d %d %d\n",s1,s2,s3,s4,s5,s6);*/
    s[0]=s1;
    s[1]=s2;
-@@ -118,25 +118,25 @@
+@@ -118,44 +118,44 @@ static int MMG_findpolygone(pMesh mesh,i
    return(1);
  }
  
@@ -29211,7 +29285,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -143,19 +143,19 @@
    short   voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -29236,7 +29309,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -166,7 +166,7 @@
+@@ -166,7 +166,7 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29245,7 +29318,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -186,7 +186,7 @@
+@@ -186,7 +186,7 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29254,7 +29327,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -194,9 +194,9 @@
+@@ -194,9 +194,9 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[3];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -29266,7 +29339,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -206,7 +206,7 @@
+@@ -206,7 +206,7 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29275,7 +29348,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -214,7 +214,7 @@
+@@ -214,7 +214,7 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[6];
@@ -29284,7 +29357,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -226,7 +226,7 @@
+@@ -226,7 +226,7 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29293,7 +29366,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -234,9 +234,9 @@
+@@ -234,9 +234,9 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -29305,7 +29378,7 @@
    //printf("nx : %d %d %d %d %d %d %d %d\n",jel,kel,lel,mel,nel,oel,pel,qel);
    /*external faces*/
    /*tetra iel*/
-@@ -245,36 +245,36 @@
+@@ -245,36 +245,36 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -29350,7 +29423,7 @@
      old  = list->tetra[k] / 6;
      iadr = (old-1)*4 + 1;
      adja = &mesh->adja[iadr];
-@@ -284,7 +284,7 @@
+@@ -284,7 +284,7 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
        adj_a  = adja[kk] / 4;
@@ -29359,7 +29432,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -292,14 +292,14 @@
+@@ -292,14 +292,14 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -29377,7 +29450,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      if(old==(adja[MMG_isar[iar][0]]/4)) {
-@@ -307,48 +307,48 @@
+@@ -307,190 +307,190 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[1] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[1] = ref_a;
@@ -29446,7 +29519,6 @@
        iadr = (iel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        j    = MMG_isar[iar][0];
-@@ -355,142 +355,142 @@
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -29525,13 +29597,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       if(old == adja[j] / 4) {   
@@ -29556,63 +29622,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1; 
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -       iadr = (nel-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
@@ -29636,10 +29646,75 @@
 -         adja[voy_b] = oel*4 + 1; 
 -       }    
 -     }
-     }
+-    }
 -   }
 - }
 - 
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
    /*internal faces*/
@@ -29688,7 +29763,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -502,12 +502,12 @@
+@@ -502,12 +502,12 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    adja[2] = oel*4 + 3;
  
    /* remove 6 old tetra */
@@ -29707,7 +29782,7 @@
    }
  
    list->tetra[1] = jel;
-@@ -520,15 +520,15 @@
+@@ -520,35 +520,35 @@ int MMG_swap68_1(pMesh mesh,pSol sol,pLi
    list->tetra[8] = qel;
    list->tetra[9] = 0;
  
@@ -29727,7 +29802,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -535,8 +535,8 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -29738,7 +29812,6 @@
  
  
    /*find points of polygone*/
-@@ -543,12 +543,12 @@
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
    if(!MMG_findpolygone(mesh,iel,iar,s)) return(0);
@@ -29754,7 +29827,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -559,7 +559,7 @@
+@@ -559,7 +559,7 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29763,7 +29836,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -579,7 +579,7 @@
+@@ -579,7 +579,7 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29772,7 +29845,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -587,9 +587,9 @@
+@@ -587,9 +587,9 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[3];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -29784,7 +29857,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -599,7 +599,7 @@
+@@ -599,7 +599,7 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29793,7 +29866,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -607,7 +607,7 @@
+@@ -607,7 +607,7 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[6];
@@ -29802,7 +29875,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -619,7 +619,7 @@
+@@ -619,7 +619,7 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -29811,7 +29884,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -627,9 +627,9 @@
+@@ -627,9 +627,9 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -29823,7 +29896,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -637,36 +637,36 @@
+@@ -637,36 +637,36 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -29868,7 +29941,7 @@
      old  = list->tetra[k] / 6;
      iadr = (old-1)*4 + 1;
      adja = &mesh->adja[iadr];
-@@ -684,14 +684,14 @@
+@@ -684,14 +684,14 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -29886,7 +29959,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -700,24 +700,24 @@
+@@ -700,46 +700,46 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[1] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[1] = ref_a;
@@ -29921,7 +29994,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (nel-1)*4 + 1;
-@@ -724,22 +724,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[nel].bdryref[2] = ref_a;
@@ -29953,7 +30025,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -749,145 +749,145 @@
+@@ -749,145 +749,145 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -30033,13 +30105,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -30065,65 +30131,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[3] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[3] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 3;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[2] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[2] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 2;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -30148,11 +30156,78 @@
 -         adja[voy_b] = qel*4 + 2;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[3] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[3] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 3;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[2] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[2] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 2;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -30201,7 +30276,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -898,12 +898,12 @@
+@@ -898,12 +898,12 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    adja[0] = pel*4 + 0;
    adja[3] = oel*4 + 1;
    /* remove 6 old tetra */
@@ -30220,7 +30295,7 @@
    }
  
    list->tetra[1] = jel;
-@@ -915,38 +915,38 @@
+@@ -915,38 +915,38 @@ int MMG_swap68_2(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -30248,9 +30323,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP663 IGNORED\n");
 +  }
++
  
 -    
-+
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -30273,7 +30348,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -957,7 +957,7 @@
+@@ -957,7 +957,7 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30282,7 +30357,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -977,7 +977,7 @@
+@@ -977,7 +977,7 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30291,7 +30366,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -985,9 +985,9 @@
+@@ -985,9 +985,9 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -30303,7 +30378,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -997,7 +997,7 @@
+@@ -997,7 +997,7 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30312,7 +30387,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -1005,7 +1005,7 @@
+@@ -1005,7 +1005,7 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[6];
@@ -30321,7 +30396,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -1017,7 +1017,7 @@
+@@ -1017,7 +1017,7 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30330,7 +30405,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -1025,9 +1025,9 @@
+@@ -1025,9 +1025,9 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[8];
@@ -30342,7 +30417,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -1035,44 +1035,44 @@
+@@ -1035,44 +1035,44 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -30399,7 +30474,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -1085,14 +1085,14 @@
+@@ -1085,14 +1085,14 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -30417,7 +30492,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -1101,13 +1101,13 @@
+@@ -1101,22 +1101,22 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[1] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[1] = ref_a;
@@ -30436,7 +30511,6 @@
        iadr = (kel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        adja[1] = adj_b*4 + voy_b;
-@@ -1114,9 +1114,9 @@
        mesh->tetra[kel].bdryref[1] = ref_b;
  
        if (adj_b) {
@@ -30449,7 +30523,7 @@
        }
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
-@@ -1124,22 +1124,22 @@
+@@ -1124,22 +1124,22 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[2] = ref_a;
@@ -30481,7 +30555,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -1149,109 +1149,109 @@
+@@ -1149,145 +1149,145 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -30561,13 +30635,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -30593,65 +30661,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = oel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -30676,6 +30686,72 @@
 -         adja[voy_b] = qel*4 + 1;
 -       }     
 -     }
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++      }
      }
 -   }
 -  }  
@@ -30683,7 +30759,6 @@
  
    /*internal faces*/
    iadr = (jel-1)*4 + 1;
-@@ -1258,36 +1258,36 @@
    adja = &mesh->adja[iadr];
    adja[0] = kel*4 + 0;
    adja[2] = lel*4 + 3;
@@ -30728,7 +30803,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -1310,15 +1310,15 @@
+@@ -1310,38 +1310,38 @@ int MMG_swap68_3(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -30748,7 +30823,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -1325,23 +1325,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -30756,9 +30830,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP684 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -30781,7 +30855,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -1352,7 +1352,7 @@
+@@ -1352,7 +1352,7 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30790,7 +30864,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -1372,7 +1372,7 @@
+@@ -1372,7 +1372,7 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30799,7 +30873,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -1380,9 +1380,9 @@
+@@ -1380,9 +1380,9 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -30811,7 +30885,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -1392,7 +1392,7 @@
+@@ -1392,7 +1392,7 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30820,7 +30894,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -1400,7 +1400,7 @@
+@@ -1400,7 +1400,7 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[6];
@@ -30829,7 +30903,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -1412,7 +1412,7 @@
+@@ -1412,7 +1412,7 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -30838,7 +30912,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -1420,9 +1420,9 @@
+@@ -1420,9 +1420,9 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -30850,7 +30924,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -1430,44 +1430,44 @@
+@@ -1430,44 +1430,44 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -30907,7 +30981,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -1480,14 +1480,14 @@
+@@ -1480,14 +1480,14 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -30925,7 +30999,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -1496,24 +1496,24 @@
+@@ -1496,46 +1496,46 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[1] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[1] = ref_a;
@@ -30960,7 +31034,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (lel-1)*4 + 1;
-@@ -1520,22 +1520,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[2] = ref_a;
@@ -30992,7 +31065,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -1545,145 +1545,145 @@
+@@ -1545,145 +1545,145 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -31072,13 +31145,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -31104,65 +31171,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[3] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[3] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 3;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[2] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[2] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 2;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -31187,11 +31196,78 @@
 -         adja[voy_b] = qel*4 + 2;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[3] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[3] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 3;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[2] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[2] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 2;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -31240,7 +31316,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -1706,15 +1706,15 @@
+@@ -1706,38 +1706,38 @@ int MMG_swap68_4(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -31260,7 +31336,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -1721,23 +1721,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -31268,9 +31343,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP685 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -31293,7 +31368,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -1748,7 +1748,7 @@
+@@ -1748,7 +1748,7 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31302,7 +31377,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -1768,7 +1768,7 @@
+@@ -1768,7 +1768,7 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31311,7 +31386,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -1776,9 +1776,9 @@
+@@ -1776,9 +1776,9 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[3];
    pt1->v[3] = s[1];
    pt1->qual = list->qual[4];
@@ -31323,7 +31398,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -1788,7 +1788,7 @@
+@@ -1788,7 +1788,7 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31332,7 +31407,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -1796,7 +1796,7 @@
+@@ -1796,7 +1796,7 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[6];
@@ -31341,7 +31416,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -1808,7 +1808,7 @@
+@@ -1808,7 +1808,7 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31350,7 +31425,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -1816,9 +1816,9 @@
+@@ -1816,9 +1816,9 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -31362,7 +31437,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -1826,44 +1826,44 @@
+@@ -1826,44 +1826,44 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -31417,7 +31492,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -1876,14 +1876,14 @@
+@@ -1876,14 +1876,14 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -31435,7 +31510,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -1892,24 +1892,24 @@
+@@ -1892,46 +1892,46 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[3] = ref_a;
@@ -31471,7 +31546,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (nel-1)*4 + 1;
-@@ -1916,22 +1916,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[nel].bdryref[2] = ref_a;
@@ -31503,7 +31577,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -1941,145 +1941,145 @@
+@@ -1941,145 +1941,145 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -31583,13 +31657,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -31615,65 +31683,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[3] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[3] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 3;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[2] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[2] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 2;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -31698,11 +31708,78 @@
 -         adja[voy_b] = qel*4 + 2;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[3] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[3] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 3;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[2] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[2] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 2;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -31751,7 +31828,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -2102,15 +2102,15 @@
+@@ -2102,38 +2102,38 @@ int MMG_swap68_5(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -31771,7 +31848,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -2117,23 +2117,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -31779,9 +31855,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP686 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -31804,7 +31880,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -2144,7 +2144,7 @@
+@@ -2144,7 +2144,7 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31813,7 +31889,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -2164,7 +2164,7 @@
+@@ -2164,7 +2164,7 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31822,7 +31898,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -2172,9 +2172,9 @@
+@@ -2172,9 +2172,9 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[3];
    pt1->v[3] = s[1];
    pt1->qual = list->qual[4];
@@ -31834,7 +31910,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -2184,7 +2184,7 @@
+@@ -2184,7 +2184,7 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31843,7 +31919,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -2192,7 +2192,7 @@
+@@ -2192,7 +2192,7 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[6];
@@ -31852,7 +31928,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -2204,7 +2204,7 @@
+@@ -2204,7 +2204,7 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -31861,7 +31937,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -2212,9 +2212,9 @@
+@@ -2212,9 +2212,9 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -31873,7 +31949,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -2222,49 +2222,49 @@
+@@ -2222,49 +2222,49 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -31935,7 +32011,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -2272,14 +2272,14 @@
+@@ -2272,14 +2272,14 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -31953,7 +32029,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -2288,24 +2288,24 @@
+@@ -2288,46 +2288,46 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[3] = ref_a;
@@ -31988,7 +32064,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (pel-1)*4 + 1;
-@@ -2312,22 +2312,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[pel].bdryref[2] = ref_a;
@@ -32020,7 +32095,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -2337,145 +2337,145 @@
+@@ -2337,145 +2337,145 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -32100,13 +32175,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -32132,65 +32201,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1; 
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (nel-1)*4 + 1;
@@ -32215,10 +32226,77 @@
 -         adja[voy_b] = oel*4 + 1;
 -       }     
 -     }
-     }
+-    }
 -   }
 -  }  
 - 
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
    /*internal faces*/
@@ -32267,7 +32345,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -2498,15 +2498,15 @@
+@@ -2498,38 +2498,38 @@ int MMG_swap68_6(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -32287,7 +32365,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -2513,23 +2513,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -32295,9 +32372,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP687 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -32320,7 +32397,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -2540,7 +2540,7 @@
+@@ -2540,7 +2540,7 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32329,7 +32406,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -2560,7 +2560,7 @@
+@@ -2560,7 +2560,7 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32338,7 +32415,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -2568,9 +2568,9 @@
+@@ -2568,9 +2568,9 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[1];
    pt1->qual = list->qual[4];
@@ -32350,7 +32427,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -2580,7 +2580,7 @@
+@@ -2580,7 +2580,7 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32359,7 +32436,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -2588,7 +2588,7 @@
+@@ -2588,7 +2588,7 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[6];
@@ -32368,7 +32445,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -2600,7 +2600,7 @@
+@@ -2600,7 +2600,7 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32377,7 +32454,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -2608,9 +2608,9 @@
+@@ -2608,9 +2608,9 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[8];
@@ -32389,7 +32466,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -2618,44 +2618,44 @@
+@@ -2618,44 +2618,44 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -32445,7 +32522,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -2668,14 +2668,14 @@
+@@ -2668,14 +2668,14 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -32463,7 +32540,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -2683,47 +2683,47 @@
+@@ -2683,47 +2683,47 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
        iadr = (nel-1)*4 + 1;
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
@@ -32534,7 +32611,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -2733,145 +2733,145 @@
+@@ -2733,145 +2733,145 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -32614,13 +32691,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -32646,65 +32717,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = kel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (jel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[jel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = jel*4 + 1;
-+	  }
-+
-+	  iadr = (kel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[kel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = kel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -32729,11 +32742,78 @@
 -         adja[voy_b] = qel*4 + 1;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (jel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[jel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = jel*4 + 1;
++	  }
++
++	  iadr = (kel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[kel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = kel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -32782,7 +32862,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -2894,15 +2894,15 @@
+@@ -2894,38 +2894,38 @@ int MMG_swap68_7(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -32802,7 +32882,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -2909,23 +2909,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -32810,9 +32889,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP688 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -32835,7 +32914,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -2936,7 +2936,7 @@
+@@ -2936,7 +2936,7 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32844,7 +32923,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -2956,7 +2956,7 @@
+@@ -2956,7 +2956,7 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32853,7 +32932,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -2964,9 +2964,9 @@
+@@ -2964,9 +2964,9 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -32865,7 +32944,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -2976,7 +2976,7 @@
+@@ -2976,7 +2976,7 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32874,7 +32953,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -2984,7 +2984,7 @@
+@@ -2984,7 +2984,7 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[6];
@@ -32883,7 +32962,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -2996,7 +2996,7 @@
+@@ -2996,7 +2996,7 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -32892,7 +32971,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -3004,9 +3004,9 @@
+@@ -3004,9 +3004,9 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -32904,7 +32983,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -3014,44 +3014,44 @@
+@@ -3014,44 +3014,44 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -32962,7 +33041,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -3064,14 +3064,14 @@
+@@ -3064,14 +3064,14 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -32980,7 +33059,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -3080,24 +3080,24 @@
+@@ -3080,46 +3080,46 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[3] = ref_a;
@@ -33015,7 +33094,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (jel-1)*4 + 1;
-@@ -3104,22 +3104,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[2] = ref_a;
@@ -33047,7 +33125,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -3129,145 +3129,145 @@
+@@ -3129,145 +3129,145 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -33127,13 +33205,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -33159,65 +33231,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[3] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[3] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 3;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[2] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[2] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 2;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -33242,11 +33256,78 @@
 -         adja[voy_b] = qel*4 + 2;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[3] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[3] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 3;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[2] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[2] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 2;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -33295,7 +33376,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -3290,8 +3290,8 @@
+@@ -3290,38 +3290,38 @@ int MMG_swap68_8(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -33306,7 +33387,6 @@
  
    return(8);
  }
-@@ -3298,7 +3298,7 @@
  
  int MMG_swap68_9(pMesh mesh,pSol sol,pList list){
    pTetra pt1,pt,pt0;
@@ -33315,7 +33395,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -3305,23 +3305,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -33323,9 +33402,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP689 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -33348,7 +33427,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -3332,7 +3332,7 @@
+@@ -3332,7 +3332,7 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33357,7 +33436,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -3352,7 +3352,7 @@
+@@ -3352,7 +3352,7 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33366,7 +33445,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -3360,9 +3360,9 @@
+@@ -3360,9 +3360,9 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[4];
@@ -33378,7 +33457,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -3372,7 +3372,7 @@
+@@ -3372,7 +3372,7 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33387,7 +33466,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -3380,7 +3380,7 @@
+@@ -3380,7 +3380,7 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[6];
@@ -33396,7 +33475,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -3392,7 +3392,7 @@
+@@ -3392,7 +3392,7 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33405,7 +33484,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -3400,9 +3400,9 @@
+@@ -3400,9 +3400,9 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    pt1->v[2] = s[4];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[8];
@@ -33417,7 +33496,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -3410,44 +3410,44 @@
+@@ -3410,44 +3410,44 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -33473,7 +33552,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -3460,14 +3460,14 @@
+@@ -3460,62 +3460,62 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -33491,7 +33570,6 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -3474,26 +3474,26 @@
      if(old==(adja[MMG_isar[iar][0]]/4)) {
        iadr = (jel-1)*4 + 1;
        adja = &mesh->adja[iadr];
@@ -33529,7 +33607,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (nel-1)*4 + 1;
-@@ -3500,22 +3500,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[nel].bdryref[2] = ref_a;
@@ -33561,7 +33638,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -3525,142 +3525,142 @@
+@@ -3525,142 +3525,142 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -33641,13 +33718,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -33673,65 +33744,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = oel*4 + 1; 
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (lel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = lel*4 + 1;
-+	  }
-+
-+	  iadr = (mel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = mel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (lel-1)*4 + 1;
@@ -33756,11 +33769,78 @@
 -         adja[voy_b] = mel*4 + 1; 
 -       }    
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (lel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[lel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = lel*4 + 1;
++	  }
++
++	  iadr = (mel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[mel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = mel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -33804,7 +33884,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -3687,15 +3687,15 @@
+@@ -3687,38 +3687,38 @@ int MMG_swap68_9(pMesh mesh,pSol sol,pLi
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -33824,7 +33904,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -3702,23 +3702,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -33832,9 +33911,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP6810 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -33857,7 +33936,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -3729,7 +3729,7 @@
+@@ -3729,7 +3729,7 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33866,7 +33945,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -3749,7 +3749,7 @@
+@@ -3749,7 +3749,7 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33875,7 +33954,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -3757,9 +3757,9 @@
+@@ -3757,9 +3757,9 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[4];
@@ -33887,7 +33966,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -3769,7 +3769,7 @@
+@@ -3769,7 +3769,7 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33896,7 +33975,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -3777,7 +3777,7 @@
+@@ -3777,7 +3777,7 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[4];
    pt1->v[3] = s[1];
    pt1->qual = list->qual[6];
@@ -33905,7 +33984,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -3789,7 +3789,7 @@
+@@ -3789,7 +3789,7 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -33914,7 +33993,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -3797,9 +3797,9 @@
+@@ -3797,9 +3797,9 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[8];
@@ -33926,7 +34005,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -3807,49 +3807,49 @@
+@@ -3807,49 +3807,49 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -33989,7 +34068,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -3857,14 +3857,14 @@
+@@ -3857,14 +3857,14 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -34007,7 +34086,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -3873,24 +3873,24 @@
+@@ -3873,46 +3873,46 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[3] = ref_a;
@@ -34042,7 +34121,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (pel-1)*4 + 1;
-@@ -3897,22 +3897,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[pel].bdryref[2] = ref_a;
@@ -34074,7 +34152,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -3922,145 +3922,145 @@
+@@ -3922,145 +3922,145 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -34154,13 +34232,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -34186,65 +34258,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = qel*4 + 1; 
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (lel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = lel*4 + 1;
-+	  }
-+
-+	  iadr = (mel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = mel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (lel-1)*4 + 1;
@@ -34269,11 +34283,78 @@
 -         adja[voy_b] = mel*4 + 1; 
 -       }    
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (lel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[lel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = lel*4 + 1;
++	  }
++
++	  iadr = (mel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[mel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = mel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -34322,7 +34403,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -4083,15 +4083,15 @@
+@@ -4083,38 +4083,38 @@ int MMG_swap68_10(pMesh mesh,pSol sol,pL
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -34342,7 +34423,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -4098,23 +4098,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -34350,9 +34430,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP6811 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -34375,7 +34455,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -4125,7 +4125,7 @@
+@@ -4125,7 +4125,7 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34384,7 +34464,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -4145,7 +4145,7 @@
+@@ -4145,7 +4145,7 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34393,7 +34473,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -4153,9 +4153,9 @@
+@@ -4153,9 +4153,9 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[4];
@@ -34405,7 +34485,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -4165,7 +4165,7 @@
+@@ -4165,7 +4165,7 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34414,7 +34494,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -4173,7 +4173,7 @@
+@@ -4173,7 +4173,7 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[6];
@@ -34423,7 +34503,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -4185,7 +4185,7 @@
+@@ -4185,7 +4185,7 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34432,7 +34512,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -4193,9 +4193,9 @@
+@@ -4193,9 +4193,9 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[1];
    pt1->qual = list->qual[8];
@@ -34444,7 +34524,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -4203,44 +4203,44 @@
+@@ -4203,44 +4203,44 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -34501,7 +34581,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -4253,14 +4253,14 @@
+@@ -4253,62 +4253,62 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -34519,7 +34599,6 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -4267,48 +4267,48 @@
      if(old==(adja[MMG_isar[iar][0]]/4)) {
        iadr = (jel-1)*4 + 1;
        adja = &mesh->adja[iadr];
@@ -34592,7 +34671,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -4318,145 +4318,145 @@
+@@ -4318,145 +4318,145 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -34672,13 +34751,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -34704,65 +34777,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = oel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (lel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = lel*4 + 1;
-+	  }
-+
-+	  iadr = (mel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = mel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (lel-1)*4 + 1;
@@ -34787,11 +34802,78 @@
 -         adja[voy_b] = mel*4 + 1;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (lel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[lel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = lel*4 + 1;
++	  }
++
++	  iadr = (mel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[mel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = mel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -34840,7 +34922,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -4479,15 +4479,15 @@
+@@ -4479,38 +4479,38 @@ int MMG_swap68_11(pMesh mesh,pSol sol,pL
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -34860,7 +34942,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -4494,23 +4494,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -34868,9 +34949,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP6812 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -34893,7 +34974,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -4521,7 +4521,7 @@
+@@ -4521,7 +4521,7 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34902,7 +34983,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -4541,7 +4541,7 @@
+@@ -4541,7 +4541,7 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34911,7 +34992,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -4549,9 +4549,9 @@
+@@ -4549,9 +4549,9 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[4];
@@ -34923,7 +35004,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -4561,7 +4561,7 @@
+@@ -4561,7 +4561,7 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34932,7 +35013,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -4569,7 +4569,7 @@
+@@ -4569,7 +4569,7 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[4];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[6];
@@ -34941,7 +35022,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -4581,7 +4581,7 @@
+@@ -4581,7 +4581,7 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -34950,7 +35031,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -4589,9 +4589,9 @@
+@@ -4589,9 +4589,9 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[8];
@@ -34962,7 +35043,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -4599,44 +4599,44 @@
+@@ -4599,44 +4599,44 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -35021,7 +35102,7 @@
      iarold = list->tetra[k] % 6;
      kk    = MMG_iare[iarold][1];
      if(pt0->v[kk]==ib) {
-@@ -4649,14 +4649,14 @@
+@@ -4649,14 +4649,14 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -35039,7 +35120,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -4665,24 +4665,24 @@
+@@ -4665,46 +4665,46 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[nel].bdryref[3] = ref_a;
@@ -35074,7 +35155,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (jel-1)*4 + 1;
-@@ -4689,22 +4689,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[2] = ref_a;
@@ -35106,7 +35186,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -4714,145 +4714,145 @@
+@@ -4714,145 +4714,145 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -35186,13 +35266,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -35218,65 +35292,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = mel*4 + 1;
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (lel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[lel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = lel*4 + 1;
-+	  }
-+
-+	  iadr = (mel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[mel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = mel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a){
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -35301,11 +35317,78 @@
 -         adja[voy_b] = qel*4 + 1;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (lel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[lel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = lel*4 + 1;
++	  }
++
++	  iadr = (mel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[mel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = mel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a){
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -35354,7 +35437,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -4875,15 +4875,15 @@
+@@ -4875,38 +4875,38 @@ int MMG_swap68_12(pMesh mesh,pSol sol,pL
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -35374,7 +35457,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -4890,8 +4890,8 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -35385,7 +35467,6 @@
  
  
    /*find points of polygone*/
-@@ -4898,15 +4898,15 @@
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
    if(!MMG_findpolygone(mesh,iel,iar,s)) return(0);
@@ -35407,7 +35488,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -4917,7 +4917,7 @@
+@@ -4917,7 +4917,7 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35416,7 +35497,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -4937,7 +4937,7 @@
+@@ -4937,7 +4937,7 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35425,7 +35506,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -4945,9 +4945,9 @@
+@@ -4945,9 +4945,9 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -35437,7 +35518,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -4957,7 +4957,7 @@
+@@ -4957,7 +4957,7 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35446,7 +35527,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -4965,7 +4965,7 @@
+@@ -4965,7 +4965,7 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[6];
@@ -35455,7 +35536,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -4977,7 +4977,7 @@
+@@ -4977,7 +4977,7 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35464,7 +35545,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -4985,9 +4985,9 @@
+@@ -4985,9 +4985,9 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[4];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[8];
@@ -35476,7 +35557,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -4995,49 +4995,49 @@
+@@ -4995,49 +4995,49 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -35537,7 +35618,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -5045,14 +5045,14 @@
+@@ -5045,14 +5045,14 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -35555,7 +35636,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -5061,24 +5061,24 @@
+@@ -5061,46 +5061,46 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[3] = ref_a;
@@ -35590,7 +35671,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (jel-1)*4 + 1;
-@@ -5085,22 +5085,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[2] = ref_a;
@@ -35622,7 +35702,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -5110,145 +5110,145 @@
+@@ -5110,145 +5110,145 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -35702,13 +35782,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -35734,65 +35808,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = oel*4 + 1; 
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (pel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[pel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = pel*4 + 1;
-+	  }
-+
-+	  iadr = (qel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[qel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = qel*4 + 1;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (pel-1)*4 + 1;
@@ -35817,11 +35833,78 @@
 -         adja[voy_b] = qel*4 + 1;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (pel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[pel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = pel*4 + 1;
++	  }
++
++	  iadr = (qel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[qel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = qel*4 + 1;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -35870,7 +35953,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -5271,15 +5271,15 @@
+@@ -5271,38 +5271,38 @@ int MMG_swap68_13(pMesh mesh,pSol sol,pL
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -35890,7 +35973,6 @@
    int    i,ia,ib,s[6],j;
    int    jel,kel,lel,mel,nel,oel,pel,qel;
    int    iarold,iadr,*adja,k,adj,adj_a,adj_b,old,kk,iel,iar,ref,ref_a,ref_b;
-@@ -5286,23 +5286,23 @@
    short  voy,voy_a,voy_b;
  
    if ( !MMG_zaldy4(&hed,21) ) {
@@ -35898,9 +35980,9 @@
 -  }   
 +    if ( mesh->info.ddebug )  fprintf(stdout,"  ## MEMORY ALLOCATION PROBLEM : EDGES UPDATE SWAP6814 IGNORED\n");
 +  }
- 
--  
-+
++
+ 
+-  
    /*find points of polygone*/
    iel  = list->tetra[1] / 6;
    iar  = list->tetra[1] % 6;
@@ -35923,7 +36005,7 @@
    /*create 8 tetras*/
    jel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[jel];
-@@ -5313,7 +5313,7 @@
+@@ -5313,7 +5313,7 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[1];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35932,7 +36014,7 @@
    kel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[kel];
    pt1->v[0] = ib;
-@@ -5333,7 +5333,7 @@
+@@ -5333,7 +5333,7 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[3];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35941,7 +36023,7 @@
    mel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[mel];
    pt1->v[0] = ib;
-@@ -5341,9 +5341,9 @@
+@@ -5341,9 +5341,9 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[3];
    pt1->v[3] = s[2];
    pt1->qual = list->qual[4];
@@ -35953,7 +36035,7 @@
    nel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[nel];
    pt1->v[0] = ia;
-@@ -5353,7 +5353,7 @@
+@@ -5353,7 +5353,7 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[5];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35962,7 +36044,7 @@
    oel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[oel];
    pt1->v[0] = ib;
-@@ -5361,7 +5361,7 @@
+@@ -5361,7 +5361,7 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[4];
    pt1->qual = list->qual[6];
@@ -35971,7 +36053,7 @@
    pt1->ref  = ref;
  
    pel = MMG_newElt(mesh);
-@@ -5373,7 +5373,7 @@
+@@ -5373,7 +5373,7 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->qual = list->qual[7];
    pt1->flag = mesh->flag;
    pt1->ref  = ref;
@@ -35980,7 +36062,7 @@
    qel = MMG_newElt(mesh);
    pt1 = &mesh->tetra[qel];
    pt1->v[0] = ib;
-@@ -5381,9 +5381,9 @@
+@@ -5381,9 +5381,9 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    pt1->v[2] = s[5];
    pt1->v[3] = s[3];
    pt1->qual = list->qual[8];
@@ -35992,7 +36074,7 @@
    /*external faces*/
    /*tetra iel*/
    iadr = (iel-1)*4 + 1;
-@@ -5391,49 +5391,49 @@
+@@ -5391,49 +5391,49 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    k    = MMG_iare[iar][1];
    adj  = adja[k] / 4;
    voy  = adja[k] % 4;
@@ -36054,7 +36136,7 @@
        ref_a  = pt0->bdryref[kk];
        kk    = MMG_iare[iarold][0];
        adj_b  = adja[kk] / 4;
-@@ -5441,14 +5441,14 @@
+@@ -5441,14 +5441,14 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
        ref_b  = pt0->bdryref[kk];
      } else /*if(pt0->v[MMG_iare[iarold][0]]==ib)*/{
        adj_b  = adja[kk] / 4;
@@ -36072,7 +36154,7 @@
      iadr = (iel-1)*4 + 1;
      adja = &mesh->adja[iadr];
      /*s[1] appartient a old */
-@@ -5457,24 +5457,24 @@
+@@ -5457,46 +5457,46 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
        adja = &mesh->adja[iadr];
        adja[3] = adj_a*4 + voy_a;
        mesh->tetra[lel].bdryref[3] = ref_a;
@@ -36107,7 +36189,6 @@
      } else if(old==(adja[MMG_isar[iar][1]]/4)){
        /*s[0] appartient a old*/
        iadr = (jel-1)*4 + 1;
-@@ -5481,22 +5481,22 @@
        adja = &mesh->adja[iadr];
        adja[2] = adj_a*4 + voy_a;
        mesh->tetra[jel].bdryref[2] = ref_a;
@@ -36139,7 +36220,7 @@
        }
      } else {
        /*old n'est pas un voisin de iel*/
-@@ -5506,131 +5506,131 @@
+@@ -5506,131 +5506,131 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
        adj  = adja[j] / 4;
        voy  = adja[j] % 4;
        pt1  = &mesh->tetra[adj];
@@ -36219,13 +36300,7 @@
 -       } else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
 -          j = MMG_idir[voy][2];
 -       }
-+	iadr = (iel-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	j    = MMG_isar[iar][1];
-+	adj  = adja[j] / 4;
-+	voy  = adja[j] % 4;
-+	pt1  = &mesh->tetra[adj];
- 
+-
 -       iadr = (adj-1)*4 + 1;
 -       adja = &mesh->adja[iadr];
 -       /*s[4] s[5] appartient a old*/
@@ -36251,65 +36326,7 @@
 -           adja = &mesh->adja[iadr];
 -           adja[voy_b] = oel*4 + 1;   
 -         }
-+	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
-+	  j = MMG_idir[voy][0];
-+	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
-+	  j = MMG_idir[voy][1];
-+	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
-+	  j = MMG_idir[voy][2];
-+	}
-+
-+	iadr = (adj-1)*4 + 1;
-+	adja = &mesh->adja[iadr];
-+	/*s[4] s[5] appartient a old*/
-+	if(old == adja[j] / 4) {
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[1] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 1;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[1] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[1] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 1;
-+	  }
-+	}
-+	else {
-+	  /*s[3] s[4] appartient a old*/
-+	  iadr = (nel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[3] = adj_a*4 + voy_a;
-+	  mesh->tetra[nel].bdryref[3] = ref_a;
-+
-+	  if (adj_a) {
-+	    iadr = (adj_a-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_a] = nel*4 + 3;
-+	  }
-+
-+	  iadr = (oel-1)*4 + 1;
-+	  adja = &mesh->adja[iadr];
-+	  adja[2] = adj_b*4 + voy_b;
-+	  mesh->tetra[oel].bdryref[2] = ref_b;
-+
-+	  if (adj_b) {
-+	    iadr = (adj_b-1)*4 + 1;
-+	    adja = &mesh->adja[iadr];
-+	    adja[voy_b] = oel*4 + 2;
-+	  }
-+	}
-       }
+-      }
 -      else {
 -      /*s[3] s[4] appartient a old*/
 -       iadr = (nel-1)*4 + 1;
@@ -36334,11 +36351,78 @@
 -         adja[voy_b] = oel*4 + 2;
 -       }     
 -     }
-     }
+-    }
 -   }
 - }  
 - 
 -   /*internal faces*/
++	iadr = (iel-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	j    = MMG_isar[iar][1];
++	adj  = adja[j] / 4;
++	voy  = adja[j] % 4;
++	pt1  = &mesh->tetra[adj];
++
++	if(pt1->v[MMG_idir[voy][0]]==s[0]) {
++	  j = MMG_idir[voy][0];
++	} else if(pt1->v[MMG_idir[voy][1]]==s[0]) {
++	  j = MMG_idir[voy][1];
++	} else if(pt1->v[MMG_idir[voy][2]]==s[0]) {
++	  j = MMG_idir[voy][2];
++	}
++
++	iadr = (adj-1)*4 + 1;
++	adja = &mesh->adja[iadr];
++	/*s[4] s[5] appartient a old*/
++	if(old == adja[j] / 4) {
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[1] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 1;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[1] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[1] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 1;
++	  }
++	}
++	else {
++	  /*s[3] s[4] appartient a old*/
++	  iadr = (nel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[3] = adj_a*4 + voy_a;
++	  mesh->tetra[nel].bdryref[3] = ref_a;
++
++	  if (adj_a) {
++	    iadr = (adj_a-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_a] = nel*4 + 3;
++	  }
++
++	  iadr = (oel-1)*4 + 1;
++	  adja = &mesh->adja[iadr];
++	  adja[2] = adj_b*4 + voy_b;
++	  mesh->tetra[oel].bdryref[2] = ref_b;
++
++	  if (adj_b) {
++	    iadr = (adj_b-1)*4 + 1;
++	    adja = &mesh->adja[iadr];
++	    adja[voy_b] = oel*4 + 2;
++	  }
++	}
++      }
++    }
 +  }
 +
 +  /*internal faces*/
@@ -36369,7 +36453,7 @@
    iadr = (nel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = oel*4 + 0;
-@@ -5640,7 +5640,7 @@
+@@ -5640,7 +5640,7 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    adja = &mesh->adja[iadr];
    adja[0] = nel*4 + 0;
    adja[3] = qel*4 + 1;
@@ -36378,7 +36462,7 @@
    iadr = (pel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[0] = qel*4 + 0;
-@@ -5667,8 +5667,8 @@
+@@ -5667,8 +5667,8 @@ int MMG_swap68_14(pMesh mesh,pSol sol,pL
    list->tetra[7] = pel;
    list->tetra[8] = qel;
    list->tetra[9] = 0;
@@ -36389,11 +36473,11 @@
  
    return(8);
  }
-Index: contrib/mmg3d/build/sources/swap710.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap710.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swap710.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swap710.c	(working copy)
-@@ -182,8 +182,8 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swap710.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swap710.c
+@@ -182,8 +182,8 @@ static int MMG_updatebdryinfo(pMesh mesh
  		iel = list->tetra[k];
  	  pt1 = &mesh->tetra[iel];
  	  for(i=0 ; i<6 ; i++) { 
@@ -36404,7 +36488,7 @@
  	  }
  	}
  	
-@@ -629,7 +629,7 @@
+@@ -629,7 +629,7 @@ int MMG_swap710_1(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36413,7 +36497,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -649,7 +649,7 @@
+@@ -649,7 +649,7 @@ int MMG_swap710_1(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36422,7 +36506,7 @@
  
  }
  int MMG_swap710_2(pMesh mesh,pSol sol,pList list){  
-@@ -945,7 +945,7 @@
+@@ -945,7 +945,7 @@ int MMG_swap710_2(pMesh mesh,pSol sol,pL
    iadr = (sel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[2] = adj*4 + voy;   
@@ -36431,7 +36515,7 @@
    
    if (adj) {
      iadr = (adj-1)*4 + 1;
-@@ -1091,7 +1091,7 @@
+@@ -1091,7 +1091,7 @@ int MMG_swap710_2(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36440,7 +36524,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -1110,7 +1110,7 @@
+@@ -1110,7 +1110,7 @@ int MMG_swap710_2(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36449,7 +36533,7 @@
  
  }
  int MMG_swap710_3(pMesh mesh,pSol sol,pList list){  
-@@ -1539,7 +1539,7 @@
+@@ -1539,7 +1539,7 @@ int MMG_swap710_3(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36458,7 +36542,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -1558,7 +1558,7 @@
+@@ -1558,7 +1558,7 @@ int MMG_swap710_3(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
    
@@ -36467,7 +36551,7 @@
  }
  int MMG_swap710_4(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -1986,7 +1986,7 @@
+@@ -1986,7 +1986,7 @@ int MMG_swap710_4(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36476,7 +36560,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -2005,7 +2005,7 @@
+@@ -2005,7 +2005,7 @@ int MMG_swap710_4(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
   
@@ -36485,7 +36569,7 @@
  }
  int MMG_swap710_5(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -2433,7 +2433,7 @@
+@@ -2433,7 +2433,7 @@ int MMG_swap710_5(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36494,7 +36578,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -2452,7 +2452,7 @@
+@@ -2452,7 +2452,7 @@ int MMG_swap710_5(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36503,7 +36587,7 @@
  }
  int MMG_swap710_6(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -2880,7 +2880,7 @@
+@@ -2880,7 +2880,7 @@ int MMG_swap710_6(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36512,7 +36596,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -2899,7 +2899,7 @@
+@@ -2899,7 +2899,7 @@ int MMG_swap710_6(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36521,7 +36605,7 @@
  }
  int MMG_swap710_7(pMesh mesh,pSol sol,pList list){  
   pTetra pt,pt1,pt0;
-@@ -3328,7 +3328,7 @@
+@@ -3328,7 +3328,7 @@ int MMG_swap710_7(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36530,7 +36614,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -3347,7 +3347,7 @@
+@@ -3347,7 +3347,7 @@ int MMG_swap710_7(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
    
@@ -36539,7 +36623,7 @@
  }
  int MMG_swap710_8(pMesh mesh,pSol sol,pList list){  
   pTetra pt,pt1,pt0;
-@@ -3776,7 +3776,7 @@
+@@ -3776,7 +3776,7 @@ int MMG_swap710_8(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36548,7 +36632,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -3795,7 +3795,7 @@
+@@ -3795,7 +3795,7 @@ int MMG_swap710_8(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36557,7 +36641,7 @@
  }
  int MMG_swap710_9(pMesh mesh,pSol sol,pList list){
    pTetra pt,pt1,pt0;
-@@ -4221,7 +4221,7 @@
+@@ -4221,7 +4221,7 @@ int MMG_swap710_9(pMesh mesh,pSol sol,pL
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36566,7 +36650,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -4241,7 +4241,7 @@
+@@ -4241,7 +4241,7 @@ int MMG_swap710_9(pMesh mesh,pSol sol,pL
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
          
@@ -36575,7 +36659,7 @@
    
  }
  int MMG_swap710_10(pMesh mesh,pSol sol,pList list){  
-@@ -4671,7 +4671,7 @@
+@@ -4671,7 +4671,7 @@ int MMG_swap710_10(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36584,7 +36668,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -4690,7 +4690,7 @@
+@@ -4690,7 +4690,7 @@ int MMG_swap710_10(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36593,7 +36677,7 @@
  
  }
  int MMG_swap710_11(pMesh mesh,pSol sol,pList list){  
-@@ -5129,7 +5129,7 @@
+@@ -5129,7 +5129,7 @@ int MMG_swap710_11(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36602,7 +36686,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -5148,7 +5148,7 @@
+@@ -5148,7 +5148,7 @@ int MMG_swap710_11(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36611,7 +36695,7 @@
  
  }
  int MMG_swap710_12(pMesh mesh,pSol sol,pList list){  
-@@ -5437,7 +5437,7 @@
+@@ -5437,7 +5437,7 @@ int MMG_swap710_12(pMesh mesh,pSol sol,p
    iadr = (oel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[1] = adj*4 + voy;
@@ -36620,7 +36704,7 @@
    if (adj) {
      iadr = (adj-1)*4 + 1;
      adja = &mesh->adja[iadr];
-@@ -5578,7 +5578,7 @@
+@@ -5578,7 +5578,7 @@ int MMG_swap710_12(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36629,7 +36713,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -5597,7 +5597,7 @@
+@@ -5597,7 +5597,7 @@ int MMG_swap710_12(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36638,7 +36722,7 @@
  
  }
  int MMG_swap710_13(pMesh mesh,pSol sol,pList list){  
-@@ -6027,7 +6027,7 @@
+@@ -6027,7 +6027,7 @@ int MMG_swap710_13(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36647,7 +36731,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -6046,7 +6046,7 @@
+@@ -6046,7 +6046,7 @@ int MMG_swap710_13(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36656,7 +36740,7 @@
  
  }
  int MMG_swap710_14(pMesh mesh,pSol sol,pList list){  
-@@ -6476,7 +6476,7 @@
+@@ -6476,7 +6476,7 @@ int MMG_swap710_14(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36665,7 +36749,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -6495,7 +6495,7 @@
+@@ -6495,7 +6495,7 @@ int MMG_swap710_14(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36674,7 +36758,7 @@
  }
  int MMG_swap710_15(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -6845,7 +6845,7 @@
+@@ -6845,7 +6845,7 @@ int MMG_swap710_15(pMesh mesh,pSol sol,p
    iadr = (nel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[2] = adj*4 + voy;
@@ -36683,7 +36767,7 @@
    if (adj) {
      iadr = (adj-1)*4 + 1;
      adja = &mesh->adja[iadr];
-@@ -6924,7 +6924,7 @@
+@@ -6924,7 +6924,7 @@ int MMG_swap710_15(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36692,7 +36776,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -6943,7 +6943,7 @@
+@@ -6943,7 +6943,7 @@ int MMG_swap710_15(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36701,7 +36785,7 @@
  }
  int MMG_swap710_16(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -7372,7 +7372,7 @@
+@@ -7372,7 +7372,7 @@ int MMG_swap710_16(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36710,7 +36794,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -7391,7 +7391,7 @@
+@@ -7391,7 +7391,7 @@ int MMG_swap710_16(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36719,7 +36803,7 @@
  }
  int MMG_swap710_17(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -7820,7 +7820,7 @@
+@@ -7820,7 +7820,7 @@ int MMG_swap710_17(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36728,7 +36812,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -7839,7 +7839,7 @@
+@@ -7839,7 +7839,7 @@ int MMG_swap710_17(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36737,7 +36821,7 @@
  }
  int MMG_swap710_18(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -8268,7 +8268,7 @@
+@@ -8268,7 +8268,7 @@ int MMG_swap710_18(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36746,7 +36830,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -8287,7 +8287,7 @@
+@@ -8287,7 +8287,7 @@ int MMG_swap710_18(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36755,7 +36839,7 @@
  }
  int MMG_swap710_19(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -8716,7 +8716,7 @@
+@@ -8716,7 +8716,7 @@ int MMG_swap710_19(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36764,7 +36848,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -8735,7 +8735,7 @@
+@@ -8735,7 +8735,7 @@ int MMG_swap710_19(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36773,7 +36857,7 @@
  }
  
  int MMG_swap710_20(pMesh mesh,pSol sol,pList list){  
-@@ -9165,7 +9165,7 @@
+@@ -9165,7 +9165,7 @@ int MMG_swap710_20(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36782,7 +36866,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -9184,7 +9184,7 @@
+@@ -9184,7 +9184,7 @@ int MMG_swap710_20(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36791,7 +36875,7 @@
  }
  int MMG_swap710_21(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -9614,7 +9614,7 @@
+@@ -9614,7 +9614,7 @@ int MMG_swap710_21(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36800,7 +36884,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -9633,7 +9633,7 @@
+@@ -9633,7 +9633,7 @@ int MMG_swap710_21(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36809,7 +36893,7 @@
  }
  int MMG_swap710_22(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -10062,7 +10062,7 @@
+@@ -10062,7 +10062,7 @@ int MMG_swap710_22(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36818,7 +36902,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -10081,7 +10081,7 @@
+@@ -10081,7 +10081,7 @@ int MMG_swap710_22(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36827,7 +36911,7 @@
  }
  int MMG_swap710_23(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -10510,7 +10510,7 @@
+@@ -10510,7 +10510,7 @@ int MMG_swap710_23(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36836,7 +36920,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -10529,7 +10529,7 @@
+@@ -10529,7 +10529,7 @@ int MMG_swap710_23(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36845,7 +36929,7 @@
  }
  int MMG_swap710_24(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -10958,7 +10958,7 @@
+@@ -10958,7 +10958,7 @@ int MMG_swap710_24(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36854,7 +36938,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -10977,7 +10977,7 @@
+@@ -10977,7 +10977,7 @@ int MMG_swap710_24(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36863,7 +36947,7 @@
  }
  int MMG_swap710_25(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -11406,7 +11406,7 @@
+@@ -11406,7 +11406,7 @@ int MMG_swap710_25(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36872,7 +36956,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -11425,7 +11425,7 @@
+@@ -11425,7 +11425,7 @@ int MMG_swap710_25(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36881,7 +36965,7 @@
  }
  int MMG_swap710_26(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -11854,7 +11854,7 @@
+@@ -11854,7 +11854,7 @@ int MMG_swap710_26(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36890,7 +36974,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -11873,7 +11873,7 @@
+@@ -11873,7 +11873,7 @@ int MMG_swap710_26(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36899,7 +36983,7 @@
  }
  int MMG_swap710_27(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -12302,7 +12302,7 @@
+@@ -12302,7 +12302,7 @@ int MMG_swap710_27(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36908,7 +36992,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -12321,7 +12321,7 @@
+@@ -12321,7 +12321,7 @@ int MMG_swap710_27(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
   
@@ -36917,7 +37001,7 @@
  }
  int MMG_swap710_28(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -12750,7 +12750,7 @@
+@@ -12750,7 +12750,7 @@ int MMG_swap710_28(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36926,7 +37010,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -12769,7 +12769,7 @@
+@@ -12769,7 +12769,7 @@ int MMG_swap710_28(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36935,7 +37019,7 @@
  }
  int MMG_swap710_29(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -13198,7 +13198,7 @@
+@@ -13198,7 +13198,7 @@ int MMG_swap710_29(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36944,7 +37028,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -13217,7 +13217,7 @@
+@@ -13217,7 +13217,7 @@ int MMG_swap710_29(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36953,7 +37037,7 @@
  }
  int MMG_swap710_30(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -13646,7 +13646,7 @@
+@@ -13646,7 +13646,7 @@ int MMG_swap710_30(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36962,7 +37046,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -13665,7 +13665,7 @@
+@@ -13665,7 +13665,7 @@ int MMG_swap710_30(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36971,7 +37055,7 @@
  }
  int MMG_swap710_31(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -14094,7 +14094,7 @@
+@@ -14094,7 +14094,7 @@ int MMG_swap710_31(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36980,7 +37064,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -14113,7 +14113,7 @@
+@@ -14113,7 +14113,7 @@ int MMG_swap710_31(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -36989,7 +37073,7 @@
  }
  int MMG_swap710_32(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -14542,7 +14542,7 @@
+@@ -14542,7 +14542,7 @@ int MMG_swap710_32(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -36998,7 +37082,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -14561,7 +14561,7 @@
+@@ -14561,7 +14561,7 @@ int MMG_swap710_32(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37007,7 +37091,7 @@
  }
  int MMG_swap710_33(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -14990,7 +14990,7 @@
+@@ -14990,7 +14990,7 @@ int MMG_swap710_33(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37016,7 +37100,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -15009,7 +15009,7 @@
+@@ -15009,7 +15009,7 @@ int MMG_swap710_33(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37025,7 +37109,7 @@
  }
  int MMG_swap710_34(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -15438,7 +15438,7 @@
+@@ -15438,7 +15438,7 @@ int MMG_swap710_34(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37034,7 +37118,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -15457,7 +15457,7 @@
+@@ -15457,7 +15457,7 @@ int MMG_swap710_34(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37043,7 +37127,7 @@
  }
  int MMG_swap710_35(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -15632,7 +15632,7 @@
+@@ -15632,7 +15632,7 @@ int MMG_swap710_35(pMesh mesh,pSol sol,p
    iadr = (oel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[2] = adj*4 + voy;
@@ -37052,7 +37136,7 @@
    if (adj) {
      iadr = (adj-1)*4 + 1;
      adja = &mesh->adja[iadr];
-@@ -15886,7 +15886,7 @@
+@@ -15886,7 +15886,7 @@ int MMG_swap710_35(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37061,7 +37145,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -15905,7 +15905,7 @@
+@@ -15905,7 +15905,7 @@ int MMG_swap710_35(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37070,7 +37154,7 @@
  }
  int MMG_swap710_36(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -16334,7 +16334,7 @@
+@@ -16334,7 +16334,7 @@ int MMG_swap710_36(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37079,7 +37163,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -16353,7 +16353,7 @@
+@@ -16353,7 +16353,7 @@ int MMG_swap710_36(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37088,7 +37172,7 @@
  }
  int MMG_swap710_37(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -16782,7 +16782,7 @@
+@@ -16782,7 +16782,7 @@ int MMG_swap710_37(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37097,7 +37181,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -16801,7 +16801,7 @@
+@@ -16801,7 +16801,7 @@ int MMG_swap710_37(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37106,7 +37190,7 @@
  }
  int MMG_swap710_38(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -17230,7 +17230,7 @@
+@@ -17230,7 +17230,7 @@ int MMG_swap710_38(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37115,7 +37199,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -17249,7 +17249,7 @@
+@@ -17249,7 +17249,7 @@ int MMG_swap710_38(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37124,7 +37208,7 @@
  }
  int MMG_swap710_39(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -17677,7 +17677,7 @@
+@@ -17677,7 +17677,7 @@ int MMG_swap710_39(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37133,7 +37217,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -17696,7 +17696,7 @@
+@@ -17696,7 +17696,7 @@ int MMG_swap710_39(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37142,7 +37226,7 @@
  }
  int MMG_swap710_40(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -17910,7 +17910,7 @@
+@@ -17910,7 +17910,7 @@ int MMG_swap710_40(pMesh mesh,pSol sol,p
    iadr = (mel-1)*4 + 1;
    adja = &mesh->adja[iadr];
    adja[1] = adj*4 + voy;
@@ -37151,7 +37235,7 @@
    if(adj) {
      iadr = (adj-1)*4 + 1;
      adja = &mesh->adja[iadr];
-@@ -18125,7 +18125,7 @@
+@@ -18125,7 +18125,7 @@ int MMG_swap710_40(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37160,7 +37244,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -18144,7 +18144,7 @@
+@@ -18144,7 +18144,7 @@ int MMG_swap710_40(pMesh mesh,pSol sol,p
  //MMG_chkmsh(mesh,1,0);
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
@@ -37169,7 +37253,7 @@
  }
  int MMG_swap710_41(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -18573,7 +18573,7 @@
+@@ -18573,7 +18573,7 @@ int MMG_swap710_41(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37178,7 +37262,7 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -18592,7 +18592,7 @@
+@@ -18592,7 +18592,7 @@ int MMG_swap710_41(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
@@ -37187,7 +37271,7 @@
  }
  int MMG_swap710_42(pMesh mesh,pSol sol,pList list){  
    pTetra pt,pt1,pt0;
-@@ -19021,7 +19021,7 @@
+@@ -19021,7 +19021,7 @@ int MMG_swap710_42(pMesh mesh,pSol sol,p
    for (k=1; k<=7; k++) { 
  		pt0 = &mesh->tetra[list->tetra[k]/6];
  		for(i=0 ; i<6 ; i++) {
@@ -37196,17 +37280,17 @@
  		}
      MMG_delElt(mesh,list->tetra[k]/6); 
    }
-@@ -19040,5 +19040,5 @@
+@@ -19040,5 +19040,5 @@ int MMG_swap710_42(pMesh mesh,pSol sol,p
  	MMG_updatebdryinfo(mesh,&hed,list);
  	M_free(hed.item);
  
 -return(1);
 +return(10);
  }
-Index: contrib/mmg3d/build/sources/swapar.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swapar.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swapar.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swapar.c	(working copy)
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swapar.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swapar.c
 @@ -1,106 +1,106 @@
 -/****************************************************************************
 -Logiciel initial: MMG3D Version 4.0
@@ -37420,11 +37504,11 @@
 +
 +  return(0);
 +}
-Index: contrib/mmg3d/build/sources/swaptet.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swaptet.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/swaptet.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/swaptet.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/swaptet.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/swaptet.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -37459,7 +37543,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -37470,7 +37553,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -37479,7 +37562,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -53,7 +53,7 @@
+@@ -53,7 +53,7 @@ int MMG_swaptet(pMesh mesh,pSol sol,pQue
    double crit;
    int    i,*adja,iadr,lon,ier,adj,j,jel;
    char   tabar,done;
@@ -37488,7 +37571,7 @@
    pt = &mesh->tetra[iel];
    if ( !pt->v[0] )  return(0);
  
-@@ -70,7 +70,7 @@
+@@ -70,7 +70,7 @@ int MMG_swaptet(pMesh mesh,pSol sol,pQue
      }
    }
    if ( tabar == ALL_BDRY )  return(0);
@@ -37497,7 +37580,7 @@
    /* MMG_swap for anisotropy */
    done = 0;
    for (i=0; i<6; i++) {
-@@ -97,9 +97,9 @@
+@@ -97,9 +97,9 @@ int MMG_swaptet(pMesh mesh,pSol sol,pQue
        fprintf(stdout,"  ## UNABLE TO MMG_swap.\n");
        return(-1);
      }
@@ -37510,11 +37593,11 @@
 - 
 +
  }
-Index: contrib/mmg3d/build/sources/typelt.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/typelt.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/typelt.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/typelt.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/typelt.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/typelt.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -37549,7 +37632,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -37560,7 +37642,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,7 +41,7 @@
+@@ -41,7 +41,7 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -37569,7 +37651,7 @@
  ****************************************************************************/
  #include "mesh.h"
  
-@@ -49,39 +49,39 @@
+@@ -49,39 +49,39 @@ along with MMG3D. If not, see <http://ww
  #define RAPMAX    0.25
  
  
@@ -37584,19 +37666,8 @@
 -        7: 4 faces grandes aretes 
 -   item: bad entity
 -*/
-+				    /* identify type of element :
-+				       ityp= 0: 4 faces bonnes          (elt ok)
-+				       1: 4 faces bonnes, vol nul (sliver)
-+				       2: 4 faces ok, vol nul+sommet proche face   (chapeau)
-+				       3: 3 faces bonnes, 1 obtuse    (aileron)
-+				       4: 2 faces bonnes, 2 faces aigu => 1 petite arete
-+				       5: 1 face bonne, 3 petites aretes
-+				       6: 2 faces grandes aretes, 2 faces petites iaretes
-+				       7: 4 faces grandes aretes
-+				       item: bad entity
-+				    */
- 
- 
+-
+-
 -/* nb face obtuse :    nb faces aigu : 
 -ityp :  0: 0		0
 -	1: 0		0
@@ -37617,6 +37688,19 @@
 -	6: 1		1
 -	7: 0		2
 -*/
++				    /* identify type of element :
++				       ityp= 0: 4 faces bonnes          (elt ok)
++				       1: 4 faces bonnes, vol nul (sliver)
++				       2: 4 faces ok, vol nul+sommet proche face   (chapeau)
++				       3: 3 faces bonnes, 1 obtuse    (aileron)
++				       4: 2 faces bonnes, 2 faces aigu => 1 petite arete
++				       5: 1 face bonne, 3 petites aretes
++				       6: 2 faces grandes aretes, 2 faces petites iaretes
++				       7: 4 faces grandes aretes
++				       item: bad entity
++				    */
++
++
 +				    /* nb face obtuse :    nb faces aigu :
 +				       ityp :  0: 0             0
 +				       1: 0             0
@@ -37640,34 +37724,36 @@
  
  int MMG_typelt(pMesh mesh,int iel,int *item) {
    pTetra    pt;
-@@ -107,17 +107,17 @@
+@@ -107,17 +107,17 @@ int MMG_typelt(pMesh mesh,int iel,int *i
    pd = &mesh->point[id];
  
    /* volume */
 -  abx = pb->c[0] - pa->c[0]; 
 -  aby = pb->c[1] - pa->c[1]; 
 -  abz = pb->c[2] - pa->c[2]; 
+-
+-  acx = pc->c[0] - pa->c[0]; 
+-  acy = pc->c[1] - pa->c[1]; 
+-  acz = pc->c[2] - pa->c[2]; 
+-
+-  adx = pd->c[0] - pa->c[0]; 
+-  ady = pd->c[1] - pa->c[1]; 
+-  adz = pd->c[2] - pa->c[2]; 
 +  abx = pb->c[0] - pa->c[0];
 +  aby = pb->c[1] - pa->c[1];
 +  abz = pb->c[2] - pa->c[2];
- 
--  acx = pc->c[0] - pa->c[0]; 
--  acy = pc->c[1] - pa->c[1]; 
--  acz = pc->c[2] - pa->c[2]; 
++
 +  acx = pc->c[0] - pa->c[0];
 +  acy = pc->c[1] - pa->c[1];
 +  acz = pc->c[2] - pa->c[2];
- 
--  adx = pd->c[0] - pa->c[0]; 
--  ady = pd->c[1] - pa->c[1]; 
--  adz = pd->c[2] - pa->c[2]; 
++
 +  adx = pd->c[0] - pa->c[0];
 +  ady = pd->c[1] - pa->c[1];
 +  adz = pd->c[2] - pa->c[2];
  
    v1  = acy*adz - acz*ady;
    v2  = acz*adx - acx*adz;
-@@ -146,7 +146,7 @@
+@@ -146,7 +146,7 @@ int MMG_typelt(pMesh mesh,int iel,int *i
    h[5] = cdx*cdx + cdy*cdy + cdz*cdz;
  
    /* face areas */
@@ -37676,7 +37762,7 @@
    s[0] = dd * dd;
    dd = cdz*bdx - cdx*bdz;
    s[0] = s[0] + dd * dd;
-@@ -193,8 +193,8 @@
+@@ -193,8 +193,8 @@ int MMG_typelt(pMesh mesh,int iel,int *i
  
    /* small volume: types 1,2,3,4 */
    if ( vol < volchk ) {
@@ -37687,7 +37773,7 @@
      ssmall = 0.4 * (s[0]+s[1]+s[2]+s[3]);
      isur   = 0;
      for (i=0; i<4; i++)
-@@ -202,7 +202,7 @@
+@@ -202,32 +202,32 @@ int MMG_typelt(pMesh mesh,int iel,int *i
  
      /* types 2,3 */
      item[0] = iarmax;
@@ -37696,7 +37782,6 @@
      if ( isur == 1 ) {
        surmin   = s[0];
        isurmin = 0;
-@@ -209,25 +209,25 @@
        surmax   = s[0];
        isurmax = 0;
        for (i=1; i<4; i++) {
@@ -37732,7 +37817,7 @@
      }
  
      /* types 1 */
-@@ -242,60 +242,60 @@
+@@ -242,60 +242,60 @@ int MMG_typelt(pMesh mesh,int iel,int *i
        item[1] = MMG_idir[iarmin][0];
        if ( dd < 0.01 )  return(4);
        if ( s[0]+s[1] > ssmall ) {
@@ -37826,7 +37911,7 @@
      }
    }
  
-@@ -304,74 +304,74 @@
+@@ -304,74 +304,74 @@ int MMG_typelt(pMesh mesh,int iel,int *i
      naigu = 0;
      for (k=0; k<4; k++) {
        for (i=0; i<3; i++) {
@@ -37963,11 +38048,11 @@
    item[0] = 0;
    //puts("default");
    return(1);
-Index: contrib/mmg3d/build/sources/zaldy.c
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/zaldy.c
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/zaldy.c	(revision 21900)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/zaldy.c	(working copy)
-@@ -3,24 +3,24 @@
+--- gmsh-tetgen-2.12.0.orig/contrib/mmg3d/build/sources/zaldy.c
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/zaldy.c
+@@ -3,32 +3,32 @@ Logiciel initial: MMG3D Version 4.0
  Co-auteurs : Cecile Dobrzynski et Pascal Frey.
  Propriétaires :IPB - UPMC -INRIA.
  
@@ -38002,7 +38087,6 @@
  Si ce n’est pas le cas, aller voir <http://www.gnu.org/licenses/>.
  /****************************************************************************
  Initial software: MMG3D Version 4.0
-@@ -27,8 +27,8 @@
  Co-authors: Cecile Dobrzynski et Pascal Frey.
  Owners: IPB - UPMC -INRIA.
  
@@ -38013,7 +38097,7 @@
  as published Version 3, or (at your option) any later version.
  
  This file is part of MMG3D
-@@ -41,11 +41,11 @@
+@@ -41,11 +41,11 @@ but WITHOUT ANY WARRANTY; without even t
  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
@@ -38027,7 +38111,7 @@
  int MMG_newPt(pMesh mesh,double c[3]) {
    pPoint  ppt;
    int     curpt;
-@@ -106,7 +106,7 @@
+@@ -106,7 +106,7 @@ void MMG_delElt(pMesh mesh,int iel) {
    pt->v[3] = mesh->nenil;
    pt->qual = 0.0;
    pt->edge = 0;
@@ -38036,7 +38120,7 @@
    memset(&mesh->adja[iadr],0,4*sizeof(int));
  
    mesh->nenil = iel;
-@@ -170,13 +170,15 @@
+@@ -170,13 +170,15 @@ int MMG_zaldy(pMesh mesh) {
      mesh->npmax = M_MAX(1.5*mesh->np,NPMAX);
      mesh->nemax = M_MAX(1.5*mesh->ne,NEMAX);
      mesh->ntmax = M_MAX(1.5*mesh->nt,NTMAX);
@@ -38055,7 +38139,7 @@
  
      npask = (double)mesh->info.memory / bytes * million;
      mesh->npmax = M_MAX(1.5*mesh->np,npask);
-@@ -233,7 +235,7 @@
+@@ -233,7 +235,7 @@ int MMG_zaldy3(pSol sol) {
  
  
  /* edge structure for cavity */
@@ -38064,15 +38148,15 @@
    int   k;
  
    hedg->size  = size;
-@@ -253,4 +255,3 @@
+@@ -253,4 +255,3 @@ int MMG_zaldy4(pHedge hedg,int size) {
  int MMG_zaldy5() {
    return(1);
  }
 -
-Index: contrib/mmg3d/build/sources/libmmg3d4.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/libmmg3d4.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/libmmg3d4.h	(nonexistent)
-+++ gmsh-tetgen-2.9.4~svn21703/contrib/mmg3d/build/sources/libmmg3d4.h	(working copy)
+--- /dev/null
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/libmmg3d4.h
 @@ -0,0 +1,158 @@
 +/****************************************************************************
 +Logiciel initial: MMG3D Version 4.0
@@ -38232,10 +38316,10 @@
 +#ifdef  __cplusplus
 +  }}
 +#endif
-Index: contrib/mmg3d/build/sources/libmmg3d4_internal.h
+Index: gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/libmmg3d4_internal.h
 ===================================================================
---- gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/libmmg3d4_internal.h	(nonexistent)
-+++ gmsh-tetgen-2.9.4~svn21703.orig/contrib/mmg3d/build/sources/libmmg3d4_internal.h	(working copy)
+--- /dev/null
++++ gmsh-tetgen-2.12.0/contrib/mmg3d/build/sources/libmmg3d4_internal.h
 @@ -0,0 +1,61 @@
 +/****************************************************************************
 +Logiciel initial: MMG3D Version 4.0

Modified: packages/gmsh-tetgen/trunk/debian/patches/petsc.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/petsc.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/petsc.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/petsc.patch	Wed Apr 13 12:57:44 2016
@@ -1,8 +1,8 @@
-Index: gmsh-tetgen-2.11.0/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.11.0.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.11.0/CMakeLists.txt
-@@ -1005,13 +1005,26 @@ if(HAVE_SOLVER)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -994,13 +994,26 @@ if(HAVE_SOLVER)
          endif(PETSC_PACKAGES_INCLUDES)
        endif(PETSC_PACKAGES_INCLUDES)
        # find libraries (<= 3.0)
@@ -30,7 +30,7 @@
        endif(NOT PETSC_LIBS)
        if(PETSC_LIBS)
          set_config_option(HAVE_PETSC "PETSc")
-@@ -1029,15 +1042,22 @@ if(HAVE_SOLVER)
+@@ -1018,15 +1031,22 @@ if(HAVE_SOLVER)
           else(SLEPC_DIR)
            set(ENV_SLEPC_DIR $ENV{SLEPC_DIR})
          endif(SLEPC_DIR)
@@ -57,7 +57,7 @@
              list(APPEND EXTERNAL_INCLUDES ${SLEPC_INC})
              find_path(SLEPC_INC2 "slepcconf.h" PATHS ${ENV_SLEPC_DIR}
                        PATH_SUFFIXES ${ENV_PETSC_ARCH}/include NO_DEFAULT_PATH)
-@@ -1045,7 +1065,7 @@ if(HAVE_SOLVER)
+@@ -1034,7 +1054,7 @@ if(HAVE_SOLVER)
                list(APPEND EXTERNAL_INCLUDES ${SLEPC_INC2})
              endif(SLEPC_INC2)
            endif(SLEPC_INC)

Modified: packages/gmsh-tetgen/trunk/debian/patches/python-cmake.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/python-cmake.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/python-cmake.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/python-cmake.patch	Wed Apr 13 12:57:44 2016
@@ -23,11 +23,11 @@
 Reviewed-By: <name and email of someone who approved the patch>
 Last-Update: <YYYY-MM-DD>
 
-Index: gmsh-tetgen-2.11.0/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.11.0.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.11.0/CMakeLists.txt
-@@ -1228,6 +1228,8 @@ endif(ENABLE_ZIPPER)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1217,6 +1217,8 @@ endif(ENABLE_ZIPPER)
  if(ENABLE_WRAP_PYTHON)
    find_package(SWIG)
    find_package(PythonLibs)

Modified: packages/gmsh-tetgen/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/series?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/series	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/series	Wed Apr 13 12:57:44 2016
@@ -23,3 +23,5 @@
 fix-cmake.patch
 python-cmake.patch
 metis-errormsg.patch
+texinfo.patch
+java.patch

Modified: packages/gmsh-tetgen/trunk/debian/patches/sgeom.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/sgeom.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/sgeom.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/sgeom.patch	Wed Apr 13 12:57:44 2016
@@ -1,8 +1,8 @@
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -1138,8 +1138,8 @@ if(ENABLE_OCC)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1103,8 +1103,8 @@ if(ENABLE_OCC)
        # For SGEOM
        TKBin TKBinL TKBinTObj TKBinXCAF TKCAF TKCDF TKLCAF TKPLCAF TKMeshVS
        TKNIS TKOpenGl TKPCAF TKPShape TKSTL TKService TKShapeSchema TKStdSchema

Modified: packages/gmsh-tetgen/trunk/debian/patches/skip_license_file.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/skip_license_file.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/skip_license_file.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/skip_license_file.patch	Wed Apr 13 12:57:44 2016
@@ -2,11 +2,11 @@
 Author: Anton Gladky <gladky.anton at gmail.com>
 Last-Update: 2011-12-09
 
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -1550,7 +1550,7 @@ if(UNIX)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -1555,7 +1555,7 @@ if(UNIX)
  endif(UNIX)
  
  set(WELCOME_FILE ${CMAKE_CURRENT_SOURCE_DIR}/doc/WELCOME.txt)
@@ -15,7 +15,7 @@
  set(CREDITS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/doc/CREDITS.txt)
  set(ONELAB_PY ${CMAKE_CURRENT_SOURCE_DIR}/contrib/onelab/python/onelab.py)
  file(GLOB TUTORIAL_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tutorial/?*.*)
-@@ -1717,7 +1717,7 @@ execute_process(COMMAND ${CMAKE_COMMAND}
+@@ -1722,7 +1722,7 @@ execute_process(COMMAND ${CMAKE_COMMAND}
  if(MAKEINFO AND TEXI2PDF)
    add_custom_target(doc COMMAND ${CMAKE_COMMAND} -E tar zcf
                      ${CMAKE_CURRENT_BINARY_DIR}/gmsh-${GMSH_VERSION}-doc.tgz

Modified: packages/gmsh-tetgen/trunk/debian/patches/tetgen.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/tetgen.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/tetgen.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/tetgen.patch	Wed Apr 13 12:57:44 2016
@@ -1,8 +1,8 @@
-Index: gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
+Index: gmsh-tetgen-2.12.0/CMakeLists.txt
 ===================================================================
---- gmsh-tetgen-2.10.2~svn22060.orig/CMakeLists.txt
-+++ gmsh-tetgen-2.10.2~svn22060/CMakeLists.txt
-@@ -840,29 +840,30 @@ if(HAVE_MESH)
+--- gmsh-tetgen-2.12.0.orig/CMakeLists.txt
++++ gmsh-tetgen-2.12.0/CMakeLists.txt
+@@ -792,29 +792,30 @@ if(HAVE_MESH)
      set_config_option(HAVE_MMG3D "Mmg3d")
    endif(ENABLE_MMG3D)
  

Modified: packages/gmsh-tetgen/trunk/debian/patches/texinfo.patch
URL: http://svn.debian.org/wsvn/debian-science/packages/gmsh-tetgen/trunk/debian/patches/texinfo.patch?rev=47220&op=diff
==============================================================================
--- packages/gmsh-tetgen/trunk/debian/patches/texinfo.patch	(original)
+++ packages/gmsh-tetgen/trunk/debian/patches/texinfo.patch	Wed Apr 13 12:57:44 2016
@@ -5,9 +5,9 @@
  information below has been extracted from the changelog. Adjust it or drop
  it.
  .
- gmsh-tetgen (2.7.2~svn16038-1) unstable; urgency=low
+ gmsh-tetgen (2.12.0-1) usntable; urgency=medium
  .
-   * Update to latest svn
+   * new upstream release
 Author: Christophe Trophime <christophe.trophime at lncmi.cnrs.fr>
 
 ---
@@ -17,22 +17,20 @@
 
 Origin: <vendor|upstream|other>, <url of original patch>
 Bug: <url in upstream bugtracker>
-Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
 Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
 Forwarded: <no|not-needed|url proving that it has been forwarded>
 Reviewed-By: <name and email of someone who approved the patch>
 Last-Update: <YYYY-MM-DD>
 
-Index: gmsh-tetgen-2.7.2~svn16038/CMakeLists.txt
-===================================================================
---- gmsh-tetgen-2.7.2~svn16038.orig/CMakeLists.txt	2013-06-24 17:40:58.000000000 +0200
-+++ gmsh-tetgen-2.7.2~svn16038/CMakeLists.txt	2013-06-24 17:41:29.000000000 +0200
-@@ -1385,7 +1385,7 @@
- find_program(TEXI2PDF texi2pdf)
- if(TEXI2PDF)
-   add_custom_command(OUTPUT ${TEX_DIR}/gmsh.pdf DEPENDS ${TEX_SRC} 
--                     COMMAND ${TEXI2PDF} ARGS ${TEX_DIR}/gmsh.texi 
-+                     COMMAND ${TEXI2PDF} ARGS gmsh.texi 
-                      WORKING_DIRECTORY ${TEX_DIR})
-   add_custom_target(pdf DEPENDS ${TEX_DIR}/gmsh.pdf)
-   install(FILES ${TEX_DIR}/gmsh.pdf DESTINATION ${GMSH_DOC} OPTIONAL)
+--- gmsh-tetgen-2.12.0.orig/doc/texinfo/gmsh.texi
++++ gmsh-tetgen-2.12.0/doc/texinfo/gmsh.texi
+@@ -1008,7 +1008,7 @@ parsing of the script file:
+   Exists(@var{string}) | Exists(@var{string}~@{ @var{expression} @}) |
+   FileExists(@var{char-expression}) |
+   StringToName(@var{char-expression}) | S2N(@var{char-expression}) |
+-  GetNumber(@var{char-expression} <,@{expression}>) |
++  GetNumber(@var{char-expression} <, at var{expression}>) |
+   GetValue("@var{string}", @var{expression}) |
+   DefineNumber(@var{expression}, @var{onelab-options}) |
+ @end example




More information about the debian-science-commits mailing list