diff --git a/Fltk/statisticsWindow.cpp b/Fltk/statisticsWindow.cpp
index 0c95721008b746a7a34b1131a5da982920acbe88..beb42ddf23d994cef53e03ecc1a89fbe207f4c2b 100644
--- a/Fltk/statisticsWindow.cpp
+++ b/Fltk/statisticsWindow.cpp
@@ -63,7 +63,6 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
     new PView("Disto", "# Elements", x, y);
   }
   else{
-
     std::vector<GEntity*> entities_;
     GModel::current()->getEntities(entities_);
     std::map<int, std::vector<double> > d;
@@ -71,10 +70,8 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
       if(entities_[i]->dim() < 2) continue;
       for(unsigned int j = 0; j < entities_[i]->getNumMeshElements(); j++){
 	MElement *e = entities_[i]->getMeshElement(j);
-	if(name == "Gamma3D"){
-	  printf("gamma shape mesaure \n");
+	if(name == "Gamma3D")
 	  d[e->getNum()].push_back(e->gammaShapeMeasure());
-	}
 	else if(name == "Eta3D")
 	  d[e->getNum()].push_back(e->etaShapeMeasure());
 	else if(name == "Rho3D")
@@ -85,7 +82,6 @@ static void statistics_histogram_cb(Fl_Widget *w, void *data)
 	}
       }
     }
-
     name.resize(name.size() - 2);
     new PView(name, "ElementData", GModel::current(), d);
   }
diff --git a/Mesh/Levy3D.cpp b/Mesh/Levy3D.cpp
index 87c36453522f4d76ad332fe353088271f05e8da6..629d3b46a0ef35ea882bab549e2e90aa345a58ad 100755
--- a/Mesh/Levy3D.cpp
+++ b/Mesh/Levy3D.cpp
@@ -751,11 +751,11 @@ void LpCVT::verification(std::vector<SPoint3>& bank,std::vector<int>& movability
 
   printf("Finite difference : %f  %f  %f\n",(right-left)/(2.0*e),(up-down)/(2.0*e),(front-back)/(2.0*e));
   printf("            Gauss : %f  %f  %f\n",gradients[index-offset].x(),gradients[index-offset].y(),gradients[index-offset].z());
-  printf("%d %d %d\n",index,bank.size(),offset);
+  printf("%d %d %d\n",index,(int)bank.size(),offset);
 }
 
 void LpCVT::eval(std::vector<SPoint3>& bank,std::vector<int>& movability,int offset,std::vector<SVector3>& gradients,double& energy,int p){
-  int i;
+  unsigned int i;
   int index;
   int index1,index2,index3;
   int index4,index5,index6;
@@ -838,7 +838,7 @@ void LpCVT::eval(std::vector<SPoint3>& bank,std::vector<int>& movability,int off
 }
 
 void LpCVT::compute_parameters(){
-  int i;
+  unsigned int i;
   double h1,h2,h3,h4;
   Tensor t;
   VoronoiVertex v1,v2,v3,v4;
@@ -875,17 +875,17 @@ double LpCVT::get_size(double x,double y,double z){
 Tensor LpCVT::get_tensor(double x,double y,double z){
   Tensor t;
   Matrix m;
-	
-  m = Frame_field::search(x,y,z);	
-	
+
+  m = Frame_field::search(x,y,z);
+
   t.set_t11(m.get_m11());
   t.set_t21(m.get_m12());
   t.set_t31(m.get_m13());
-  
+
   t.set_t12(m.get_m21());
   t.set_t22(m.get_m22());
   t.set_t32(m.get_m23());
-  
+
   t.set_t13(m.get_m31());
   t.set_t23(m.get_m32());
   t.set_t33(m.get_m33());
@@ -954,7 +954,7 @@ double LpCVT::h_to_rho(double h,int p){
 }
 
 void LpCVT::swap(){
-  int i;
+  unsigned int i;
   for(i=0;i<clipped.size();i++){
     clipped[i].swap();
   }
@@ -962,11 +962,11 @@ void LpCVT::swap(){
 
 void LpCVT::get_gauss(){
   int order;
-  
+
   order = 8;
   gaussIntegration::getTetrahedron(order,gauss_points,gauss_weights);
   gauss_num = gauss_points.size1();
-	
+
   f_cache.resize(gauss_num);
   df_dx_cache.resize(gauss_num);
   df_dy_cache.resize(gauss_num);
@@ -984,7 +984,7 @@ void LpCVT::init_caches(VoronoiElement element,int p){
   SPoint3 point,generator,C1,C2,C3;
   VoronoiVertex v1,v2,v3,v4;
   Tensor t;
-	
+
   v1 = element.get_v1();
   v2 = element.get_v2();
   v3 = element.get_v3();
@@ -994,7 +994,7 @@ void LpCVT::init_caches(VoronoiElement element,int p){
   C2 = v3.get_point();
   C3 = v4.get_point();
   t = element.get_tensor();
-    
+
   for(i=0;i<gauss_num;i++){
     u = gauss_points(i,0);
 	v = gauss_points(i,1);
@@ -1011,7 +1011,7 @@ void LpCVT::init_caches(VoronoiElement element,int p){
 	drho_dx_cache[i] = (-p-3)*rho_cache[i]*element.get_dh_dx()/element.get_h(u,v,w);
 	drho_dy_cache[i] = (-p-3)*rho_cache[i]*element.get_dh_dy()/element.get_h(u,v,w);
 	drho_dz_cache[i] = (-p-3)*rho_cache[i]*element.get_dh_dz()/element.get_h(u,v,w);
-  }	
+  }
 }
 
 double LpCVT::F(VoronoiElement element,int p){
@@ -1452,8 +1452,8 @@ void LpSmoother::improve_model(){
   GModel* model = GModel::current();
   GModel::riter it;
 
-  Frame_field::init_model();	
-	
+  Frame_field::init_model();
+
   for(it=model->firstRegion();it!=model->lastRegion();it++)
   {
     gr = *it;
@@ -1461,14 +1461,14 @@ void LpSmoother::improve_model(){
 	  improve_region(gr);
 	}
   }
-	
+
   Frame_field::clear();
 }
 
 void LpSmoother::improve_region(GRegion* gr)
 {
 #if defined(HAVE_BFGS)
-  int i;
+  unsigned int i;
   int offset;
   double epsg;
   double epsf;
diff --git a/Mesh/QuadTriExtruded2D.cpp b/Mesh/QuadTriExtruded2D.cpp
index 374b8f5c5482b98894001663cd0ce092525b3a04..c154e95537f0424de17e142c43f022e2e8436955 100644
--- a/Mesh/QuadTriExtruded2D.cpp
+++ b/Mesh/QuadTriExtruded2D.cpp
@@ -1,16 +1,16 @@
-/************************************************************************************************** 
+/**************************************************************************************************
 QuadTriExtruded2D.cpp
 
 The code in this file was written by Dr. Trevor S. Strickler.
-email: <trevor.strickler@gmail.com> 
+email: <trevor.strickler@gmail.com>
 
 This file is part of the QuadTri contribution to Gmsh. QuadTri allows the conformal interface
-of quadrangle faces to triangle faces using pyramids and other mesh elements. 
+of quadrangle faces to triangle faces using pyramids and other mesh elements.
 
 See READMEQUADTRI.txt for more information. The license information is in LICENSE.txt.
 
-Trevor S. Strickler hereby transfers copyright of QuadTri files to 
-Christophe Geuzaine and J.-F. Remacle with the understanding that 
+Trevor S. Strickler hereby transfers copyright of QuadTri files to
+Christophe Geuzaine and J.-F. Remacle with the understanding that
 his contribution shall be cited appropriately.
 
 All reused or original Gmsh code is Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
@@ -21,8 +21,8 @@ Gmsh bugs and problems to <gmsh@geuz.org>.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License, Version 2,
-as published by the Free Software Foundation, or (at your option) 
-any later version, with or without the exception given in the 
+as published by the Free Software Foundation, or (at your option)
+any later version, with or without the exception given in the
 LICENSE.txt file supplied with this code and with Gmsh.
 
 This program is distributed in the hope that it will be useful,
@@ -34,29 +34,20 @@ GNU General Public License for more details.
 
 #include "QuadTriExtruded2D.h"
 
-// By Geuzaine, Remacle... 
+// By Geuzaine, Remacle...
 static void addTriangle(MVertex* v1, MVertex* v2, MVertex* v3,
-                        GFace *to, MElement* source) 
+                        GFace *to, MElement* source)
 {
   MTriangle* newTri = new MTriangle(v1, v2, v3);
   to->triangles.push_back(newTri);
 }
 
-// By Geuzaine, Remacle... 
-static void addQuadrangle(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4,
-                          GFace *to, MElement* source) 
-{
-  MQuadrangle* newQuad = new MQuadrangle(v1, v2, v3, v4);
-  to->quadrangles.push_back(newQuad);
-}
-
-
-// The function that tests whether a 2D surface is a lateral of a valid QuadToTri 
-// region and whether there are conflicts. If surface is not part of valid QuadToTri region 
-// or if there are QuadToTri conflicts, return 0.  Note that RemoveDuplicateSurfaces() 
+// The function that tests whether a 2D surface is a lateral of a valid QuadToTri
+// region and whether there are conflicts. If surface is not part of valid QuadToTri region
+// or if there are QuadToTri conflicts, return 0.  Note that RemoveDuplicateSurfaces()
 // makes this DIFFICULT. Also, the tri_quad_flag determins whether the surface
 // should be meshed with triangles or quadrangles:
-// tri_quad_values: 0 = no override, 1 = mesh as quads, 2 = mesh as triangles. 
+// tri_quad_values: 0 = no override, 1 = mesh as quads, 2 = mesh as triangles.
 // Added 2010-12-09.
 int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToTriLateral )
 {
@@ -69,30 +60,30 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
   ExtrudeParams *ep = face->meshAttributes.extrude;
 
   if( !ep || !ep->mesh.ExtrudeMesh || !ep->geo.Mode == EXTRUDED_ENTITY ){
-    Msg::Error("In IsValidQuadToTriLateral(), face %d is not a structured extrusion.", 
+    Msg::Error("In IsValidQuadToTriLateral(), face %d is not a structured extrusion.",
                face->tag() );
     return 0;
   }
-  
+
   GEdge *face_source = model->getEdgeByTag( std::abs( ep->geo.Source ) );
   if( !face_source ){
-    Msg::Error("In IsValidQuadToTriLateral(), face %d has no source edge.", 
+    Msg::Error("In IsValidQuadToTriLateral(), face %d has no source edge.",
                face->tag() );
   }
 
-  // It seems the member pointers to neighboring regions for extruded lateral faces are not set.  
+  // It seems the member pointers to neighboring regions for extruded lateral faces are not set.
   // For now, have to loop through
   // ALL the regions to see if the presently considered face belongs to the region and if
   // any neighboring region is QUADTRI.
-  // The following loop will find all the regions that the face bounds, and determine 
-  // whether the face is a lateral of the region (including whether the region is even extruded).  
-  // After that information is determined, function can test for QuadToTri neighbor conflicts.  
+  // The following loop will find all the regions that the face bounds, and determine
+  // whether the face is a lateral of the region (including whether the region is even extruded).
+  // After that information is determined, function can test for QuadToTri neighbor conflicts.
 
   std::vector<GRegion *> lateral_regions;
   std::vector<GRegion *> adjacent_regions;
   int numRegions = 0;
   int numLateralRegions = 0;
-  
+
   numRegions = GetNeighborRegionsOfFace(face, adjacent_regions);
   for( int i_reg = 0; i_reg < numRegions; i_reg++ ){
     GRegion *region = adjacent_regions[i_reg];
@@ -100,11 +91,11 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
     // is region in the current model's region's or is it deleted?
     if( !FindVolume( ( region->tag() ) ) )
       continue;
-   
+
     // is the region mesh extruded?
     if( !region->meshAttributes.extrude ||
         ( region->meshAttributes.extrude &&
-          !region->meshAttributes.extrude->mesh.ExtrudeMesh ) ) 
+          !region->meshAttributes.extrude->mesh.ExtrudeMesh ) )
       continue;
     if( region->meshAttributes.extrude->geo.Mode != EXTRUDED_ENTITY )
       continue;
@@ -116,9 +107,9 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
       if( region->meshAttributes.extrude->mesh.QuadToTri )
         (*detectQuadToTriLateral) = true;
     }
- 
+
   }
- 
+
   // MAIN test of whether this is even a quadToTri extrusion lateral
   // the only return 0 path that is NOT an error
   if( !(*detectQuadToTriLateral) )
@@ -134,20 +125,20 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
 
   bool detect_conflict = false;
 
-  
+
   // Set the tri_quad_flag that lets extrudeMesh override ep->Recombine;
   // tri_quad_values: 0 = no override, 1 = mesh as quads, 2 = mesh as triangles.
-    
+
   // if this face is a free surface:
-  if( adjacent_regions.size() == 1 ){ 
+  if( adjacent_regions.size() == 1 ){
     if( lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_SNGL_1_RECOMB ||
         lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_DBL_1_RECOMB )
       (*tri_quad_flag) = 1;
     else if( lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_SNGL_1 ||
              lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_DBL_1 )
       (*tri_quad_flag) = 2;
-    else 
-      (*tri_quad_flag) = 0;  
+    else
+      (*tri_quad_flag) = 0;
   }
   else if( adjacent_regions.size() > 1 ){
     GRegion *adj_region = NULL;
@@ -157,10 +148,10 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
     else
       adj_region = adjacent_regions[0];
     adj_ep = adj_region->meshAttributes.extrude;
-    
+
     // if Neighbor is Transfinite, go with the default, non-QuadTri recombine for this surface
     if( adj_region && adj_region->meshAttributes.Method == MESH_TRANSFINITE )
-       (*tri_quad_flag) = 0;  
+       (*tri_quad_flag) = 0;
     // if a neighbor
     // has no extrusion structure,
     // don't even consider QuadToTri Recomb on this face.
@@ -168,16 +159,16 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
       (*tri_quad_flag) = 2;
     // This face is the source face of a second
     // neighboring extrusion.
-    else if( adj_ep && adj_ep->mesh.ExtrudeMesh && 
-             model->getFaceByTag( std::abs( adj_ep->geo.Source ) ) == face ){ 
+    else if( adj_ep && adj_ep->mesh.ExtrudeMesh &&
+             model->getFaceByTag( std::abs( adj_ep->geo.Source ) ) == face ){
       if( lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_SNGL_1_RECOMB ||
           lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_DBL_1_RECOMB )
         (*tri_quad_flag) = 1;
       else if( lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_SNGL_1 ||
                lateral_regions[0]->meshAttributes.extrude->mesh.QuadToTri == QUADTRI_DBL_1 )
         (*tri_quad_flag) = 2;
-      else 
-        (*tri_quad_flag) = 0;  
+      else
+        (*tri_quad_flag) = 0;
     }
     // if both neighbors are structured but none of the previous apply:
     else if( adj_ep && adj_ep->mesh.ExtrudeMesh ){
@@ -194,13 +185,13 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
       else if( ep->mesh.QuadToTri == QUADTRI_DBL_1_RECOMB ||
                adj_ep && adj_ep->mesh.QuadToTri == QUADTRI_DBL_1_RECOMB )
         (*tri_quad_flag) = 1;
-      else 
+      else
         (*tri_quad_flag) = 2;
     }
     // any other adjacent surface, just default to the QuadToTri region's non-QuadToTri
     // default recombination method.  Any mistakes at this point are not this feature's.
-    else      
-      (*tri_quad_flag) = 0;  
+    else
+      (*tri_quad_flag) = 0;
   }
   // if this executes, there's a mistake here :
   else{
@@ -218,9 +209,9 @@ int IsValidQuadToTriLateral(GFace *face, int *tri_quad_flag, bool *detectQuadToT
 
 
 // The function that tests whether a surface is a QuadToTri top surface and whether
-// there are conflicts. If surface is not a top for a valid QuadToTri region or if 
-// there are QuadToTri conflicts, return 0.  Note that RemoveDuplicateSurfaces() 
-// makes this DIFFICULT. Also, the type of QuadToTri interface is placed into the 
+// there are conflicts. If surface is not a top for a valid QuadToTri region or if
+// there are QuadToTri conflicts, return 0.  Note that RemoveDuplicateSurfaces()
+// makes this DIFFICULT. Also, the type of QuadToTri interface is placed into the
 // pointer argument quadToTri. .
 // Added 2010-12-09.
 int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop)
@@ -230,35 +221,35 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop)
 
   GModel *model = face->model();
 
-  // It seems the member pointers to neighboring regions for extruded top faces are not set.  
+  // It seems the member pointers to neighboring regions for extruded top faces are not set.
   // For now, have to loop through
   // ALL the regions to see if the presently considered face belongs to the region.
-  // The following loop will find all the regions that the face bounds, and determine 
-  // whether the face is a top face of the region (including whether the region is even extruded).  
-  // After that information is determined, function can test for QuadToTri neighbor conflicts.  
+  // The following loop will find all the regions that the face bounds, and determine
+  // whether the face is a top face of the region (including whether the region is even extruded).
+  // After that information is determined, function can test for QuadToTri neighbor conflicts.
 
   std::vector<GRegion *> top_regions;
   std::vector<GRegion *> adjacent_regions;
   std::vector<GRegion *> all_regions;
   int numRegions = 0;
   int numTopRegions = 0;
-  
+
   std::set<GRegion *, GEntityLessThan>::iterator itreg;
   for( itreg = model->firstRegion(); itreg != model->lastRegion(); itreg++ )
     all_regions.push_back( (*itreg) );
 
-  for( int i_reg = 0; i_reg < all_regions.size(); i_reg++ ){
-  
+  for(unsigned int i_reg = 0; i_reg < all_regions.size(); i_reg++ ){
+
     // save time
     if( numRegions >= 2 )
       break;
-  
+
     GRegion *region = all_regions[i_reg];
 
     // is region in the current model's regions or is it deleted?
     if( !FindVolume( ( region->tag() ) ) )
       continue;
-   
+
     // does face belong to region?
     std::list<GFace *> region_faces = std::list<GFace *>( region->faces() );
     if( std::find( region_faces.begin(), region_faces.end(), face ) !=
@@ -282,41 +273,41 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop)
       if( region->meshAttributes.extrude->mesh.QuadToTri )
         (*detectQuadToTriTop) = true;
     }
- 
+
   }
- 
+
   // MAIN test of whether this is even a quadToTri extrusion lateral
   // the only return 0 path that is NOT an error
   if( !(*detectQuadToTriTop) )
     return 0;
 
-  
+
 
   ExtrudeParams *ep = face->meshAttributes.extrude;
 
   if(!ep){
-    Msg::Error("In IsValidQuadToTriTop(), no extrude info for surface %d.",  
+    Msg::Error("In IsValidQuadToTriTop(), no extrude info for surface %d.",
                face->tag() );
     return 0;
   }
 
   if( ep->geo.Mode != COPIED_ENTITY){
-    Msg::Error("In IsValidQuadToTriTop(), surface %d is not copied from source.",  
+    Msg::Error("In IsValidQuadToTriTop(), surface %d is not copied from source.",
                face->tag() );
     return 0;
   }
 
   if( ep->mesh.QuadToTri == 0){
     Msg::Error("In IsValidQuadToTriTop(), surface %d was determined to be the top surface "
-               "for a QuadToTri extrusion, but does not have QuadToTri parameters set within itself.",  
+               "for a QuadToTri extrusion, but does not have QuadToTri parameters set within itself.",
                face->tag() );
     return 0;
   }
 
   GFace *face_source = model->getFaceByTag(std::abs(ep->geo.Source));
   if(!face_source){
-    Msg::Error("In IsValidQuadToTriTop(), unknown source face number %d.", 
-                 face->meshAttributes.extrude->geo.Source); 
+    Msg::Error("In IsValidQuadToTriTop(), unknown source face number %d.",
+                 face->meshAttributes.extrude->geo.Source);
     return 0;
   }
 
@@ -346,7 +337,7 @@ int IsValidQuadToTriTop(GFace *face, int *quadToTri, bool *detectQuadToTriTop)
 // this function specifically meshes a quadToTri top in an unstructured way
 // return 1 if success, return 0 if failed.
 // Added 2010-12-20
-static int MeshQuadToTriTopUnstructured(GFace *from, GFace *to, 
+static int MeshQuadToTriTopUnstructured(GFace *from, GFace *to,
                                    std::set<MVertex*, MVertexLessThanLexicographic> &pos)
 {
 
@@ -356,18 +347,18 @@ static int MeshQuadToTriTopUnstructured(GFace *from, GFace *to,
 
   if( !to->meshAttributes.extrude || !to->meshAttributes.extrude->mesh.QuadToTri  )
     return 0;
-   
-  
+
+
   // in weird case of NO quads and NO tri
   if( !from->triangles.size() && !from->quadrangles.size() )
     return 0;
 
- 
+
   // make set of source edge vertices
   std::set<MVertex*, MVertexLessThanLexicographic> pos_src_edge;
   QuadToTriInsertFaceEdgeVertices(from, pos_src_edge);
 
-  // Loop through all the quads and make the triangles with diagonals running 
+  // Loop through all the quads and make the triangles with diagonals running
   // in a selected direction.
 
   to->triangles.reserve(to->triangles.size()+from->quadrangles.size()*2);
@@ -399,12 +390,12 @@ static int MeshQuadToTriTopUnstructured(GFace *from, GFace *to,
     if( verts.size() != 4 ){
       Msg::Error("During mesh of QuadToTri surface %d, %d vertices found "
                  "in quad of source surface %d.", to->tag(), verts.size(),
-                 from->tag() ); 
+                 from->tag() );
       return 0;
     }
 
     // make the element
-    MElement *element = from->quadrangles[i];  
+    MElement *element = from->quadrangles[i];
 
     // draw other diagonals to minimize difference in average edge length with diagonal length, in quadrature
 
@@ -417,12 +408,12 @@ static int MeshQuadToTriTopUnstructured(GFace *from, GFace *to,
 
     double d1 = verts[0]->distance(verts[2]);
     double d2 = verts[1]->distance(verts[3]);
-    
-    if(fabs(d1*d1-mag_sq_ave) <= fabs(d2*d2-mag_sq_ave) ){ 
+
+    if(fabs(d1*d1-mag_sq_ave) <= fabs(d2*d2-mag_sq_ave) ){
       addTriangle(verts[0],verts[1],verts[2],to,element);
       addTriangle(verts[0],verts[2],verts[3],to,element);
     }
-    else{ 
+    else{
       addTriangle(verts[1],verts[2],verts[3],to,element);
       addTriangle(verts[1],verts[3],verts[0],to,element);
     }
@@ -432,37 +423,31 @@ static int MeshQuadToTriTopUnstructured(GFace *from, GFace *to,
 }
 
 
-// This function meshes the top surface of a QuadToTri extrusion.  It returns 0 if it is given a 
-// non-quadToTri extrusion or if it fails.  
-// Args: 
-//       'GFace *to' is the top surface to mesh, 'from' is the source surface, 'pos' is a std::set  
+// This function meshes the top surface of a QuadToTri extrusion.  It returns 0 if it is given a
+// non-quadToTri extrusion or if it fails.
+// Args:
+//       'GFace *to' is the top surface to mesh, 'from' is the source surface, 'pos' is a std::set
 //       of vertex positions for the top surface.
-int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*, 
+int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
                              MVertexLessThanLexicographic> &pos)
 {
   if( !to->meshAttributes.extrude || !to->meshAttributes.extrude->mesh.QuadToTri  )
     return 0;
-   
+
   // if the source is all triangles, then just let this function is not needed. Return 1.
   if( from->triangles.size() && !from->quadrangles.size() )
     return 1;
-  
+
   // in weird case of NO quads and NO tri
   if( !from->triangles.size() && !from->quadrangles.size() )
     return 0;
-   
-  // record number of triangles currently in the top surface and make sure they don't change
-  // if defaulting to unstructured in either of the structured methods fail below. Otherwise, return 0.
-  unsigned int num_triangles = to->triangles.size();
-  
+
   ExtrudeParams *ep = to->meshAttributes.extrude;
   if( !ep || !ep->mesh.ExtrudeMesh || !ep->geo.Mode == COPIED_ENTITY ){
     Msg::Error("In MeshQuadToTriTopSurface(), incomplete or no "
                "extrude information for top face %d.", to->tag() );
     return 0;
-  }  
-
-  ExtrudeParams *from_ep = from->meshAttributes.extrude;
+  }
 
   // number of extrusion layers
   int num_layers = 0;
@@ -484,7 +469,7 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
     std::set<MVertex*, MVertexLessThanLexicographic> pos_src_edge;
     QuadToTriInsertFaceEdgeVertices(from, pos_src_edge);
     std::set<MVertex*, MVertexLessThanLexicographic>::iterator itp;
-     
+
     // loop through each element source quadrangle and extrude
     for(unsigned int i = 0; i < from->quadrangles.size(); i++){
       std::vector<MVertex*> verts;
@@ -513,22 +498,22 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
       if( verts.size() != 4 ){
         Msg::Error("During mesh of QuadToTri surface %d, %d vertices found "
                    "in quad of source surface %d.", to->tag(), verts.size(),
-                   from->tag() ); 
+                   from->tag() );
         return 0;
       }
 
       // make the element
-      MElement *element = from->quadrangles[i];  
- 
+      MElement *element = from->quadrangles[i];
+
       // count vertices that are on a boundary edge
       int edge_verts_count = 0;
       int skip_index = 0;
       int bnd_indices[4];
       for( int p = 0; p < element->getNumVertices(); p++ ){
         if( pos_src_edge.find( element->getVertex(p) ) != pos_src_edge.end() ){
-          edge_verts_count++; 
+          edge_verts_count++;
           bnd_indices[p] = 1;
-        }  
+        }
         else{
           skip_index = p;
           bnd_indices[p] = 0;
@@ -549,7 +534,7 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
         if( low_index < 0 ) // what if they are all degenerate?  Avoid the out-of-bounds error.
           low_index = 0;
       }
-    
+
       // lowest possible vertex pointer, regardless of if on edge or not
       else if( edge_verts_count == 4 || edge_verts_count == 0 )
         low_index = getIndexForLowestVertexPointer(verts);
@@ -557,7 +542,7 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
       addTriangle( verts[low_index],verts[(low_index+1)%verts.size()],
                    verts[(low_index+2)%verts.size()],to,element);
       addTriangle( verts[low_index],verts[(low_index+2)%verts.size()],
-                   verts[(low_index+3)%verts.size()],to,element);      
+                   verts[(low_index+3)%verts.size()],to,element);
     }
     return 1;
   }
@@ -569,14 +554,14 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
   GFace *root_source = findRootSourceFaceForFace( from );
   ExtrudeParams *ep_src = root_source->meshAttributes.extrude;
   bool struct_root = false;
-  if( root_source && 
+  if( root_source &&
       ( ep_src && ep_src->mesh.ExtrudeMesh && ep_src->geo.Mode == EXTRUDED_ENTITY ||
         root_source->meshAttributes.Method == MESH_TRANSFINITE ) )
     struct_root = true;
-  
+
   if( !struct_root && MeshQuadToTriTopUnstructured(from, to, pos) )
     return 1;
-  
+
   // And top surface for a structured double layer can be meshed quite easily
   else{
     std::set<MVertex *, MVertexLessThanLexicographic >::iterator itp;
@@ -608,14 +593,14 @@ int MeshQuadToTriTopSurface( GFace *from, GFace *to, std::set<MVertex*,
       if( verts.size() != 4 ){
         Msg::Error("During mesh of QuadToTri surface %d, %d vertices found "
                    "in quad of source surface %d.", to->tag(), verts.size(),
-                   from->tag() ); 
+                   from->tag() );
         return 0;
       }
-      
+
       // make the element
-      MElement *element = from->quadrangles[i];  
+      MElement *element = from->quadrangles[i];
       addTriangle( verts[0],verts[2], verts[3],to,element);
-      addTriangle( verts[0],verts[1], verts[2],to,element);      
+      addTriangle( verts[0],verts[1], verts[2],to,element);
     }
     return 1;
   }
diff --git a/Mesh/QuadTriTransfinite3D.cpp b/Mesh/QuadTriTransfinite3D.cpp
index 8d9afe5f5e50177ba57723c98f68b06fd2c3c264..291c5cc9d1aa579eafdd5f8ef10f71c16cfb474a 100644
--- a/Mesh/QuadTriTransfinite3D.cpp
+++ b/Mesh/QuadTriTransfinite3D.cpp
@@ -1,16 +1,16 @@
-/************************************************************************************************** 
+/**************************************************************************************************
 QuadTriTransfinite3D.cpp
 
 The code in this file was written by Dr. Trevor S. Strickler.
-email: <trevor.strickler@gmail.com> 
+email: <trevor.strickler@gmail.com>
 
 This file is part of the QuadTri contribution to Gmsh. QuadTri allows the conformal interface
-of quadrangle faces to triangle faces using pyramids and other mesh elements. 
+of quadrangle faces to triangle faces using pyramids and other mesh elements.
 
 See READMEQUADTRI.txt for more information. The license information is in LICENSE.txt.
 
-Trevor S. Strickler hereby transfers copyright of QuadTri files to 
-Christophe Geuzaine and J.-F. Remacle with the understanding that 
+Trevor S. Strickler hereby transfers copyright of QuadTri files to
+Christophe Geuzaine and J.-F. Remacle with the understanding that
 his contribution shall be cited appropriately.
 
 All reused or original Gmsh code is Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
@@ -21,8 +21,8 @@ Gmsh bugs and problems to <gmsh@geuz.org>.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License, Version 2,
-as published by the Free Software Foundation, or (at your option) 
-any later version, with or without the exception given in the 
+as published by the Free Software Foundation, or (at your option)
+any later version, with or without the exception given in the
 LICENSE.txt file supplied with this code and with Gmsh.
 
 This program is distributed in the hope that it will be useful,
@@ -35,7 +35,7 @@ GNU General Public License for more details.
 #include "QuadTriTransfinite3D.h"
 
 // Does the pair of MVertex pointers v1 and v2 exist in the set 'edges'?
-static int edgeExists(MVertex *v1, MVertex *v2, 
+static int edgeExists(MVertex *v1, MVertex *v2,
                       std::set<std::pair<MVertex*, MVertex*> > &edges)
 {
   std::pair<MVertex*, MVertex*> p(std::min(v1, v2), std::max(v1, v2));
@@ -44,7 +44,7 @@ static int edgeExists(MVertex *v1, MVertex *v2,
 
 
 // Create the pair of MVertex pointers v1 and v2 exist in the set 'edges.'
-static void createEdge(MVertex *v1, MVertex *v2, 
+static void createEdge(MVertex *v1, MVertex *v2,
                        std::set<std::pair<MVertex*, MVertex*> > &edges)
 {
   std::pair<MVertex*, MVertex*> p(std::min(v1, v2), std::max(v1, v2));
@@ -52,7 +52,7 @@ static void createEdge(MVertex *v1, MVertex *v2,
 }
 
 
-static void addTetrahedron(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4, 
+static void addTetrahedron(MVertex* v1, MVertex* v2, MVertex* v3, MVertex* v4,
                            GRegion *to)
 {
   MTetrahedron* newElem = new MTetrahedron(v1, v2, v3, v4);
@@ -98,7 +98,7 @@ int getTransfiniteBoundaryDiags( GRegion *gr, std::set< std::pair<MVertex*,
                 "to be a transfinite volume", gr->tag() );
     return 0;
   }
-  
+
   // Found right number of faces?
   if( faces.size() != 5 && faces.size() != 6 ){
     Msg::Error( "In getTransfiniteBoundaryDiags(), number of faces does not equal "
@@ -120,9 +120,9 @@ int getTransfiniteBoundaryDiags( GRegion *gr, std::set< std::pair<MVertex*,
       return 0;
     }
   }
-    
-  
-  // Now loop through all surfaces checking for unrecombined faces. On 3-sided surfaces, skip the 
+
+
+  // Now loop through all surfaces checking for unrecombined faces. On 3-sided surfaces, skip the
   // first layer of triangles because they ALWAYS exist even for recombined faces.
   for( itf = faces.begin(); itf != faces.end(); itf++ ){
     if( (*itf)->quadrangles.size() )
@@ -139,18 +139,18 @@ int getTransfiniteBoundaryDiags( GRegion *gr, std::set< std::pair<MVertex*,
       index_guess += (*itf)->transfinite_vertices[1].size()-1;
       i_low = 1;
     }
- 
-    for( int i = i_low; i < (*itf)->transfinite_vertices.size()-1; i++ ){
-      for( int j = 0; j < (*itf)->transfinite_vertices[i].size()-1; j++ ){
+
+    for(unsigned int i = i_low; i < (*itf)->transfinite_vertices.size()-1; i++ ){
+      for(unsigned int j = 0; j < (*itf)->transfinite_vertices[i].size()-1; j++ ){
         std::vector<MVertex*> verts;
         verts.resize(4);
         verts[0] = (*itf)->transfinite_vertices[i][j];
         verts[1] = (*itf)->transfinite_vertices[i+1][j];
         verts[2] = (*itf)->transfinite_vertices[i+1][j+1];
         verts[3] = (*itf)->transfinite_vertices[i][j+1];
-        std::pair<int,int> ind_pair = FindDiagonalEdgeIndices( verts, (*itf), 
+        std::pair<int,int> ind_pair = FindDiagonalEdgeIndices( verts, (*itf),
                                                                0, index_guess );
-        createEdge( verts[ind_pair.first], verts[ind_pair.second], (*boundary_diags) );         
+        createEdge( verts[ind_pair.first], verts[ind_pair.second], (*boundary_diags) );
         index_guess += 2;
       }
     }
@@ -161,12 +161,12 @@ int getTransfiniteBoundaryDiags( GRegion *gr, std::set< std::pair<MVertex*,
 } // End of getTransfiniteBoundaryDiags()
 
 
-// Meshes either a prism or a hexahedral set of mesh vertices in a Transfinite Region with an internal vertex 
+// Meshes either a prism or a hexahedral set of mesh vertices in a Transfinite Region with an internal vertex
 // that is created here in the function.
-void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v, 
+void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v,
                                        std::set< std::pair<MVertex*, MVertex*> > *boundary_diags )
 {
-    
+
   int v_size = v.size();
   int n_lat_tmp;
   if( v_size == 6 )
@@ -180,7 +180,7 @@ void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v,
 
   const int n_lat = n_lat_tmp;
 
-  
+
   // find vertex node indices for diagonalized faces
   std::vector<int> n1, n2;
   bool found_diags = false;
@@ -204,7 +204,7 @@ void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v,
       else if( edgeExists( v[p], v[(p+1)%n_lat+n_lat], (*boundary_diags) ) ){
         n1[p] = p; n2[p] = (p+1)%n_lat+n_lat;
         found_diags = true;
-      } 
+      }
       else if( edgeExists( v[p+n_lat], v[(p+1)%n_lat], (*boundary_diags) ) ){
         n1[p] = p+n_lat; n2[p] = (p+1)%n_lat;
         found_diags = true;
@@ -215,7 +215,7 @@ void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v,
       if( edgeExists( v[add], v[add+2], (*boundary_diags) ) ){
         n1[p] = add; n2[p] = add+2;
         found_diags = true;
-      } 
+      }
       else if( edgeExists( v[add+1], v[add+3], (*boundary_diags) ) ){
         n1[p] = add+1; n2[p] = add+3;
         found_diags = true;
@@ -224,7 +224,7 @@ void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v,
   }
 
 
- 
+
   if( !found_diags ){
     if( n_lat == 3 )
       addPrism( v[0], v[1], v[2], v[3], v[4], v[5], gr );
@@ -240,46 +240,46 @@ void meshTransfElemWithInternalVertex( GRegion *gr, std::vector<MVertex *> v,
 
   // build all pyramids/tetra
   for( int p = 0; p < n_lat; p++ ){
-    int p2 = (p+1)%n_lat; 
+    int p2 = (p+1)%n_lat;
     if( v[p] == v[p+n_lat] && v[p2] == v[p2+n_lat] )
       continue;
     else if( v[p] == v[p+n_lat] || v[p2] == v[p2+n_lat] ){
       MVertex *v_dup = (v[p] == v[p+n_lat]) ? v[p] : v[p2];
       MVertex *v_non_dup = (v_dup == v[p]) ? v[p2] : v[p];
-      MVertex *v_non_dup2 = (v_non_dup == v[p]) ? v[p+n_lat] : v[p2+n_lat]; 
-      addTetrahedron( v_dup, v_non_dup, v_non_dup2, v_int, gr);  
+      MVertex *v_non_dup2 = (v_non_dup == v[p]) ? v[p+n_lat] : v[p2+n_lat];
+      addTetrahedron( v_dup, v_non_dup, v_non_dup2, v_int, gr);
     }
     else if( n1[p] == p || n2[p] == p ){
-      addTetrahedron( v[p], v[p2], v[p2+n_lat], v_int, gr );  
-      addTetrahedron( v[p], v[p2+n_lat], v[p+n_lat], v_int, gr );  
+      addTetrahedron( v[p], v[p2], v[p2+n_lat], v_int, gr );
+      addTetrahedron( v[p], v[p2+n_lat], v[p+n_lat], v_int, gr );
+    }
+    else if( n1[p] == p+n_lat || n2[p] == p+n_lat ){
+      addTetrahedron( v[p], v[p2], v[p+n_lat], v_int, gr );
+      addTetrahedron( v[p2], v[p2+n_lat], v[p+n_lat], v_int, gr );
     }
-    else if( n1[p] == p+n_lat || n2[p] == p+n_lat ){  
-      addTetrahedron( v[p], v[p2], v[p+n_lat], v_int, gr );  
-      addTetrahedron( v[p2], v[p2+n_lat], v[p+n_lat], v_int, gr );  
-    }  
     else
       addPyramid( v[p], v[p2], v[p2+n_lat], v[p+n_lat], v_int, gr );
   }
 
   if( n_lat == 3){
     // bottom and top
-    addTetrahedron( v[0], v[1], v[2], v_int, gr );   
+    addTetrahedron( v[0], v[1], v[2], v_int, gr );
     addTetrahedron( v[3], v[5], v[4], v_int, gr );
   }
   else if( n_lat == 4 ){
     for( int p = 4; p < 6; p++ ){
       int add = (p == 4) ? 0 : 4;
       if( n1[p] == 0+add || n2[p] == 0+add  ){
-        addTetrahedron( v[add], v[1+add], v[2+add], v_int, gr );  
-        addTetrahedron( v[add], v[2+add], v[3+add], v_int, gr );  
+        addTetrahedron( v[add], v[1+add], v[2+add], v_int, gr );
+        addTetrahedron( v[add], v[2+add], v[3+add], v_int, gr );
+      }
+      else if( n1[p] == 1+add || n2[p] == 1+add ){
+        addTetrahedron( v[1+add], v[2+add], v[3+add], v_int, gr );
+        addTetrahedron( v[1+add], v[3+add], v[add], v_int, gr );
       }
-      else if( n1[p] == 1+add || n2[p] == 1+add ){  
-        addTetrahedron( v[1+add], v[2+add], v[3+add], v_int, gr );  
-        addTetrahedron( v[1+add], v[3+add], v[add], v_int, gr );  
-      }  
       else
         addPyramid( v[add], v[1+add], v[2+add], v[3+add], v_int, gr );
     }
-  } 
+  }
 
 } // End of meshTransfiniteWithInternalVertex()
diff --git a/Mesh/QuadTriUtils.cpp b/Mesh/QuadTriUtils.cpp
index ecad255dffbde9e16a47b9c5e29d4f9c66fca8e3..070b40d06a1fbbae9749f5bf2c1a95723aa17626 100644
--- a/Mesh/QuadTriUtils.cpp
+++ b/Mesh/QuadTriUtils.cpp
@@ -1,16 +1,16 @@
-/************************************************************************************************** 
+/**************************************************************************************************
 QuadTriUtils.cpp
 
 The code in this file was written by Dr. Trevor S. Strickler.
-email: <trevor.strickler@gmail.com> 
+email: <trevor.strickler@gmail.com>
 
 This file is part of the QuadTri contribution to Gmsh. QuadTri allows the conformal interface
-of quadrangle faces to triangle faces using pyramids and other mesh elements. 
+of quadrangle faces to triangle faces using pyramids and other mesh elements.
 
 See READMEQUADTRI.txt for more information. The license information is in LICENSE.txt.
 
-Trevor S. Strickler hereby transfers copyright of QuadTri files to 
-Christophe Geuzaine and J.-F. Remacle with the understanding that 
+Trevor S. Strickler hereby transfers copyright of QuadTri files to
+Christophe Geuzaine and J.-F. Remacle with the understanding that
 his contribution shall be cited appropriately.
 
 All reused or original Gmsh code is Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
@@ -21,8 +21,8 @@ Gmsh bugs and problems to <gmsh@geuz.org>.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License, Version 2,
-as published by the Free Software Foundation, or (at your option) 
-any later version, with or without the exception given in the 
+as published by the Free Software Foundation, or (at your option)
+any later version, with or without the exception given in the
 LICENSE.txt file supplied with this code and with Gmsh.
 
 This program is distributed in the hope that it will be useful,
@@ -56,22 +56,22 @@ ExtrusionElementMap::addExtrudedElemVector(MElement* source, std::vector<MElemen
     vec->reserve( new_cap );
     vec->insert( vec->end(), extrudedVector->begin(), extrudedVector->end());
   }
-  
+
 }*/
 
 // Insert all vertices on a region's source edge, including corners,
 // into pos_src_edge set.
 // Added 2010-01-09
-void QuadToTriInsertSourceEdgeVertices(GRegion *gr, 
+void QuadToTriInsertSourceEdgeVertices(GRegion *gr,
                               std::set<MVertex*, MVertexLessThanLexicographic> &pos_src_edge)
 {
   ExtrudeParams *ep = gr->meshAttributes.extrude;
   if(!ep || !ep->mesh.ExtrudeMesh || ep->geo.Mode != EXTRUDED_ENTITY){
     Msg::Error("In QuadToTriInsertSourceEdgeVertices(), incomplete or no "
-               "extrude info for region %d.", gr->tag() ); 
+               "extrude info for region %d.", gr->tag() );
     return;
-  }     
-   
+  }
+
 
   GFace *source_face = gr->model()->getFaceByTag( std::abs(ep->geo.Source) );
 
@@ -89,10 +89,10 @@ void QuadToTriInsertSourceEdgeVertices(GRegion *gr,
 // Insert all vertices on a faces edges, including corners,
 // into pos_edges set.
 // Added 2010-01-18
-void QuadToTriInsertFaceEdgeVertices(GFace *face, 
+void QuadToTriInsertFaceEdgeVertices(GFace *face,
                               std::set<MVertex*, MVertexLessThanLexicographic> &pos_edges)
 {
-   
+
 
   std::list<GEdge*> edges = face->edges();
   std::list<GEdge*>::iterator ite = edges.begin();
@@ -108,8 +108,8 @@ void QuadToTriInsertFaceEdgeVertices(GFace *face,
 
 
 // Constructor for the CategorizedSourceElements structure.
-// See definition of CategorizedSourceElements in QuadTriUtils.h 
-// file for details.  
+// See definition of CategorizedSourceElements in QuadTriUtils.h
+// file for details.
 CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
 {
   region = (GRegion*)(NULL);
@@ -117,7 +117,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
   valid = false;
 
   ExtrudeParams *ep = gr->meshAttributes.extrude;
-  
+
   if( !ep || !ep->mesh.QuadToTri || !ep->mesh.ExtrudeMesh ){
     Msg::Error("In CategorizedSourceElements constructor, invalid extrusion "
                "in region %d for performing QuadToTri mesh generation.",
@@ -128,7 +128,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
   GModel *model = gr->model();
   if( !model ){
     Msg::Error("In CategorizedSourceElements constructor, invalid model for region "
-               "%d.", gr->tag() ); 
+               "%d.", gr->tag() );
     return;
   }
 
@@ -181,7 +181,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
       int bnd_count = 0;
       int bnd_vert = 0;
       // get the boundary vert bool values
-      for( int k = 0; k < elem_size; k++ ){   
+      for( int k = 0; k < elem_size; k++ ){
         if( bnd_verts.find(elem_verts[k]) != bnd_verts.end() ){
           if( !t ) tri_bool[4*i+k+1] = true;
           else     quad_bool[5*i+k+1] = true;
@@ -193,7 +193,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
         if( !t ) tri_bool[4*i] = true;
         else     quad_bool[5*i] = true;
       }
-   
+
       // Place element vector indices into appropriate set
       if( !bnd_count )
         (!t) ? internal_tri.insert(i) : internal_quad.insert(i);
@@ -203,15 +203,15 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
       else if( bnd_count == 3 && !t || bnd_count == 4 ){
         (!t) ? three_bnd_pt_tri.insert(i) : four_bnd_pt_quad.insert(i);
       }
-        
+
       // if a one boundary point quad, record it in one_pt_quads set
       if( t && bnd_count == 1 ){
         one_pt_quad_pivots.insert(elem_verts[(bnd_vert+2)%4]);
       }
-    }  
+    }
   }
 
-  // If there were one_bnd_pt_quads, go through the search for all elements 
+  // If there were one_bnd_pt_quads, go through the search for all elements
   //  touching at pivot index that are either internal or two bnd point quads.
   // This would take awhile if had to do this for every element (n^2). Fortunately,
   // such elements are NOT typical at all.
@@ -240,7 +240,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
         // for t == s == 1 (other_bnd_quads), only retain those with two boundary verts
         if( s && q ){
           int bnd_count = 0;
-          for( int k = 0; k < verts.size(); k++ ){   
+          for(unsigned int k = 0; k < verts.size(); k++ ){
             if( quad_bool[5*(*it_int)+k+1] )
               bnd_count++;
           }
@@ -248,7 +248,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
             continue;
         }
 
-        // Don't eliminate the inner for loop with std::find because 
+        // Don't eliminate the inner for loop with std::find because
         // or reverse the order of the two loops.  If an element touches multiple pivots,
         // always want to find the FIRST one in the pivots set so that there is precedence
         // and no conflicts at mesh time.  Looping through the element vertices as the outer loop
@@ -256,7 +256,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
         std::set<MVertex*>::iterator it_piv;
         bool found = false;
         for( it_piv = one_pt_quad_pivots.begin(); it_piv != one_pt_quad_pivots.end(); it_piv++ ){
-          for( int t = 0; t < verts.size(); t++ ){
+          for(unsigned int t = 0; t < verts.size(); t++ ){
             if( (*it_piv) == verts[t] ) {
               found = true;
               if( !s ){
@@ -280,7 +280,7 @@ CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
         }
       }
     }
-  }   
+  }
 
 } // end of CategorizedSourceElements::CategorizedSourceElements( GRegion *gr )
 
@@ -303,7 +303,7 @@ std::vector<double> QtFindVertsCentroid( std::vector<MVertex*> v )
     n_lat_tmp = 3;
   else if( v_size==8 )
     n_lat_tmp = 4;
-  
+
   const int n_lat = n_lat_tmp;
 
   double x = 0.0, y = 0.0, z = 0.0;
@@ -312,11 +312,11 @@ std::vector<double> QtFindVertsCentroid( std::vector<MVertex*> v )
     // skip degenerate vertices - 3D
     if( ( v_size == 6 || v_size == 8 ) && p > n_lat-1 && v[p] == v[p-n_lat] )
       continue;
-    // skip degenerate vertices - 2D 
+    // skip degenerate vertices - 2D
     if( ( v_size == 3 || v_size == 4 ) && v[p] == v[(p+v_size-1)%v_size]  )
-      continue; 
+      continue;
     v_count++;
-    x += v[p]->x(); y += v[p]->y(); z += v[p]->z(); 
+    x += v[p]->x(); y += v[p]->y(); z += v[p]->z();
   }
   x /= v_count; y /= v_count; z /= v_count;
 
@@ -324,14 +324,14 @@ std::vector<double> QtFindVertsCentroid( std::vector<MVertex*> v )
   v_return.push_back(x);
   v_return.push_back(y);
   v_return.push_back(z);
- 
+
   return v_return;
 
 }
 
 // Add a new vertex at the centroid of a vector of vertices (this goes into a region
 // Added 2010-02-06
-MVertex* QtMakeCentroidVertex( std::vector<MVertex*> v, std::vector<MVertex*> *target, 
+MVertex* QtMakeCentroidVertex( std::vector<MVertex*> v, std::vector<MVertex*> *target,
                              GEntity *entity, std::set<MVertex*, MVertexLessThanLexicographic> &pos )
 {
 
@@ -387,8 +387,8 @@ int getIndexForLowestVertexPointer( std::vector<MVertex*> v )
 // Two possible methods:  If the 'index_guess' argument is the index of the correct triangle,
 // finding it is simple. If not, have to do a complete pedantic search.
 // Added 2010-01-26
-std::pair<int, int> FindDiagonalEdgeIndices( std::vector<MVertex*> verts, 
-                                                           GFace *face, bool lateral, 
+std::pair<int, int> FindDiagonalEdgeIndices( std::vector<MVertex*> verts,
+                                                           GFace *face, bool lateral,
                                                            unsigned int index_guess)
 {
   if( verts.size() != 4 ){
@@ -398,13 +398,10 @@ std::pair<int, int> FindDiagonalEdgeIndices( std::vector<MVertex*> verts,
   if( !lateral ){
     MVertex *tmp = verts[2];  verts[2] = verts[3]; verts[3] = tmp;
   }
-  GModel *model = face->model();
-  ExtrudeParams *face_ep = face->meshAttributes.extrude;
-  GEdge *face_source = NULL;
 
-  int s_max = face->triangles.size();   
+  int s_max = face->triangles.size();
   MElement *elem_tmp = NULL;
-  bool wrong_guess = false; 
+  bool wrong_guess = false;
   for( int s = 0; s < s_max; s++ ){
     if( s != 0 && !wrong_guess  ){
       wrong_guess = true;
@@ -433,13 +430,13 @@ std::pair<int, int> FindDiagonalEdgeIndices( std::vector<MVertex*> verts,
           return std::pair<int,int> ( std::min(1,3), std::max(1,3) );
       }
     }
-  }   
-   
+  }
+
   Msg::Error("In FindDiagonalEdge(), could not "
-             "find a diagonal on surface %d.", 
+             "find a diagonal on surface %d.",
              face->tag() );
   return std::pair<int,int>(0,0);
-  
+
 }
 
 
@@ -461,10 +458,10 @@ int GetNeighborRegionsOfFace(GFace *face, std::vector<GRegion *> &neighbors)
     if( regions_count > 1 )
       neighbors.push_back(face->getRegion(1));
     return regions_count;
-  }   
+  }
   else
     regions_count = 0;
-    
+
   // pedantic search
   std::vector<GRegion *> all_regions;
   std::set<GRegion *, GEntityLessThan>::iterator itreg;
@@ -481,7 +478,7 @@ int GetNeighborRegionsOfFace(GFace *face, std::vector<GRegion *> &neighbors)
 
   return regions_count;
 
-}   
+}
 
 
 // Tests whether a surface is a lateral of a region
@@ -504,13 +501,13 @@ int IsSurfaceALateralForRegion(GRegion *region, GFace *face)
     face_source = model->getEdgeByTag(std::abs(ep->geo.Source));
 
   GFace *reg_source = model->getFaceByTag( std::abs(reg_ep->geo.Source) );
- 
+
   if(!reg_source){
-    Msg::Error("In IsSurfaceALateralForRegion(), unknown source surface number %d.", 
-                region->meshAttributes.extrude->geo.Source); 
+    Msg::Error("In IsSurfaceALateralForRegion(), unknown source surface number %d.",
+                region->meshAttributes.extrude->geo.Source);
     return 0;
   }
-  
+
   // if face is the region's source, return 0
   if( reg_source == face )
     return 0;
@@ -527,14 +524,14 @@ int IsSurfaceALateralForRegion(GRegion *region, GFace *face)
       reg_source == model->getFaceByTag(std::abs(ep->geo.Source)))
     return 0;
 
- // 
+ //
  // Now to prove the face is lateral, it must not be the "top" face. If
- // this face has replaced the region's original lateral through 
+ // this face has replaced the region's original lateral through
  // ReplaceDuplicateSurfaces(), then the previous test for "topness" won't
  // have signaled an error. However, this face COULD still be in the  top position.
- // So, check that the lateral shares AN edge (not the source edge, necessarily) with the 
- // region's source face.  
- // THEN, IF they share an edge, extrude all of the source GVertex positions and 
+ // So, check that the lateral shares AN edge (not the source edge, necessarily) with the
+ // region's source face.
+ // THEN, IF they share an edge, extrude all of the source GVertex positions and
  // see if they are found in this face.  IF so, then it is a top and not a lateral.
 
   std::list<GEdge*> region_source_edges = reg_source->edges();
@@ -554,7 +551,7 @@ int IsSurfaceALateralForRegion(GRegion *region, GFace *face)
         return 0;
     }
   }
- 
+
   if( !edge_found )
     return 0;
   else if( reg_ep->geo.Type == ROTATE ||
@@ -564,8 +561,8 @@ int IsSurfaceALateralForRegion(GRegion *region, GFace *face)
     face_v = face->vertices();
     source_v = reg_source->vertices();
     std::list<GVertex*>::iterator itvs;
-    double tol = 1.00e-12; 
-    double eps = fabs( tol * CTX::instance()->lc ); 
+    double tol = 1.00e-12;
+    double eps = fabs( tol * CTX::instance()->lc );
     unsigned int j_top, k_top;
     j_top = reg_ep->mesh.NbLayer-1;
     k_top = reg_ep->mesh.NbElmLayer[j_top];
@@ -598,7 +595,7 @@ int IsSurfaceALateralForRegion(GRegion *region, GFace *face)
 
 
 // Function to determine if a face is a top surface for a region.  It returns 1
-// if the face is COPIED_ENTITY with source = region's source and if face belongs to region. 
+// if the face is COPIED_ENTITY with source = region's source and if face belongs to region.
 // Otherwise, return 0 (NOTE: ReplaceDuplicateSurfaces() can remove a top surface
 // and replace it.  If that happens, this will return 0.  That is INTENDED for THIS function.
 // Added 2010-12-13
@@ -650,7 +647,7 @@ GFace* findRootSourceFaceForFace(GFace *face)
   GModel *model = face->model();
   int max_iter = model->getNumFaces();
   int iter_counter = 0;
-  ExtrudeParams *ep_iter = ep; 
+  ExtrudeParams *ep_iter = ep;
   while( iter_counter <= max_iter ){
     iter_counter++;
     source_face = model->getFaceByTag( std::abs(ep_iter->geo.Source) );
@@ -662,32 +659,32 @@ GFace* findRootSourceFaceForFace(GFace *face)
     if( !( ep_iter && ep_iter->mesh.ExtrudeMesh && ep_iter->geo.Mode == COPIED_ENTITY ) )
       return source_face;
   }
-  
+
   Msg::Error("findRootSourceFaceForFace() failed to find root source.");
   return (GFace*)(NULL);
 
 }
 
 
-// Input is vert_bnd[], which describes some 2D element: vert_bnd[i] is true if 
-// the ith vertex the element touches a lateral edge boundary of the surface the 
-// element is in. 
-// Output is touch_bnd[]: Each element of touch_bnd[] corresponds to an edge of 
+// Input is vert_bnd[], which describes some 2D element: vert_bnd[i] is true if
+// the ith vertex the element touches a lateral edge boundary of the surface the
+// element is in.
+// Output is touch_bnd[]: Each element of touch_bnd[] corresponds to an edge of
 // the element described by vert_bnd[].  Edge i of touch_bnd[] is formed by
-// vertices i and (i+1)%element_size of the element. The value of touch_bnd[i] is non-zero 
+// vertices i and (i+1)%element_size of the element. The value of touch_bnd[i] is non-zero
 // if that edge touches a boundary edge of the surface that the element is in.
 // Added 2011-03-10
 void fill_touch_bnd( int touch_bnd[], std::vector<bool> vert_bnd, int n_lat )
 {
    for(int i = 0; i < n_lat; i++ )
     touch_bnd[i] = 0;
- 
+
   for(int i = 0; i < n_lat; i++ ){
     if( vert_bnd[i] ){
       touch_bnd[i] = 1;
       touch_bnd[(i+n_lat-1)%n_lat] = 1;
     }
-  }     
+  }
 }
 
 
diff --git a/Mesh/Voronoi3D.cpp b/Mesh/Voronoi3D.cpp
index 0d3923cdfcb5729e267fa6ea44f6d3ff564c33dc..500125efe3a2177c065d18aed535ec84e74ccbda 100755
--- a/Mesh/Voronoi3D.cpp
+++ b/Mesh/Voronoi3D.cpp
@@ -2,6 +2,9 @@
 //
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
+//
+// Contributor(s):
+//   Tristan Carrier
 
 #include "Voronoi3D.h"
 #include "GModel.h"
@@ -38,7 +41,7 @@ void clip::execute(){
 }
 
 void clip::execute(GRegion* gr){
-  int i;
+  unsigned int i;
   int j;
   MElement* element;
   MVertex* vertex;
@@ -60,7 +63,7 @@ void clip::execute(GRegion* gr){
   }
 
   execute(vertices2,clipped);
-  printf("%d\n",clipped.size());
+  printf("%d\n", (int)clipped.size());
 
   std::ofstream file("cells.pos");
   file << "View \"test\" {\n";
@@ -78,10 +81,10 @@ void clip::execute(GRegion* gr){
 void clip::execute(std::vector<SPoint3>& vertices,std::vector<VoronoiElement>& clipped)
 {
 #if defined(HAVE_VORO3D)
-  int i;
-  int j;
+  unsigned int i;
+  unsigned int j;
   int start;
-  int end;
+  unsigned int end;
   int index;
   int index1;
   int index2;
diff --git a/Mesh/directions3D.cpp b/Mesh/directions3D.cpp
index 3db80556640e0befedd1510f06fabe69a697c234..65d1bd2aa9e317a810dfb0e9a240f62d36a19044 100755
--- a/Mesh/directions3D.cpp
+++ b/Mesh/directions3D.cpp
@@ -110,18 +110,18 @@ void Frame_field::init_model(){
   GModel::fiter it;
   std::map<MVertex*,Matrix>::iterator it2;
   Matrix m;
-  	
+
   field.clear();
-  random.clear();	
-	
+  random.clear();
+
   for(it=model->firstFace();it!=model->lastFace();it++)
   {
     gf = *it;
 	init_face(gf);
   }
-	
+
   duplicate = annAllocPts(field.size(),3);
-  
+
   index = 0;
   for(it2=field.begin();it2!=field.end();it2++){
 	vertex = it2->first;
@@ -138,17 +138,18 @@ void Frame_field::init_model(){
 }
 
 void Frame_field::init_face(GFace* gf){
-  int i,j;
+  unsigned int i;
+  int j;
   bool ok;
   SVector3 v1,v2,v3;
   MVertex* vertex;
   MElement* element;
   MElementOctree* octree;
   Matrix m;
-	
+
   backgroundMesh::set(gf);
   octree = backgroundMesh::current()->get_octree();
-	
+
   for(i=0;i<gf->getNumMeshElements();i++){
     element = gf->getMeshElement(i);
 	for(j=0;j<element->getNumVertices();j++){
@@ -185,12 +186,12 @@ double Frame_field::get_size(GFace* gf,double x,double y){
   double ratio;
   double uv[2];
   double tab[3];
-	
+
   uv[0] = x;
   uv[1] = y;
   buildMetric(gf,uv,tab);
   ratio = 1.0/pow(tab[0]*tab[2]-tab[1]*tab[1],0.25);
-  
+
   return ratio*backgroundMesh::current()->operator()(x,y,0.0);
 }
 
@@ -207,7 +208,7 @@ bool Frame_field::translate(GFace* gf,MElementOctree* octree,MVertex* vertex,SVe
   SPoint2 point;
   GPoint gp1;
   GPoint gp2;
-	
+
   ok = true;
   k = 0.1;
   reparamMeshVertexOnFace(vertex,gf,point);
@@ -215,10 +216,10 @@ bool Frame_field::translate(GFace* gf,MElementOctree* octree,MVertex* vertex,SVe
   y = point.y();
   size = get_size(gf,x,y);
   angle = backgroundMesh::current()->getAngle(x,y,0.0);
-  
+
   delta_x = k*size*cos(angle);
   delta_y = k*size*sin(angle);
-  
+
   x1 = x + delta_x;
   y1 = y + delta_y;
   x2 = x + delta_y;
@@ -234,10 +235,10 @@ bool Frame_field::translate(GFace* gf,MElementOctree* octree,MVertex* vertex,SVe
 	y2 = y + delta_x;
 	if(!inside_domain(octree,x2,y2)) ok = false;
   }
-	
+
   if(ok){
 	gp1 = gf->point(x1,y1);
-	gp2 = gf->point(x2,y2);  
+	gp2 = gf->point(x2,y2);
     v1 = SVector3(gp1.x()-vertex->x(),gp1.y()-vertex->y(),gp1.z()-vertex->z());
     v2 = SVector3(gp2.x()-vertex->x(),gp2.y()-vertex->y(),gp2.z()-vertex->z());
   }
@@ -245,7 +246,7 @@ bool Frame_field::translate(GFace* gf,MElementOctree* octree,MVertex* vertex,SVe
     v1 = SVector3(1.0,0.0,0.0);
 	v2 = SVector3(0.0,1.0,0.0);
   }
-	
+
   return ok;
 }
 
@@ -261,27 +262,27 @@ Matrix Frame_field::search(double x,double y,double z){
   query[0] = x;
   query[1] = y;
   query[2] = z;
-	
+
   indices = new ANNidx[1];
   distances = new ANNdist[1];
-	
+
   e = 0.0;
   kd_tree->annkSearch(query,1,indices,distances,e);
   val = indices[0];
-	
+
   annDeallocPt(query);
   delete[] indices;
   delete[] distances;
-  #endif	
-	
+  #endif
+
   return random[val].second;
 }
 
 void Frame_field::print_segment(SPoint3 p1,SPoint3 p2,std::ofstream& file){
-  file << "SL (" 
+  file << "SL ("
   << p1.x() << ", " << p1.y() << ", " << p1.z() << ", "
-  << p2.x() << ", " << p2.y() << ", " << p2.z() << ")" 
-  << "{10, 20};\n";	
+  << p2.x() << ", " << p2.y() << ", " << p2.z() << ")"
+  << "{10, 20};\n";
 }
 
 void Frame_field::print_field1(){
@@ -291,15 +292,15 @@ void Frame_field::print_field1(){
   MVertex* vertex;
   std::map<MVertex*,Matrix>::iterator it;
   Matrix m;
-	
+
   k = 0.1;
   std::ofstream file("field1.pos");
   file << "View \"test\" {\n";
-  
+
   for(it=field.begin();it!=field.end();it++){
     vertex = it->first;
 	m = it->second;
-	
+
 	p = SPoint3(vertex->x(),vertex->y(),vertex->z());
 	p1 = SPoint3(vertex->x()+k*m.get_m11(),vertex->y()+k*m.get_m21(),vertex->z()+k*m.get_m31());
 	p2 = SPoint3(vertex->x()-k*m.get_m11(),vertex->y()-k*m.get_m21(),vertex->z()-k*m.get_m31());
@@ -307,7 +308,7 @@ void Frame_field::print_field1(){
 	p4 = SPoint3(vertex->x()-k*m.get_m12(),vertex->y()-k*m.get_m22(),vertex->z()-k*m.get_m32());
 	p5 = SPoint3(vertex->x()+k*m.get_m13(),vertex->y()+k*m.get_m23(),vertex->z()+k*m.get_m33());
 	p6 = SPoint3(vertex->x()-k*m.get_m13(),vertex->y()-k*m.get_m23(),vertex->z()-k*m.get_m33());
-	
+
 	print_segment(p,p1,file);
 	print_segment(p,p2,file);
 	print_segment(p,p3,file);
@@ -315,12 +316,13 @@ void Frame_field::print_field1(){
 	print_segment(p,p5,file);
 	print_segment(p,p6,file);
   }
-	
+
   file << "};\n";
 }
 
 void Frame_field::print_field2(){
-  int i,j;
+  unsigned int i;
+  int j;
   double k;
   SPoint3 p;
   SPoint3 p1,p2,p3,p4,p5,p6;
@@ -330,11 +332,11 @@ void Frame_field::print_field2(){
   GModel* model = GModel::current();
   GModel::riter it;
   Matrix m;
-	
+
   k = 0.05;
   std::ofstream file("field2.pos");
   file << "View \"test\" {\n";
-		
+
   for(it=model->firstRegion();it!=model->lastRegion();it++)
   {
     gr = *it;
@@ -352,7 +354,7 @@ void Frame_field::print_field2(){
 		  p4 = SPoint3(vertex->x()-k*m.get_m12(),vertex->y()-k*m.get_m22(),vertex->z()-k*m.get_m32());
 		  p5 = SPoint3(vertex->x()+k*m.get_m13(),vertex->y()+k*m.get_m23(),vertex->z()+k*m.get_m33());
 		  p6 = SPoint3(vertex->x()-k*m.get_m13(),vertex->y()-k*m.get_m23(),vertex->z()-k*m.get_m33());
-		  
+
 		  print_segment(p,p1,file);
 		  print_segment(p,p2,file);
 		  print_segment(p,p3,file);
@@ -363,7 +365,7 @@ void Frame_field::print_field2(){
 	  }
 	}
   }
-	
+
   file << "};\n";
 }
 
@@ -384,4 +386,4 @@ std::vector<std::pair<MVertex*,Matrix> > Frame_field::random;
 #if defined(HAVE_ANN)
 ANNpointArray Frame_field::duplicate;
 ANNkd_tree* Frame_field::kd_tree;
-#endif
\ No newline at end of file
+#endif
diff --git a/Mesh/meshPartitionObjects.h b/Mesh/meshPartitionObjects.h
index 69b2986289c0f2a05b2f9b7d9c3264fbffc2d671..ac8e1dfdbcc053534fa05e45d40c67068471f780 100644
--- a/Mesh/meshPartitionObjects.h
+++ b/Mesh/meshPartitionObjects.h
@@ -89,9 +89,9 @@ class Graph
   std::vector<int> adjncy;              // Connectivity between graph vertex
                                         // xadj[i] and its neighbour graph
                                         // vertices.
-  std::vector<int> vwgts;               // Weights assigned for each 
+  std::vector<int> vwgts;               // Weights assigned for each
                                         // vertex
-  std::vector<int> adjwgts;             // Weights assigned for each 
+  std::vector<int> adjwgts;             // Weights assigned for each
                                         // edge
   std::vector<int> section;             // For separate partitioning of
                                         // different parts of the mesh
@@ -100,7 +100,7 @@ class Graph
   std::vector<MElement*> element;       // The element corresponding to each
                                         // graph vertex in 'xadj'
   fullMatrix<int> *loads;                // Matrix of loads on each partition
-                                        
+
  private:
   unsigned cIndex;                      // An index for created graph vertices
                                         // (used externally)
@@ -116,7 +116,7 @@ class Graph
                                         // 'xadj'.  'adjcny' originally contains
                                         // creations indices and will need to be
                                         // translated.
-  
+
  public:
   Graph()
     : cIndex(0), numGrVert(0), totalGrVert(0)
@@ -162,7 +162,7 @@ class Graph
        num++;
     }
   }
-  // Add multiple weights on vertices of the graph given in a map between original element Numbers and their corresponding vector of weights 
+  // Add multiple weights on vertices of the graph given in a map between original element Numbers and their corresponding vector of weights
   void fillWithMultipleWeights(int ncon, std::map<int, std::vector<int> > vWeightMap, std::map<int, int> eWeightMap)
   {
     std::vector<MElement*>::iterator eIt;
@@ -176,7 +176,7 @@ class Graph
 
     vwgts.resize(element.size()*ncon);
     adjwgts.resize(adjncy.size());
-    for(int iElem = 0; iElem < element.size(); iElem++){
+    for(unsigned int iElem = 0; iElem < element.size(); iElem++){
       for(int i=0; i<ncon; i++){
         vwgts[iElem*ncon+i]=vWeightMap[local2global[iElem]][i];
       }
@@ -186,14 +186,14 @@ class Graph
     }
   }
 
-  // Add weights per element, as defined in options 
-  void fillDefaultWeights() 
+  // Add weights per element, as defined in options
+  void fillDefaultWeights()
   {
     std::vector<MElement*>::iterator eIt = element.begin();
     vwgts.resize(element.size());
     std::vector<int>::iterator wIt = vwgts.begin();
     for ( ; eIt != element.end() ; eIt++ , wIt++) {
-      
+
       switch ((*eIt)->getType()) {
       case TYPE_TRI:
         *wIt = CTX::instance()->partitionOptions.triWeight;
@@ -226,7 +226,7 @@ class Graph
   // Returns a write index for a given creation index
   int convertC2W(const int c) const { return c2w[c]; }
   // Close the adjacency arrays (also deletes c2w)
-  void close() 
+  void close()
   {
     if(numGrVert != totalGrVert) {
       Msg::Warning("Internal error - Graph vertices are missing");
diff --git a/Mesh/multiscalePartition.cpp b/Mesh/multiscalePartition.cpp
index ef413f6ca5ef7aff71a63e9e6aea559d195caf05..1c87b1d30821460c9f721d4e5a1ea6bfca0f31ce 100644
--- a/Mesh/multiscalePartition.cpp
+++ b/Mesh/multiscalePartition.cpp
@@ -25,7 +25,7 @@ static void recur_connect(MVertex *v,
   if (touched.find(v) != touched.end())return;
 
   touched.insert(v);
-  for (std::multimap <MVertex*,MEdge>::iterator it = v2e.lower_bound(v); 
+  for (std::multimap <MVertex*,MEdge>::iterator it = v2e.lower_bound(v);
        it != v2e.upper_bound(v) ; ++it){
     group.insert(it->second);
     for (int i=0;i<it->second.getNumVertices();++i){
@@ -98,12 +98,12 @@ static void connectedRegions (std::vector<MElement*> &elements,
   }
 }
 
-static int getGenus (std::vector<MElement *> &elements,  
+static int getGenus (std::vector<MElement *> &elements,
                      std::vector<std::vector<MEdge> > &boundaries)
 {
 
   //We suppose MElements are simply connected
- 
+
   std::set<MEdge, Less_Edge> es;
   std::set<MVertex*> vs;
   int N = 0;
@@ -117,12 +117,12 @@ static int getGenus (std::vector<MElement *> &elements,
       es.insert(e->getEdge(j));
     }
   }
-  
-  int poincare = vs.size() - es.size() + N; 
 
-  //compute connected boundaries 
+  int poincare = vs.size() - es.size() + N;
+
+  //compute connected boundaries
   int nbBounds = 0;
-  std::vector<MEdge> bEdges;  
+  std::vector<MEdge> bEdges;
   for(unsigned int i = 0; i < elements.size(); i++){
     for(int j = 0; j < elements[i]->getNumEdges(); j++){
       MEdge me =  elements[i]->getEdge(j);
@@ -130,41 +130,41 @@ static int getGenus (std::vector<MElement *> &elements,
          bEdges.push_back(me);
       else
          bEdges.erase(std::find(bEdges.begin(), bEdges.end(),me));
-    }    
-  }    
+    }
+  }
   nbBounds = connected_bounds(bEdges, boundaries);
   int genus = (int)(-poincare + 2 - nbBounds)/2;
 
   //printf("************** partition has %d boundaries and genus =%d \n", nbBounds, genus);
-  
+
   return genus;
 
 }
 
-static int getAspectRatio(std::vector<MElement *> &elements, 
+static int getAspectRatio(std::vector<MElement *> &elements,
                           std::vector<std::vector<MEdge> > &boundaries)
-{ 
+{
 
   double area3D = 0.0;
   for(unsigned int i = 0; i <elements.size(); ++i){
     MElement *t = elements[i];
     std::vector<MVertex *> v(3);
     for(int k = 0; k < 3; k++) v[k] = t->getVertex(k);
-    double p0[3] = {v[0]->x(), v[0]->y(), v[0]->z()}; 
+    double p0[3] = {v[0]->x(), v[0]->y(), v[0]->z()};
     double p1[3] = {v[1]->x(), v[1]->y(), v[1]->z()};
     double p2[3] = {v[2]->x(), v[2]->y(), v[2]->z()};
     double a_3D = fabs(triangle_area(p0, p1, p2));
     area3D += a_3D;
   }
-  
+
   double tot_length = 0.0;
   for(unsigned int i = 0; i <boundaries.size(); ++i){
     std::vector<MEdge> iBound = boundaries[i];
     double iLength = 0.0;
     for( unsigned int j = 0; j <iBound.size(); ++j){
       MVertex *v0 = iBound[j].getVertex(0);
-      MVertex *v1 = iBound[j].getVertex(1);    
-      const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) + 
+      MVertex *v1 = iBound[j].getVertex(1);
+      const double length = sqrt((v0->x() - v1->x()) * (v0->x() - v1->x()) +
                                  (v0->y() - v1->y()) * (v0->y() - v1->y()) +
                                  (v0->z() - v1->z()) * (v0->z() - v1->z()));
       iLength += length;
@@ -195,8 +195,8 @@ static int getAspectRatio(std::vector<MElement *> &elements,
   double H = norm(SVector3(bb.max(), bb.min()));
 
   //SOrientedBoundingBox obbox =  SOrientedBoundingBox::buildOBB(vertices);
-  //double H = obbox.getMaxSize(); 
-  
+  //double H = obbox.getMaxSize();
+
   double D = H;
   if (boundaries.size()  > 0 ) D = 10e4;
   for (unsigned int i = 0; i < boundaries.size(); i++){
@@ -216,12 +216,12 @@ static int getAspectRatio(std::vector<MElement *> &elements,
     }
     double iD = norm(SVector3(bb.max(), bb.min()));
     D = std::min(D, iD);
-    
-    //SOrientedBoundingBox obboxD = SOrientedBoundingBox::buildOBB(vBounds); 
+
+    //SOrientedBoundingBox obboxD = SOrientedBoundingBox::buildOBB(vBounds);
     //D = std::max(D, obboxD.getMaxSize());
   }
   int AR2 = (int)ceil(H/D);
-  
+
   return std::max(AR, AR2);
 }
 
@@ -229,15 +229,15 @@ static void getGenusAndRatio(std::vector<MElement *> &elements, int & genus, int
 {
   std::vector<std::vector<MEdge> > boundaries;
   boundaries.clear();
-  genus = getGenus(elements, boundaries);  
+  genus = getGenus(elements, boundaries);
   NB = boundaries.size();
   AR = getAspectRatio(elements, boundaries);
 
 }
-static void partitionRegions(std::vector<MElement*> &elements, 
+static void partitionRegions(std::vector<MElement*> &elements,
                              std::vector<std::vector<MElement*> > &regions)
 {
-  
+
   for (unsigned int i = 0; i < elements.size(); ++i){
     MElement *e = elements[i];
     int part = e->getPartition();
@@ -249,8 +249,8 @@ static void partitionRegions(std::vector<MElement*> &elements,
     std::vector<std::vector<MElement*> >  conRegions;
     conRegions.clear();
     connectedRegions (regions[k], conRegions);
-    for (unsigned int j = 0; j < conRegions.size(); j++)  
-      allRegions.push_back(conRegions[j]); 
+    for (unsigned int j = 0; j < conRegions.size(); j++)
+      allRegions.push_back(conRegions[j]);
   }
   regions.clear();
   regions.resize(allRegions.size());
@@ -258,6 +258,7 @@ static void partitionRegions(std::vector<MElement*> &elements,
 
 }
 
+/*
 static void printLevel(std::vector<MElement *> &elements, int recur, int region)
 {
   char fn[256];
@@ -273,9 +274,9 @@ static void printLevel(std::vector<MElement *> &elements, int recur, int region)
 
   bool binary = false;
   FILE *fp = fopen (fn, "w");
-  fprintf(fp, "$MeshFormat\n");  
+  fprintf(fp, "$MeshFormat\n");
   fprintf(fp, "%g %d %d\n", version, binary ? 1 : 0, (int)sizeof(double));
-  fprintf(fp, "$EndMeshFormat\n");  
+  fprintf(fp, "$EndMeshFormat\n");
 
   fprintf(fp,"$Nodes\n%d\n", (int)vs.size());
   std::set<MVertex*> :: iterator it = vs.begin();
@@ -286,18 +287,19 @@ static void printLevel(std::vector<MElement *> &elements, int recur, int region)
             (*it)->x(),(*it)->y(),(*it)->z());
   }
   fprintf(fp,"$EndNodes\n");
-  
+
   fprintf(fp,"$Elements\n%d\n", (int)elements.size());
   for (unsigned int i = 0; i < elements.size(); i++){
     elements[i]->writeMSH(fp, version);
   }
   fprintf(fp,"$EndElements\n%d\n", (int)elements.size());
-  
+
   fclose(fp);
 }
+*/
 
 multiscalePartition::multiscalePartition(std::vector<MElement *> &elements,
-                                         int nbParts, typeOfPartition method, 
+                                         int nbParts, typeOfPartition method,
 					 int allowPartition)
 {
   options = CTX::instance()->partitionOptions;
@@ -312,7 +314,7 @@ multiscalePartition::multiscalePartition(std::vector<MElement *> &elements,
     options.refine_algorithm=2;
     options.edge_matching = 3;
   }
-  
+
   partitionLevel *level = new partitionLevel;
   level->elements.insert(level->elements.begin(),elements.begin(),elements.end());
   level->recur = 0;
@@ -349,13 +351,13 @@ void multiscalePartition::partition(partitionLevel & level, int nbParts,
     setNumberOfPartitions(nbParts);
     PartitionMeshElements(level.elements, options);
   }
-  
+
   std::vector<std::vector<MElement*> > regions(nbParts);
   partitionRegions(level.elements, regions);
   level.elements.clear();
 
-  for (unsigned i=0;i< regions.size() ; i++){    
-  
+  for (unsigned i=0;i< regions.size() ; i++){
+
     partitionLevel *nextLevel = new partitionLevel;
     nextLevel->elements = regions[i];
     nextLevel->recur = level.recur+1;
@@ -368,40 +370,40 @@ void multiscalePartition::partition(partitionLevel & level, int nbParts,
     if (genus < 0) {
       Msg::Error("Genus partition is negative G=%d!", genus);
       exit(1);
-    }  
-   
+    }
+
     if (genus != 0 ){
       int nbParts = std::max(genus+2,2);
       Msg::Info("Mesh partition: level (%d-%d)  is %d-GENUS (AR=%d) ---> MULTILEVEL partition %d parts",
-                nextLevel->recur,nextLevel->region, genus, AR, nbParts);  
+                nextLevel->recur,nextLevel->region, genus, AR, nbParts);
       partition(*nextLevel, nbParts, MULTILEVEL);
     }
     else if (genus == 0  &&  AR > AR_MAX || genus == 0  &&  NB > 1){
       int nbParts = 2;
       if(!onlyMultilevel){
 	Msg::Info("Mesh partition: level (%d-%d)  is ZERO-GENUS (AR=%d NB=%d) ---> LAPLACIAN partition %d parts",
-		  nextLevel->recur,nextLevel->region, AR, NB, nbParts); 
+		  nextLevel->recur,nextLevel->region, AR, NB, nbParts);
 	partition(*nextLevel, nbParts, LAPLACIAN);
-      } 
+      }
       else {
       Msg::Info("Mesh partition: level (%d-%d)  is ZERO-GENUS (AR=%d NB=%d) ---> MULTILEVEL partition %d parts",
-                nextLevel->recur,nextLevel->region, AR, NB, nbParts); 
+                nextLevel->recur,nextLevel->region, AR, NB, nbParts);
         partition(*nextLevel, nbParts, MULTILEVEL);
       }
     }
     else {
-      Msg::Info("*** Mesh partition: level (%d-%d) is ZERO-GENUS (AR=%d, NB=%d)", 
+      Msg::Info("*** Mesh partition: level (%d-%d) is ZERO-GENUS (AR=%d, NB=%d)",
                 nextLevel->recur,nextLevel->region, AR, NB);
     }
-    
+
   }
-  
+
 #endif
 }
 
 int multiscalePartition::assembleAllPartitions(std::vector<MElement*> & elements)
 {
-  int iPart =  1;   
+  int iPart =  1;
 
   elements.clear();
   for (unsigned i = 0; i< levels.size(); i++){
@@ -415,6 +417,6 @@ int multiscalePartition::assembleAllPartitions(std::vector<MElement*> & elements
       iPart++;
     }
   }
-  
+
   return iPart - 1;
 }
diff --git a/Mesh/periodical.cpp b/Mesh/periodical.cpp
index dd053b16f904fc2dd6a44a428eedf154cb0ffef9..6335956b9c8151235ee43e1534f063e7204c221a 100755
--- a/Mesh/periodical.cpp
+++ b/Mesh/periodical.cpp
@@ -2,6 +2,9 @@
 //
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to <gmsh@geuz.org>.
+//
+// Contributor(s):
+//   Tristan Carrier
 
 #include "periodical.h"
 #include "GModel.h"
@@ -44,7 +47,7 @@ geo_cell::geo_cell(){}
 geo_cell::~geo_cell(){}
 
 int geo_cell::search_line(std::pair<int,int> line){
-  int i;
+  unsigned int i;
 
   for(i=0;i<lines.size();i++){
     if(lines[i].first==line.first && lines[i].second==line.second) return i;
@@ -75,7 +78,7 @@ void voroMetal3D::execute(){
 }
 
 void voroMetal3D::execute(GRegion* gr){
-  int i;
+  unsigned int i;
   int j;
   MElement* element;
   MVertex* vertex;
@@ -101,11 +104,11 @@ void voroMetal3D::execute(GRegion* gr){
 void voroMetal3D::execute(std::vector<SPoint3>& vertices)
 {
 #if defined(HAVE_VORO3D)
-  int i;
-  int j;
-  int k;
+  unsigned int i;
+  unsigned int j;
+  unsigned int k;
   int start;
-  int end;
+  unsigned int end;
   int index1;
   int index2;
   int val;
@@ -322,7 +325,7 @@ void voroMetal3D::print_geo_volume(int index1,int index2,std::ofstream& file){
 }
 
 void voroMetal3D::print_geo_line_loop(int index,std::vector<int>& indices,std::vector<int>& orientations,std::ofstream& file){
-  int i;
+  unsigned int i;
 
   file << "Line Loop(" << index << ")={";
 
@@ -336,7 +339,7 @@ void voroMetal3D::print_geo_line_loop(int index,std::vector<int>& indices,std::v
 }
 
 void voroMetal3D::print_geo_face_loop(int index,std::vector<int>& indices,std::ofstream& file){
-  int i;
+  unsigned int i;
 
   file << "Surface Loop(" << index << ")={";
 
diff --git a/Plugin/AnalyseCurvedMesh.cpp b/Plugin/AnalyseCurvedMesh.cpp
index 02e51898bf11437e343a1d3dac7078badfb98707..8aa71999f40ca091db8ea06a9766ca55f610c080 100644
--- a/Plugin/AnalyseCurvedMesh.cpp
+++ b/Plugin/AnalyseCurvedMesh.cpp
@@ -26,7 +26,6 @@
 //#define UNDEF_JAC_TAG -999
 //#define _ANALYSECURVEDMESH_BLAS_
 
-
 StringXNumber JacobianOptions_Number[] = {
   {GMSH_FULLRC, "Dim", NULL, -1},
   {GMSH_FULLRC, "Analysis", NULL, 2},
@@ -172,114 +171,6 @@ static void setJacobian(MElement *el, const JacobianBasis *jfs, fullVector<doubl
   }
 }
 
-
-
-static void setJacobian(MElement *const *el, const JacobianBasis *jfs, fullMatrix<double> &jacobian)
-{
-  int numEl = jacobian.size2();
-  int numVertices = el[0]->getNumVertices();
-  fullMatrix<double> nodesX(numVertices,numEl);
-  fullMatrix<double> nodesY;
-  fullMatrix<double> nodesZ;
-  fullMatrix<double> interm1;
-  fullMatrix<double> interm2;
-
-  switch (el[0]->getDim()) {
-
-    case 1 :
-      for (int j = 0; j < numEl; j++) {
-        for (int i = 0; i < numVertices; i++) {
-          nodesX(i,j) = el[j]->getVertex(i)->x();
-        }
-      }
-      jfs->gradShapeMatX.mult(nodesX, jacobian);
-      break;
-
-
-    case 2 :
-      nodesY.resize(numVertices,numEl);
-      interm1.resize(jacobian.size1(),jacobian.size2());
-      interm2.resize(jacobian.size1(),jacobian.size2());
-
-      for (int j = 0; j < numEl; j++) {
-        for (int i = 0; i < numVertices; i++) {
-          nodesX(i,j) = el[j]->getVertex(i)->x();
-          nodesY(i,j) = el[j]->getVertex(i)->y();
-        }
-      }
-
-      jfs->gradShapeMatX.mult(nodesX, jacobian);
-      jfs->gradShapeMatY.mult(nodesY, interm2);
-      jacobian.multTByT(interm2);
-
-      jfs->gradShapeMatY.mult(nodesX, interm1);
-      jfs->gradShapeMatX.mult(nodesY, interm2);
-      interm1.multTByT(interm2);
-
-      jacobian.add(interm1, -1);
-      break;
-
-    case 3 :
-      nodesY.resize(numVertices,numEl);
-      nodesZ.resize(numVertices,numEl);
-      interm1.resize(jacobian.size1(),jacobian.size2());
-      interm2.resize(jacobian.size1(),jacobian.size2());
-
-      for (int j = 0; j < numEl; j++) {
-        for (int i = 0; i < numVertices; i++) {
-          nodesX(i,j) = el[j]->getVertex(i)->x();
-          nodesY(i,j) = el[j]->getVertex(i)->y();
-          nodesZ(i,j) = el[j]->getVertex(i)->z();
-        }
-      }
-
-      jfs->gradShapeMatX.mult(nodesX, jacobian);
-      jfs->gradShapeMatY.mult(nodesY, interm2);
-      jacobian.multTByT(interm2);
-      jfs->gradShapeMatZ.mult(nodesZ, interm2);
-      jacobian.multTByT(interm2);
-
-      jfs->gradShapeMatX.mult(nodesY, interm1);
-      jfs->gradShapeMatY.mult(nodesZ, interm2);
-      interm1.multTByT(interm2);
-      jfs->gradShapeMatZ.mult(nodesX, interm2);
-      interm1.multTByT(interm2);
-      jacobian.add(interm1, 1);
-
-      jfs->gradShapeMatX.mult(nodesZ, interm1);
-      jfs->gradShapeMatY.mult(nodesX, interm2);
-      interm1.multTByT(interm2);
-      jfs->gradShapeMatZ.mult(nodesY, interm2);
-      interm1.multTByT(interm2);
-      jacobian.add(interm1, 1);
-
-
-      jfs->gradShapeMatX.mult(nodesY, interm1);
-      jfs->gradShapeMatY.mult(nodesX, interm2);
-      interm1.multTByT(interm2);
-      jfs->gradShapeMatZ.mult(nodesZ, interm2);
-      interm1.multTByT(interm2);
-      jacobian.add(interm1, -1);
-
-      jfs->gradShapeMatX.mult(nodesZ, interm1);
-      jfs->gradShapeMatY.mult(nodesY, interm2);
-      interm1.multTByT(interm2);
-      jfs->gradShapeMatZ.mult(nodesX, interm2);
-      interm1.multTByT(interm2);
-      jacobian.add(interm1, -1);
-
-      jfs->gradShapeMatX.mult(nodesX, interm1);
-      jfs->gradShapeMatY.mult(nodesZ, interm2);
-      interm1.multTByT(interm2);
-      jfs->gradShapeMatZ.mult(nodesY, interm2);
-      interm1.multTByT(interm2);
-      jacobian.add(interm1, -1);
-
-    default :
-      break;
-  }
-}
-
 static double sum(fullVector<double> &v)
 {
   double sum = .0;
@@ -346,18 +237,18 @@ void GMSH_AnalyseCurvedMeshPlugin::checkValidity(int toDo)
     case 2 :
       Msg::Warning("2D elements must be in a z=cst plane ! If they aren't, results won't be correct.");
 
-				for (GModel::fiter it = _m->firstFace(); it != _m->lastFace(); it++) {
-					GFace *f = *it;
+      for (GModel::fiter it = _m->firstFace(); it != _m->lastFace(); it++) {
+        GFace *f = *it;
 
-					unsigned int numType[3] = {0, 0, 0};
-					f->getNumMeshElements(numType);
+        unsigned int numType[3] = {0, 0, 0};
+        f->getNumMeshElements(numType);
 
-					for (int type = 0; type < 3; type++) {
-						MElement *const *el = f->getStartElementType(type);
-						for (int jo = 0; jo < numType[type]; jo++)
-							el[jo]->setVolumePositive();
-					}
-				}
+        for (int type = 0; type < 3; type++) {
+          MElement *const *el = f->getStartElementType(type);
+          for (unsigned int jo = 0; jo < numType[type]; jo++)
+            el[jo]->setVolumePositive();
+        }
+      }
       for (GModel::fiter it = _m->firstFace(); it != _m->lastFace(); it++) {
         GFace *f = *it;
         unsigned int numType[3] = {0, 0, 0};
@@ -664,7 +555,7 @@ void GMSH_AnalyseCurvedMeshPlugin::computeMinMax(MElement *const*el, int numEl,
   _min_ratioJ = 1.7e308;
 
   std::ofstream fwrite("minDisto.txt");
-	fwrite << numEl << "\r";
+  fwrite << numEl << "\r";
 
   for (int k = 0; k < numEl; ++k) {
 
@@ -718,7 +609,6 @@ void GMSH_AnalyseCurvedMeshPlugin::computeMinMax(MElement *const*el, int numEl,
       pqMin.push(bj);
 
       int currentDepth = 0;
-      int p = 0;
       while(minJ - minB > _tol * (std::abs(minJ) + std::abs(minB)) / 2 &&
             pqMin.top()->depth() < _maxDepth-1) {
         bj = pqMin.top();
@@ -785,7 +675,7 @@ void GMSH_AnalyseCurvedMeshPlugin::computeMinMax(MElement *const*el, int numEl,
         delete bj;
       }
     }
-		fwrite << minB/avgJ << " " << minB/maxB << "\r";
+    fwrite << minB/avgJ << " " << minB/maxB << "\r";
 
     if (data)
     if (1-minB <= _tol * minJ && maxB-1 <= _tol * maxB)
@@ -816,7 +706,7 @@ void GMSH_AnalyseCurvedMeshPlugin::hideValid_ShowInvalid(std::vector<MElement*>
 
       for(int type = 0; type < 5; type++) {
         MElement *const *el = r->getStartElementType(type);
-        for (int i = 0; i < numType[type]; ++i) {
+        for (unsigned int i = 0; i < numType[type]; ++i) {
           if (el[i] == invalids[current]) {
             ++current;
             el[i]->setVisibility(1);
@@ -836,7 +726,7 @@ void GMSH_AnalyseCurvedMeshPlugin::hideValid_ShowInvalid(std::vector<MElement*>
 
       for (int type = 0; type < 3; type++) {
         MElement *const *el = f->getStartElementType(type);
-        for (int i = 0; i < numType[type]; ++i) {
+        for (unsigned int i = 0; i < numType[type]; ++i) {
           if (el[i] == invalids[current]) {
             ++current;
             el[i]->setVisibility(1);
@@ -853,7 +743,7 @@ void GMSH_AnalyseCurvedMeshPlugin::hideValid_ShowInvalid(std::vector<MElement*>
       GEdge *e = *it;
       unsigned int numElement = e->getNumMeshElements();
       MElement *const *el = e->getStartElementType(0);
-      for (int i = 0; i < numElement; ++i) {
+      for (unsigned int i = 0; i < numElement; ++i) {
         if (el[i] == invalids[current]) {
           ++current;
           el[i]->setVisibility(1);
@@ -912,9 +802,8 @@ bool lessMinB::operator()(BezierJacobian *bj1, BezierJacobian *bj2) const
 {
   return bj1->minB() > bj2->minB();
 }
+
 bool lessMaxB::operator()(BezierJacobian *bj1, BezierJacobian *bj2) const
 {
   return bj1->maxB() < bj2->maxB();
 }
-
-
diff --git a/Plugin/DiscretizationError.cpp b/Plugin/DiscretizationError.cpp
index 35543b68a4b66fc1f79cd2a602a895627b74e3d5..98ea3a13881ed2b06d992e4e0064ae2772fb210a 100644
--- a/Plugin/DiscretizationError.cpp
+++ b/Plugin/DiscretizationError.cpp
@@ -50,8 +50,8 @@ PView *GMSH_DiscretizationErrorPlugin::execute(PView *v)
   double paramQuandtQuad = 2.0 / (nEdgeNodes - 1) - 10*tol;
   int i, j, k, counter;
   // used as a start estimate for u,v when performing an orthogonal projection
-  double startEstimate[2] = {0.5, 0.5}; 
-  double dx,dy,dz,distance;
+  double startEstimate[2] = {0.5, 0.5};
+  double dx, dy, dz;
 
   std::vector< std::pair<SPoint3,double> > quadDist(nEdgeNodes*nEdgeNodes);
   std::vector< std::pair<SPoint3,double> > triDist((nEdgeNodes + 1)*nEdgeNodes / 2);
@@ -72,7 +72,7 @@ PView *GMSH_DiscretizationErrorPlugin::execute(PView *v)
          itQuad != (*itFace)->quadrangles.end(); ++itQuad) {
       for (j = 0; j < nEdgeNodes; j++) { // u
         for (i = 0; i < nEdgeNodes; i++) { // v
-          (*itQuad)->pnt(-1+5*tol+paramQuandtQuad*i, -1+5*tol+paramQuandtQuad*j, 
+          (*itQuad)->pnt(-1+5*tol+paramQuandtQuad*i, -1+5*tol+paramQuandtQuad*j,
                          0.0, quadDist[j*(nEdgeNodes) + i].first);
           SPoint3 *point = &quadDist[j*(nEdgeNodes) + i].first;
           GPoint closest = (*itFace)->closestPoint(*point,startEstimate);
@@ -101,7 +101,7 @@ PView *GMSH_DiscretizationErrorPlugin::execute(PView *v)
      * 3  5  8
      * 1  2  4  7
      */
-    for (std::vector<MTriangle*>::iterator itTri = (*itFace)->triangles.begin(); 
+    for (std::vector<MTriangle*>::iterator itTri = (*itFace)->triangles.begin();
          itTri != (*itFace)->triangles.end(); ++itTri) {
       counter = 0;
       for (i = 0; i < nEdgeNodes; i++) {
@@ -117,7 +117,7 @@ PView *GMSH_DiscretizationErrorPlugin::execute(PView *v)
           counter++;
         }
       }
-      
+
       int indices[3];
       for (j = 0; j < nEdgeNodes - 1; j++) { // row in the triangle
         bool odd = false;
@@ -126,7 +126,7 @@ PView *GMSH_DiscretizationErrorPlugin::execute(PView *v)
             indices[0] = i / 2 + (j+1)*j/2;
             indices[1] = i / 2 + (j+1)*j/2 + j+1;
             indices[2] = i / 2 + (j+1)*j/2 + j+2;
-          } 
+          }
           else {
             indices[0] = (i-1)/2 + (j+1)*j/2;
             indices[1] = (i-1)/2 + (j+1)*j/2 + j+2;
@@ -141,10 +141,10 @@ PView *GMSH_DiscretizationErrorPlugin::execute(PView *v)
         }
       }
     }
-    
+
     //viusalize stuff
   }
-  
+
   data2->setName("Discretization Error");
   data2->setFileName("discretization_err.pos");
   data2->finalize();
diff --git a/Plugin/HomologyPostProcessing.cpp b/Plugin/HomologyPostProcessing.cpp
index 10bcf9ef91a9480fb8514568cd53e73d58a7cdd1..bc5133ba1dfd806cf70033395d09035417a460dd 100644
--- a/Plugin/HomologyPostProcessing.cpp
+++ b/Plugin/HomologyPostProcessing.cpp
@@ -112,12 +112,15 @@ bool GMSH_HomologyPostProcessingPlugin::invertIntegerMatrix
     for(int j = 0; j < n; j++)
       m(i,j) = matrix.at(i*n+j);
 
-  if(!m.invertInPlace())
+  if(!m.invertInPlace()){
     Msg::Error("Matrix is not unimodular");
+    return false;
+  }
 
   for(int i = 0; i < n; i++)
     for(int j = 0; j < n; j++)
       matrix.at(i*n+j) = m(i,j);
+  return true;
 }
 
 PView *GMSH_HomologyPostProcessingPlugin::execute(PView *v)
@@ -180,7 +183,7 @@ PView *GMSH_HomologyPostProcessingPlugin::execute(PView *v)
   if(!parseStringOpt(2, basisPhysicals2)) return 0;
 
   if(matrixString != "I" &&
-     basisPhysicals.size() != cols &&
+     (int)basisPhysicals.size() != cols &&
      basisPhysicals2.empty()) {
     Msg::Error("Number of matrix columns and operated chains must match (%d != %d)", cols, basisPhysicals.size());
     return 0;
diff --git a/Post/PView.cpp b/Post/PView.cpp
index fa34cea63d71d2dab9ee9d0c537af79e16e422ba..81d338f255fd50ed253d4787fc272992bbb0fe20 100644
--- a/Post/PView.cpp
+++ b/Post/PView.cpp
@@ -91,8 +91,8 @@ PView::PView(const std::string &xname, const std::string &yname,
   _options = new PViewOptions(PViewOptions::reference);
   _options->type = PViewOptions::Plot2D;
   _options->axes = 3;
-  //_options->lineWidth = 2.;
-  //_options->pointSize = 4.;
+  _options->lineWidth = 2.;
+  _options->pointSize = 4.;
   _options->axesLabel[0] = xname;
 }
 
diff --git a/Post/PViewDataGModelIO.cpp b/Post/PViewDataGModelIO.cpp
index 3a3a8e01973702bda549495c411d38310c123e9c..0415ff7442484d35a2fb3bb17f28f629e7470bea 100644
--- a/Post/PViewDataGModelIO.cpp
+++ b/Post/PViewDataGModelIO.cpp
@@ -59,7 +59,7 @@ bool PViewDataGModel::readMSH(std::string fileName, int fileIndex, FILE *fp,
     else // faster since we avoid computing model bounds
       _steps.push_back(new stepData<double>(*_steps.back()));
   }
-  
+
   _steps[step]->setFileName(fileName);
   _steps[step]->setFileIndex(fileIndex);
   _steps[step]->setTime(time);
@@ -229,7 +229,7 @@ bool PViewDataGModel::writeMSH(std::string fileName, bool binary, bool savemesh)
           fprintf(fp, "2\n\"%s\"\n\"INTERPOLATION_SCHEME\"\n", getName().c_str());
         else
           fprintf(fp, "1\n\"%s\"\n", getName().c_str());
-        
+
         fprintf(fp, "1\n%.16g\n", _steps[step]->getTime());
         fprintf(fp, "3\n%d\n%d\n%d\n", step, numComp, numEnt);
         for(int i = 0; i < _steps[step]->getNumData(); i++){
@@ -323,7 +323,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
   med_type_champ type;
 #if (MED_MAJOR_NUM == 3)
   med_bool localMesh;
-  if(MEDfieldInfo(fid, fileIndex + 1, name, meshName, &localMesh, &type, 
+  if(MEDfieldInfo(fid, fileIndex + 1, name, meshName, &localMesh, &type,
                   &compName[0], &compUnit[0], dtUnit, &numSteps) < 0){
 #else
   if(MEDchampInfo(fid, fileIndex + 1, name, &type, &compName[0], &compUnit[0],
@@ -339,7 +339,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
   int numCompMsh =
     (numComp <= 1) ? 1 : (numComp <= 3) ? 3 : (numComp <= 9) ? 9 : numComp;
 
-  if(numCompMsh > 9) 
+  if(numCompMsh > 9)
     Msg::Warning("More than 9 components in field: you will probably want to force "
                  "the field type to scalar, vector or tensor in the options");
 
@@ -352,14 +352,14 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 #if (MED_MAJOR_NUM == 3)
   const med_geometrie_element eleType[] =
     {MED_NONE, MED_SEG2, MED_TRIA3, MED_QUAD4, MED_TETRA4, MED_HEXA8,
-     MED_PENTA6, MED_PYRA5, MED_SEG3, MED_TRIA6, MED_QUAD9, MED_TETRA10, 
+     MED_PENTA6, MED_PYRA5, MED_SEG3, MED_TRIA6, MED_QUAD9, MED_TETRA10,
      MED_HEXA27, MED_POINT1, MED_QUAD8, MED_HEXA20, MED_PENTA15, MED_PYRA13};
   const int nodesPerEle[] =
     {0, 2, 3, 4, 4, 8, 6, 5, 3, 6, 9, 10, 27, 1, 8, 20, 15, 13};
 #else
   const med_geometrie_element eleType[] =
     {MED_NONE, MED_SEG2, MED_TRIA3, MED_QUAD4, MED_TETRA4, MED_HEXA8,
-     MED_PENTA6, MED_PYRA5, MED_SEG3, MED_TRIA6, MED_TETRA10, 
+     MED_PENTA6, MED_PYRA5, MED_SEG3, MED_TRIA6, MED_TETRA10,
      MED_POINT1, MED_QUAD8, MED_HEXA20, MED_PENTA15, MED_PYRA13};
   const int nodesPerEle[] =
     {0, 2, 3, 4, 4, 8, 6, 5, 3, 6, 10, 1, 8, 20, 15, 13};
@@ -401,11 +401,11 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       med_entite_maillage ent = entType[pairs[pair].first];
       med_geometrie_element ele = eleType[pairs[pair].second];
       med_int numdt, numit, ngauss;
-      char dtunit[MED_TAILLE_PNOM + 1];
       med_float dt;
 #if (MED_MAJOR_NUM == 3)
       if(MEDfieldComputingStepInfo(fid, name, step + 1, &numdt, &numit, &dt) < 0){
 #else
+      char dtunit[MED_TAILLE_PNOM + 1];
       med_booleen local;
       med_int numMeshes;
       if(MEDpasdetempsInfo(fid, name, ent, ele, step + 1, &ngauss, &numdt, &numit,
@@ -445,7 +445,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 #endif
       if(numVal <= 0) continue;
 
-      _type = (ent == MED_NOEUD) ? NodeData : (ent == MED_MAILLE) ? 
+      _type = (ent == MED_NOEUD) ? NodeData : (ent == MED_MAILLE) ?
         ElementData : ElementNodeData;
       int mult = 1;
       if(ent == MED_NOEUD_MAILLE){
@@ -460,7 +460,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       // read field data
       std::vector<double> val(numVal * numComp);
 #if (MED_MAJOR_NUM == 3)
-      if(MEDfieldValueWithProfileRd(fid, name, numdt, numit, ent, ele, MED_COMPACT_STMODE, 
+      if(MEDfieldValueWithProfileRd(fid, name, numdt, numit, ent, ele, MED_COMPACT_STMODE,
                                     profileName, MED_FULL_INTERLACE, MED_ALL_CONSTITUENT,
                                     (unsigned char*)&val[0]) < 0){
 #else
@@ -473,7 +473,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       }
 
       Msg::Debug("MED: eletyp=%d entity=%d (0:cell, 3:node, 4:elenode) ngauss=%d "
-                 "localizationName=%s profileName=%s -- stepDataType=%d", 
+                 "localizationName=%s profileName=%s -- stepDataType=%d",
                  ele, ent, ngauss, locName, profileName, _type);
 
       // read Gauss point data
@@ -490,8 +490,8 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
           std::vector<med_float> refcoo((ele % 100) * dim);
           std::vector<med_float> gscoo(ngauss * dim);
           std::vector<med_float> wg(ngauss);
-#if (MED_MAJOR_NUM == 3)          
-          if(MEDlocalizationRd(fid, locName, MED_FULL_INTERLACE, &refcoo[0], 
+#if (MED_MAJOR_NUM == 3)
+          if(MEDlocalizationRd(fid, locName, MED_FULL_INTERLACE, &refcoo[0],
                                &gscoo[0], &wg[0]) < 0){
 #else
           if(MEDgaussLire(fid, &refcoo[0], &gscoo[0], &wg[0], MED_FULL_INTERLACE,
@@ -535,12 +535,12 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       bool nodal = (ent == MED_NOEUD);
 #if (MED_MAJOR_NUM == 3)
       med_bool changeOfCoord;
-      med_bool geoTransform;  
-      med_int numEnt = MEDmeshnEntity(fid, meshName, MED_NO_DT, MED_NO_IT, 
-                                      nodal ? MED_NODE : MED_CELL, 
+      med_bool geoTransform;
+      med_int numEnt = MEDmeshnEntity(fid, meshName, MED_NO_DT, MED_NO_IT,
+                                      nodal ? MED_NODE : MED_CELL,
                                       nodal ? MED_NO_GEOTYPE : ele,
                                       nodal ? MED_COORDINATE : MED_CONNECTIVITY,
-                                      nodal ? MED_NO_CMODE : MED_NODAL, 
+                                      nodal ? MED_NO_CMODE : MED_NODAL,
                                       &changeOfCoord, &geoTransform);
 #else
       med_int numEnt = MEDnEntMaa(fid, meshName, nodal ? MED_COOR : MED_CONN,
@@ -550,8 +550,8 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
 #endif
       std::vector<med_int> tags(numEnt);
 #if (MED_MAJOR_NUM == 3)
-      if(MEDmeshEntityNumberRd(fid, meshName, MED_NO_DT, MED_NO_IT, 
-                               nodal ? MED_NODE : MED_CELL, 
+      if(MEDmeshEntityNumberRd(fid, meshName, MED_NO_DT, MED_NO_IT,
+                               nodal ? MED_NODE : MED_CELL,
                                nodal ? MED_NO_GEOTYPE : ele, &tags[0]) < 0)
 #else
       if(MEDnumLire(fid, meshName, &tags[0], numEnt, nodal ? MED_NOEUD : MED_MAILLE,
@@ -566,7 +566,7 @@ bool PViewDataGModel::readMED(std::string fileName, int fileIndex)
       if(!nodal && tags.empty()){
         for(int i = 1; i < pairs[pair].second; i++){
 #if (MED_MAJOR_NUM == 3)
-          med_int n = MEDmeshnEntity(fid, meshName, MED_NO_DT, MED_NO_IT, 
+          med_int n = MEDmeshnEntity(fid, meshName, MED_NO_DT, MED_NO_IT,
                                      MED_CELL, eleType[i], MED_CONNECTIVITY,
                                      MED_NODAL, &changeOfCoord, &geoTransform);
 #else
@@ -680,9 +680,9 @@ bool PViewDataGModel::writeMED(std::string fileName)
   }
 
 #if (MED_MAJOR_NUM == 3)
-  med_bool changeOfCoord, geoTransform;  
+  med_bool changeOfCoord, geoTransform;
   med_int numNodes = MEDmeshnEntity(fid, meshName, MED_NO_DT, MED_NO_IT, MED_NODE,
-                                    MED_NO_GEOTYPE, MED_COORDINATE, MED_NO_CMODE, 
+                                    MED_NO_GEOTYPE, MED_COORDINATE, MED_NO_CMODE,
                                     &changeOfCoord, &geoTransform);
 #else
   med_int numNodes = MEDnEntMaa(fid, meshName, MED_COOR, MED_NOEUD,
@@ -708,8 +708,8 @@ bool PViewDataGModel::writeMED(std::string fileName)
 #if (MED_MAJOR_NUM == 3)
     if(MEDfieldValueWithProfileWr(fid, fieldName, (med_int)(step + 1), MED_NO_IT,
                                   time, MED_NODE, MED_NO_GEOTYPE, MED_COMPACT_STMODE,
-                                  profileName, "", MED_FULL_INTERLACE, 
-                                  MED_ALL_CONSTITUENT, numNodes, 
+                                  profileName, "", MED_FULL_INTERLACE,
+                                  MED_ALL_CONSTITUENT, numNodes,
                                   (unsigned char*)&val[0]) < 0){
 #else
     if(MEDchampEcr(fid, meshName, fieldName, (unsigned char*)&val[0],
diff --git a/Post/PViewDataIO.cpp b/Post/PViewDataIO.cpp
index ee753234e5278a607d2bb82cdca46614a0e6f557..33d638ef3e04fd2746db7c0bac88f60d63c27601 100644
--- a/Post/PViewDataIO.cpp
+++ b/Post/PViewDataIO.cpp
@@ -210,7 +210,7 @@ bool PViewData::toVector(std::vector<std::vector<double> > &vec)
 
 bool PViewData::fromVector(const std::vector<std::vector<double> > &vec)
 {
-  if(vec.size() != getNumTimeSteps()){
+  if((int)vec.size() != getNumTimeSteps()){
     Msg::Error("Incompatible number of steps in vector (%d) and view (%d)",
                (int)vec.size(), getNumTimeSteps());
     return false;
@@ -227,7 +227,7 @@ bool PViewData::fromVector(const std::vector<std::vector<double> > &vec)
           if(tag) continue; // node has already been modified
           tagNode(step, ent, ele, nod, 1);
           for(int comp = 0; comp < getNumComponents(step, ent, ele); comp++){
-            if(i < vec[step].size()){
+            if(i < (int)vec[step].size()){
               setValue(step, ent, ele, nod, comp, vec[step][i++]);
             }
             else{
diff --git a/Solver/elasticitySolver.cpp b/Solver/elasticitySolver.cpp
index c13a965df15a9e81c7d7558edece04a430c6645c..08e518475d76bdd447864275dce1294de07a2055 100644
--- a/Solver/elasticitySolver.cpp
+++ b/Solver/elasticitySolver.cpp
@@ -24,6 +24,7 @@
 #include "PViewData.h"
 #endif
 
+/*
 static void printLinearSystem(linearSystemCSRTaucs<double> *lsys)
 {
   int *startIndex;
@@ -50,6 +51,7 @@ static void printLinearSystem(linearSystemCSRTaucs<double> *lsys)
     std::cout<<"x "<<val<<std::endl;
   }
 }
+*/
 
 void elasticitySolver::setMesh(const std::string &meshFileName)
 {
@@ -428,6 +430,7 @@ void elasticitySolver::getSolutionOnElement (MElement *el, fullMatrix<double> &s
 }
 
 #if defined(HAVE_POST)
+/*
 static void deformation(dofManager<double> *a, MElement *e,
 			double u, double v, double w, int _tag, double *eps){
   double valx[256];
@@ -490,6 +493,7 @@ static double vonMises(dofManager<double> *a, MElement *e,
 
   return ComputeVonMises(s);
 }
+*/
 
 PView* elasticitySolver::buildDisplacementView (const std::string postFileName)
 {
diff --git a/Solver/elasticityTerm.cpp b/Solver/elasticityTerm.cpp
index 512144a6ce9a36e01341df8ee934d4f6175b0090..2da814a1906e05ff4988f8f9e941096f85eac176 100644
--- a/Solver/elasticityTerm.cpp
+++ b/Solver/elasticityTerm.cpp
@@ -7,11 +7,11 @@
 #include "Numeric.h"
 
 // The SElement (Solver element) that has been sent to the function
-// contains 2 enrichments, that can enrich both shape and test functions   
+// contains 2 enrichments, that can enrich both shape and test functions
 
 void elasticityTerm::createData(MElement *e) const
 {
-  if (_data.find(e->getTypeForMSH()) != _data.end())return;  
+  if (_data.find(e->getTypeForMSH()) != _data.end())return;
   elasticityDataAtGaussPoint d;
   int nbSF = e->getNumShapeFunctions();
   int integrationOrder = 2 * (e->getPolynomialOrder() - 1) ;
@@ -73,9 +73,6 @@ void elasticityTerm::elementMatrix(SElement *se, fullMatrix<double> &m) const
 
   double jac[3][3],invjac[3][3],Grads[100][3];
   for (int i = 0; i < npts; i++){
-    const double u = d.u[i];
-    const double v = d.v[i];
-    const double w = d.w[i];
     const double weight = d.weight[i];
     const fullMatrix<double> &grads = d.gradSF[i];
     const double detJ = e->getJacobian(grads, jac);
@@ -89,7 +86,7 @@ void elasticityTerm::elementMatrix(SElement *se, fullMatrix<double> &m) const
       Grads[j][2] = invjac[2][0] * grads(j,0) + invjac[2][1] * grads(j,1) +
 	invjac[2][2] * grads(j,2);
     }
-    
+
 
     B.setAll(0.);
     BT.setAll(0.);
@@ -197,13 +194,13 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
   double C11 = FACT * (1 - _nu) ;
   double C12 = FACT * _nu ;
   double C44 = FACT* (1 - 2.*_nu)*.5;
-  double _K = 3*_E / (1 - 2 * _nu);
-  // FIXME : PLANE STRESS !!! 
-    //  FACT = _E / (1-_nu*_nu); 
-    //  C11  = FACT; 
-    //  C12  = _nu * FACT; 
+  //double _K = 3*_E / (1 - 2 * _nu);
+  // FIXME : PLANE STRESS !!!
+    //  FACT = _E / (1-_nu*_nu);
+    //  C11  = FACT;
+    //  C12  = _nu * FACT;
     //  C44 = (1.-_nu)*.5*FACT;
-  
+
   const double C[6][6] =
     { {C11, C12, C12,    0,   0,   0},
       {C12, C11, C12,    0,   0,   0},
@@ -251,7 +248,7 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
       }
     }
 
-    const double K2 = weight * detJ; 
+    const double K2 = weight * detJ;
 
     for (int j = 0; j < _sizeN; j++){
       for (int k = 0; k < _sizeM; k++){
@@ -261,8 +258,8 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
       }
     }
 
-    const double K3 = weight * detJ * _E/(2*(1+_nu)); 
     /*
+    const double K3 = weight * detJ * _E/(2*(1+_nu));
     for (int j = 0; j < _sizeN; j++){
       for (int k = 0; k < _sizeN; k++){
 	const double fa = (Grads[j][0] * Grads[k][0] +
@@ -288,7 +285,7 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
 
       BT(j, 3) = B(3, j) = Grads[j][1];
       BT(j, 4) = B(4, j) = Grads[j][2];
-      
+
       BDILT(j + _sizeN, 0) = BDIL(0, j + _sizeN) = Grads[j][1]/_dimension;
 
       //      BT(j + _sizeN, 0) = B(0, j + _sizeN) =            -Grads[j][0]/_dimension;
@@ -297,7 +294,7 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
 
       BT(j + _sizeN, 3) = B(3, j + _sizeN) = Grads[j][0];
       BT(j + _sizeN, 5) = B(5, j + _sizeN) = Grads[j][2];
-      
+
       BDILT(j + 2 * _sizeN, 0) = BDIL(0, j + 2 * _sizeN) = Grads[j][2]/_dimension;
 
       //      BT(j + 2 * _sizeN, 0) = B(0, j + 2 * _sizeN) =            -Grads[j][0]/_dimension;
@@ -313,7 +310,7 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
     }
 
     //    printf("BT (%d %d) x H (%d,%d) = BTH(%d,%d)\n",BT.size1(),BT.size2(), H.size1(),H.size2(),BTH.size1(),BTH.size2());
-    
+
     BTH.setAll(0.);
     BTH.gemm(BT, H);
 
@@ -325,21 +322,21 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
     //    KUP.gemm(BDILT, M, weight * detJ);
     //    KPG.gemm(MT, M, -weight * detJ);
     //    KUG.gemm(trBTH, M, weight * detJ/_dimension);
-    //    KGG.gemm(MT, M, weight * detJ * (_K)/(_dimension*_dimension));    
+    //    KGG.gemm(MT, M, weight * detJ * (_K)/(_dimension*_dimension));
 
   }
-    /*       
+    /*
             3*_sizeN  _sizeM _sizeM
 
             KUU     KUP     KUG
       m  =  KUP^t   KPP      KPG
             KUG^T    KPG^t  KGG
-      
+
      */
 
   for (int i=0;i<3*_sizeN;i++){
     for (int j=0;j<3*_sizeN;j++)
-      m(i,j) = KUU(i,j); // assemble KUU 
+      m(i,j) = KUU(i,j); // assemble KUU
 
     for (int j=0;j<_sizeM;j++){
       m(i,j+3*_sizeN) = KUP(i,j); // assemble KUP
@@ -364,6 +361,6 @@ void elasticityMixedTerm::elementMatrix(SElement *se, fullMatrix<double> &m) con
   }
   //    m.print("Mixed");
   return;
-  
+
 }
 
diff --git a/Solver/functionSpace.h b/Solver/functionSpace.h
index c0faed450bf061c7e8a8764b428999c0e172874b..8343eb1e65787cc0a397ed37c46627077d44b91d 100644
--- a/Solver/functionSpace.h
+++ b/Solver/functionSpace.h
@@ -136,7 +136,7 @@ class ScalarLagrangeFunctionSpaceOfElement : public FunctionSpace<double>
     ele->getGradShapeFunctions(u, v, w, gradsuvw);
     double jac[3][3];
     double invjac[3][3];
-    const double detJ = ele->getJacobian(u, v, w, jac); // redondant : on fait cet appel a l'exterieur
+    ele->getJacobian(u, v, w, jac); // redondant : on fait cet appel a l'exterieur
     inv3x3(jac, invjac);
     for(int i = 0; i < ndofs; ++i)
       grads.push_back(GradType(
@@ -227,7 +227,7 @@ class ScalarLagrangeFunctionSpace : public FunctionSpace<double>
     ele->getGradShapeFunctions(u, v, w, gradsuvw);
     double jac[3][3];
     double invjac[3][3];
-    const double detJ = ele->getJacobian(u, v, w, jac); // redondant : on fait cet appel a l'exterieur
+    ele->getJacobian(u, v, w, jac); // redondant : on fait cet appel a l'exterieur
     inv3x3(jac, invjac);
     for(int i = 0; i < ndofs; ++i)
       grads.push_back(GradType(
diff --git a/Solver/quadratureRules.h b/Solver/quadratureRules.h
index bf5fe5b399541dfb6e5eee1316b70c554b940e17..ec2fa9a3205db39dec80cf9e4db2bfc366bf53da 100644
--- a/Solver/quadratureRules.h
+++ b/Solver/quadratureRules.h
@@ -10,7 +10,6 @@
 //
 //
 
-
 #ifndef _QUADRATURERULES_H_
 #define _QUADRATURERULES_H_
 
@@ -74,7 +73,7 @@ class GaussQuadrature : public QuadratureBase
     return npts;
   }
   // copy constructor
-  GaussQuadrature(const GaussQuadrature &other) : info(other.info), order(other.order){}
+  GaussQuadrature(const GaussQuadrature &other) : order(other.order), info(other.info){}
 };
 
 #endif //_QUADRATURERULES_H_
diff --git a/Solver/solverAlgorithms.h b/Solver/solverAlgorithms.h
index 0aacf467bc37f86bd3b1c575265de0e73968c550..6272fb389ecb41de90496e290dd4d17ea70044db 100644
--- a/Solver/solverAlgorithms.h
+++ b/Solver/solverAlgorithms.h
@@ -209,7 +209,7 @@ class FilterDofSet : public FilterDof
   }
   virtual void addDof(std::vector<Dof> &R)
   {
-    for(int i=0;i<R.size();i++)
+    for(unsigned int i=0;i<R.size();i++)
       this->addDof(R[i]);
   }
 };
diff --git a/contrib/HighOrderMeshOptimizer/OptHomRun.h b/contrib/HighOrderMeshOptimizer/OptHomRun.h
index 66fa29a22e3378158726f199383b005cbe6739d3..63b294812a7bebfc337e514d679af51ca18c1b09 100644
--- a/contrib/HighOrderMeshOptimizer/OptHomRun.h
+++ b/contrib/HighOrderMeshOptimizer/OptHomRun.h
@@ -4,7 +4,7 @@
 class GModel;
 
 struct OptHomParameters {
-  // INPUT ------> 
+  // INPUT ------>
   double BARRIER_MIN_METRIC ; // minimum scaled jcaobian
   double BARRIER_MIN ; // minimum scaled jcaobian
   double BARRIER_MAX ; // maximum scaled jcaobian
@@ -17,19 +17,19 @@ struct OptHomParameters {
   bool onlyVisible ; // apply optimization to visible entities ONLY
   double DistanceFactor; // filter elements such that no elements further away than
                          // DistanceFactor times the max distance to straight sided version of an element are optimized
-  int method ;  // how jacobians are computed and if points can move on boundaries 
+  int method ;  // how jacobians are computed and if points can move on boundaries
   int filter ; // 0--> standard 1--> boundary layers
-  // OUTPUT ------> 
+  // OUTPUT ------>
   int SUCCESS ; // 0 --> success , 1 --> Not converged
   double minJac, maxJac; // after optimization, range of jacobians
   double CPU; // Time for optimization
 
-  // is called by the optimizer at every stage of the 
+  // is called by the optimizer at every stage of the
   //  virtual void progressCallback (int percetageDone) const {}
-  
-  OptHomParameters () 
-  // default values    
-  : BARRIER_MIN (0.1), BARRIER_MAX (2.0) , BARRIER_MIN_METRIC (-1.), weightFixed (1.e6),  weightFree (1.e2),
+
+  OptHomParameters ()
+  // default values
+  : BARRIER_MIN_METRIC (-1.), BARRIER_MIN (0.1), BARRIER_MAX (2.0) , weightFixed (1.e6),  weightFree (1.e2),
     nbLayers (6) , dim(3) , itMax(10000), onlyVisible(true), DistanceFactor(12), method(1), filter(1)
   {
   }