From 8f4241fb10a49c3b27f9ab031663650ddcc63982 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 19 Jun 2008 15:58:42 +0000
Subject: [PATCH] added geometrical transformations on volumes

---
 Fltk/Callbacks.cpp         | 377 +++++++++++--------------------------
 Fltk/Callbacks.h           |  49 +----
 Fltk/GUI.cpp               | 147 ++++++++-------
 Geo/Geo.cpp                | 124 ++++++------
 Geo/Geo.h                  |   1 -
 Geo/GeoStringInterface.cpp |   4 +-
 benchmarks/2d/HEA100.geo   |   2 +-
 benchmarks/2d/IPE.geo      |   2 +-
 doc/TODO                   |   6 +-
 doc/VERSIONS               |   4 +-
 doc/texinfo/gmsh.texi      |  39 ++--
 utils/misc/variables.msvc  |  10 +-
 12 files changed, 285 insertions(+), 480 deletions(-)

diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index b1c1053dd1..fa6a6c6414 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.584 2008-06-07 17:20:45 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.585 2008-06-19 15:58:40 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -2682,17 +2682,7 @@ void geometry_elementary_add_cb(CALLBACK_ARGS)
   WID->set_context(menu_geometry_elementary_add, 0);
 }
 
-void geometry_elementary_add_new_cb(CALLBACK_ARGS)
-{
-  WID->set_context(menu_geometry_elementary_add_new, 0);
-}
-
-void geometry_elementary_add_new_parameter_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(0);
-}
-
-void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
+static void _add_new_point()
 {
   opt_geometry_points(0, GMSH_SET | GMSH_GUI, 1);
   Draw();
@@ -2727,7 +2717,7 @@ void geometry_elementary_add_new_point_cb(CALLBACK_ARGS)
   Msg::StatusBar(3, false, "");
 }
 
-static void _new_multiline(int type)
+static void _add_new_multiline(int type)
 {
   std::vector<GVertex*> vertices;
   std::vector<GEdge*> edges;
@@ -2798,13 +2788,8 @@ static void _new_multiline(int type)
   Msg::StatusBar(3, false, "");
 }
 
-void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
+static void _add_new_line()
 {
-  // Disallow multiline selection at the moment, since multilines
-  // dont't work so well...
-  //
-  //_new_multiline(0);
-  //
   std::vector<GVertex*> vertices;
   std::vector<GEdge*> edges;
   std::vector<GFace*> faces;
@@ -2857,17 +2842,7 @@ void geometry_elementary_add_new_line_cb(CALLBACK_ARGS)
   Msg::StatusBar(3, false, "");
 }
 
-void geometry_elementary_add_new_spline_cb(CALLBACK_ARGS)
-{
-  _new_multiline(1);
-}
-
-void geometry_elementary_add_new_bspline_cb(CALLBACK_ARGS)
-{
-  _new_multiline(2);
-}
-
-void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
+static void _add_new_circle()
 {
   std::vector<GVertex*> vertices;
   std::vector<GEdge*> edges;
@@ -2924,7 +2899,7 @@ void geometry_elementary_add_new_circle_cb(CALLBACK_ARGS)
   Msg::StatusBar(3, false, "");
 }
 
-void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
+static void _add_new_ellipse()
 {
   std::vector<GVertex*> vertices;
   std::vector<GEdge*> edges;
@@ -2984,7 +2959,7 @@ void geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS)
   Msg::StatusBar(3, false, "");
 }
 
-static void _new_surface_volume(int mode)
+static void _add_new_surface_volume(int mode)
 {
   std::vector<GVertex*> vertices;
   std::vector<GEdge*> edges;
@@ -3127,19 +3102,36 @@ stopall:;
   Msg::StatusBar(3, false, "");
 }
 
-void geometry_elementary_add_new_planesurface_cb(CALLBACK_ARGS)
-{
-  _new_surface_volume(0);
-}
-
-void geometry_elementary_add_new_ruledsurface_cb(CALLBACK_ARGS)
+void geometry_elementary_add_new_cb(CALLBACK_ARGS)
 {
-  _new_surface_volume(1);
-}
+  if(!data){
+    WID->set_context(menu_geometry_elementary_add_new, 0);
+    return;
+  }
 
-void geometry_elementary_add_new_volume_cb(CALLBACK_ARGS)
-{
-  _new_surface_volume(2);
+  std::string str((const char*)data);
+  if(str == "Parameter")
+    WID->create_geometry_context_window(0);
+  else if(str == "Point")
+    _add_new_point();
+  else if(str == "Line")
+    _add_new_line();
+  else if(str == "Spline")
+    _add_new_multiline(1);
+  else if(str == "BSpline")
+    _add_new_multiline(2);
+  else if(str == "Circle")
+    _add_new_circle();
+  else if(str == "Ellipse")
+    _add_new_ellipse();
+  else if(str == "Plane Surface")
+    _add_new_surface_volume(0);
+  else if(str == "Ruled Surface")
+    _add_new_surface_volume(1);
+  else if(str == "Volume")
+    _add_new_surface_volume(2);
+  else
+    Msg::Error("Unknown entity to create: %s", str.c_str());
 }
 
 static void _action_point_line_surface_volume(int action, int mode, const char *what)
@@ -3375,186 +3367,82 @@ static void _action_point_line_surface_volume(int action, int mode, const char *
   
 void geometry_elementary_add_translate_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_add_translate, 0);
-}
-
-void geometry_elementary_add_translate_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(0, 1, "Point");
-}
-
-void geometry_elementary_add_translate_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(0, 1, "Line");
-}
-
-void geometry_elementary_add_translate_surface_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(0, 1, "Surface");
-}
-
-void geometry_elementary_translate_cb(CALLBACK_ARGS)
-{
-  WID->set_context(menu_geometry_elementary_translate, 0);
-}
-
-void geometry_elementary_translate_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(0, 0, "Point");
-}
-
-void geometry_elementary_translate_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(0, 0, "Line");
-}
-
-void geometry_elementary_translate_surface_cb(CALLBACK_ARGS)
-{
+  if(!data){
+    WID->set_context(menu_geometry_elementary_add_translate, 0);
+    return;
+  }
   WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(0, 0, "Surface");
+  _action_point_line_surface_volume(0, 1, (const char*)data);
 }
 
 void geometry_elementary_add_rotate_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_add_rotate, 0);
-}
-
-void geometry_elementary_add_rotate_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(1, 1, "Point");
-}
-
-void geometry_elementary_add_rotate_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(1, 1, "Line");
-}
-
-void geometry_elementary_add_rotate_surface_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(1, 1, "Surface");
-}
-
-void geometry_elementary_rotate_cb(CALLBACK_ARGS)
-{
-  WID->set_context(menu_geometry_elementary_rotate, 0);
-}
-
-void geometry_elementary_rotate_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(1, 0, "Point");
-}
-
-void geometry_elementary_rotate_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(1, 0, "Line");
-}
-
-void geometry_elementary_rotate_surface_cb(CALLBACK_ARGS)
-{
+  if(!data){
+    WID->set_context(menu_geometry_elementary_add_rotate, 0);
+    return;
+  }
   WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(1, 0, "Surface");
+  _action_point_line_surface_volume(1, 1, (const char*)data);
 }
 
 void geometry_elementary_add_scale_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_add_scale, 0);
-}
-
-void geometry_elementary_add_scale_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(4);
-  _action_point_line_surface_volume(2, 1, "Point");
-}
-
-void geometry_elementary_add_scale_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(4);
-  _action_point_line_surface_volume(2, 1, "Line");
-}
-
-void geometry_elementary_add_scale_surface_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(4);
-  _action_point_line_surface_volume(2, 1, "Surface");
-}
-
-void geometry_elementary_scale_cb(CALLBACK_ARGS)
-{
-  WID->set_context(menu_geometry_elementary_scale, 0);
-}
-
-void geometry_elementary_scale_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(4);
-  _action_point_line_surface_volume(2, 0, "Point");
-}
-
-void geometry_elementary_scale_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(4);
-  _action_point_line_surface_volume(2, 0, "Line");
-}
-
-void geometry_elementary_scale_surface_cb(CALLBACK_ARGS)
-{
+  if(!data){
+    WID->set_context(menu_geometry_elementary_add_scale, 0);
+    return;
+  }
   WID->create_geometry_context_window(4);
-  _action_point_line_surface_volume(2, 0, "Surface");
+  _action_point_line_surface_volume(2, 1, (const char*)data);
 }
 
 void geometry_elementary_add_symmetry_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_add_symmetry, 0);
-}
-
-void geometry_elementary_add_symmetry_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(5);
-  _action_point_line_surface_volume(3, 1, "Point");
-}
-
-void geometry_elementary_add_symmetry_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(5);
-  _action_point_line_surface_volume(3, 1, "Line");
-}
-
-void geometry_elementary_add_symmetry_surface_cb(CALLBACK_ARGS)
-{
+  if(!data){
+    WID->set_context(menu_geometry_elementary_add_symmetry, 0);
+    return;
+  }
   WID->create_geometry_context_window(5);
-  _action_point_line_surface_volume(3, 1, "Surface");
+  _action_point_line_surface_volume(3, 1, (const char*)data);
 }
 
-void geometry_elementary_symmetry_cb(CALLBACK_ARGS)
+void geometry_elementary_translate_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_symmetry, 0);
+  if(!data){
+    WID->set_context(menu_geometry_elementary_translate, 0);
+    return;
+  }
+  WID->create_geometry_context_window(2);
+  _action_point_line_surface_volume(0, 0, (const char*)data);
 }
 
-void geometry_elementary_symmetry_point_cb(CALLBACK_ARGS)
+void geometry_elementary_rotate_cb(CALLBACK_ARGS)
 {
-  WID->create_geometry_context_window(5);
-  _action_point_line_surface_volume(3, 0, "Point");
+  if(!data){
+    WID->set_context(menu_geometry_elementary_rotate, 0);
+    return;
+  }
+  WID->create_geometry_context_window(3);
+  _action_point_line_surface_volume(1, 0, (const char*)data);
 }
 
-void geometry_elementary_symmetry_line_cb(CALLBACK_ARGS)
+void geometry_elementary_scale_cb(CALLBACK_ARGS)
 {
-  WID->create_geometry_context_window(5);
-  _action_point_line_surface_volume(3, 0, "Line");
+  if(!data){
+    WID->set_context(menu_geometry_elementary_scale, 0);
+    return;
+  }
+  WID->create_geometry_context_window(4);
+  _action_point_line_surface_volume(2, 0, (const char*)data);
 }
 
-void geometry_elementary_symmetry_surface_cb(CALLBACK_ARGS)
+void geometry_elementary_symmetry_cb(CALLBACK_ARGS)
 {
+  if(!data){
+    WID->set_context(menu_geometry_elementary_symmetry, 0);
+    return;
+  }
   WID->create_geometry_context_window(5);
-  _action_point_line_surface_volume(3, 0, "Surface");
+  _action_point_line_surface_volume(3, 0, (const char*)data);
 }
 
 void geometry_elementary_extrude_cb(CALLBACK_ARGS)
@@ -3564,48 +3452,31 @@ void geometry_elementary_extrude_cb(CALLBACK_ARGS)
 
 void geometry_elementary_extrude_translate_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_extrude_translate, 0);
-}
-
-void geometry_elementary_extrude_translate_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(4, 0, "Point");
-}
-
-void geometry_elementary_extrude_translate_line_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(4, 0, "Line");
-}
-
-void geometry_elementary_extrude_translate_surface_cb(CALLBACK_ARGS)
-{
+  if(!data){
+    WID->set_context(menu_geometry_elementary_extrude_translate, 0);
+    return;
+  }
   WID->create_geometry_context_window(2);
-  _action_point_line_surface_volume(4, 0, "Surface");
+  _action_point_line_surface_volume(4, 0, (const char*)data);
 }
 
 void geometry_elementary_extrude_rotate_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_elementary_extrude_rotate, 0);
-}
-
-void geometry_elementary_extrude_rotate_point_cb(CALLBACK_ARGS)
-{
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(5, 0, "Point");
-}
-
-void geometry_elementary_extrude_rotate_line_cb(CALLBACK_ARGS)
-{
+  if(!data){
+    WID->set_context(menu_geometry_elementary_extrude_rotate, 0);
+    return;
+  }
   WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(5, 0, "Line");
+  _action_point_line_surface_volume(5, 0, (const char*)data);
 }
 
-void geometry_elementary_extrude_rotate_surface_cb(CALLBACK_ARGS)
+void geometry_elementary_delete_cb(CALLBACK_ARGS)
 {
-  WID->create_geometry_context_window(3);
-  _action_point_line_surface_volume(5, 0, "Surface");
+  if(!data){
+    WID->set_context(menu_geometry_elementary_delete, 0);
+    return;
+  }
+  _action_point_line_surface_volume(6, 0, (const char*)data);
 }
 
 void geometry_elementary_coherence_cb(CALLBACK_ARGS)
@@ -3613,51 +3484,19 @@ void geometry_elementary_coherence_cb(CALLBACK_ARGS)
   coherence(CTX.filename);
 }
 
-void geometry_elementary_delete_cb(CALLBACK_ARGS)
-{
-  WID->set_context(menu_geometry_elementary_delete, 0);
-}
-
-void geometry_elementary_delete_point_cb(CALLBACK_ARGS)
-{
-  _action_point_line_surface_volume(6, 0, "Point");
-}
-
-void geometry_elementary_delete_line_cb(CALLBACK_ARGS)
-{
-  _action_point_line_surface_volume(6, 0, "Line");
-}
-
-void geometry_elementary_delete_surface_cb(CALLBACK_ARGS)
-{
-  _action_point_line_surface_volume(6, 0, "Surface");
-}
-
 void geometry_physical_add_cb(CALLBACK_ARGS)
 {
-  WID->set_context(menu_geometry_physical_add, 0);
-}
-
-void geometry_physical_add_point_cb(CALLBACK_ARGS)
-{
-  WID->call_for_solver_plugin(0);
-  _action_point_line_surface_volume(7, 0, "Point");
-}
-
-void geometry_physical_add_line_cb(CALLBACK_ARGS)
-{
-  WID->call_for_solver_plugin(1);
-  _action_point_line_surface_volume(7, 0, "Line");
-}
-
-void geometry_physical_add_surface_cb(CALLBACK_ARGS)
-{
-  _action_point_line_surface_volume(7, 0, "Surface");
-}
+  if(!data){
+    WID->set_context(menu_geometry_physical_add, 0);
+    return;
+  }
+  std::string str((const char*)data);
+  if(str == "Point")
+    WID->call_for_solver_plugin(0);
+  else if(str == "Line")
+    WID->call_for_solver_plugin(1);
 
-void geometry_physical_add_volume_cb(CALLBACK_ARGS)
-{
-  _action_point_line_surface_volume(7, 0, "Volume");
+  _action_point_line_surface_volume(7, 0, str.c_str());
 }
 
 // Dynamic Mesh Menus
diff --git a/Fltk/Callbacks.h b/Fltk/Callbacks.h
index ddf3205264..a0888d2ba8 100644
--- a/Fltk/Callbacks.h
+++ b/Fltk/Callbacks.h
@@ -209,68 +209,21 @@ void mod_forward_cb(CALLBACK_ARGS);
 void geometry_elementary_cb(CALLBACK_ARGS);
 void   geometry_elementary_add_cb(CALLBACK_ARGS);
 void     geometry_elementary_add_new_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_parameter_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_point_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_line_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_spline_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_bspline_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_circle_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_ellipse_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_planesurface_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_ruledsurface_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_new_volume_cb(CALLBACK_ARGS);
 void     geometry_elementary_add_translate_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_translate_point_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_translate_line_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_translate_surface_cb(CALLBACK_ARGS);
 void     geometry_elementary_add_rotate_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_rotate_point_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_rotate_line_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_rotate_surface_cb(CALLBACK_ARGS);
 void     geometry_elementary_add_scale_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_scale_point_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_scale_line_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_scale_surface_cb(CALLBACK_ARGS);
 void     geometry_elementary_add_symmetry_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_symmetry_point_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_symmetry_line_cb(CALLBACK_ARGS);
-void       geometry_elementary_add_symmetry_surface_cb(CALLBACK_ARGS);
+void   geometry_elementary_delete_cb(CALLBACK_ARGS);
 void   geometry_elementary_translate_cb(CALLBACK_ARGS);
-void     geometry_elementary_translate_point_cb(CALLBACK_ARGS);
-void     geometry_elementary_translate_line_cb(CALLBACK_ARGS);
-void     geometry_elementary_translate_surface_cb(CALLBACK_ARGS);
 void   geometry_elementary_rotate_cb(CALLBACK_ARGS);
-void     geometry_elementary_rotate_point_cb(CALLBACK_ARGS);
-void     geometry_elementary_rotate_line_cb(CALLBACK_ARGS);
-void     geometry_elementary_rotate_surface_cb(CALLBACK_ARGS);
 void   geometry_elementary_scale_cb(CALLBACK_ARGS);
-void     geometry_elementary_scale_point_cb(CALLBACK_ARGS);
-void     geometry_elementary_scale_line_cb(CALLBACK_ARGS);
-void     geometry_elementary_scale_surface_cb(CALLBACK_ARGS);
 void   geometry_elementary_symmetry_cb(CALLBACK_ARGS);
-void     geometry_elementary_symmetry_point_cb(CALLBACK_ARGS);
-void     geometry_elementary_symmetry_line_cb(CALLBACK_ARGS);
-void     geometry_elementary_symmetry_surface_cb(CALLBACK_ARGS);
 void   geometry_elementary_extrude_cb(CALLBACK_ARGS);
 void     geometry_elementary_extrude_translate_cb(CALLBACK_ARGS);
-void        geometry_elementary_extrude_translate_point_cb(CALLBACK_ARGS);
-void        geometry_elementary_extrude_translate_line_cb(CALLBACK_ARGS);
-void        geometry_elementary_extrude_translate_surface_cb(CALLBACK_ARGS);
 void     geometry_elementary_extrude_rotate_cb(CALLBACK_ARGS);
-void        geometry_elementary_extrude_rotate_point_cb(CALLBACK_ARGS);
-void        geometry_elementary_extrude_rotate_line_cb(CALLBACK_ARGS);
-void        geometry_elementary_extrude_rotate_surface_cb(CALLBACK_ARGS);
 void   geometry_elementary_coherence_cb(CALLBACK_ARGS);
-void   geometry_elementary_delete_cb(CALLBACK_ARGS);
-void     geometry_elementary_delete_point_cb(CALLBACK_ARGS);
-void     geometry_elementary_delete_line_cb(CALLBACK_ARGS);
-void     geometry_elementary_delete_surface_cb(CALLBACK_ARGS);
 void geometry_physical_cb(CALLBACK_ARGS);
 void   geometry_physical_add_cb(CALLBACK_ARGS);
-void     geometry_physical_add_point_cb (CALLBACK_ARGS);
-void     geometry_physical_add_line_cb (CALLBACK_ARGS);
-void     geometry_physical_add_surface_cb (CALLBACK_ARGS);
-void     geometry_physical_add_volume_cb (CALLBACK_ARGS);
 void geometry_edit_cb(CALLBACK_ARGS);
 void geometry_reload_cb(CALLBACK_ARGS); 
 
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index e60dc8d8f3..04e9406ac3 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.690 2008-06-15 08:47:15 geuzaine Exp $
+// $Id: GUI.cpp,v 1.691 2008-06-19 15:58:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -149,139 +149,148 @@ Context_Item menu_geometry[] = {
   {"0Geometry", NULL} ,
   {"Elementary entities", (Fl_Callback *)geometry_elementary_cb} ,
   {"Physical groups",     (Fl_Callback *)geometry_physical_cb} ,
-  {"Edit",       (Fl_Callback *)geometry_edit_cb} , 
-  {"Reload",     (Fl_Callback *)geometry_reload_cb} , 
+  {"Edit",                (Fl_Callback *)geometry_edit_cb} , 
+  {"Reload",              (Fl_Callback *)geometry_reload_cb} , 
   {0}
 };  
     Context_Item menu_geometry_elementary[] = {
       {"0Geometry>Elementary", NULL} ,
       {"Add",       (Fl_Callback *)geometry_elementary_add_cb} ,
-      {"Delete",    (Fl_Callback *)geometry_elementary_delete_cb} ,
-      {"Translate", (Fl_Callback *)geometry_elementary_translate_cb} ,
-      {"Rotate",    (Fl_Callback *)geometry_elementary_rotate_cb} ,
-      {"Scale",     (Fl_Callback *)geometry_elementary_scale_cb} ,
-      {"Symmetry",  (Fl_Callback *)geometry_elementary_symmetry_cb} ,
-      {"Extrude",   (Fl_Callback *)geometry_elementary_extrude_cb} ,
+      {"Delete",    (Fl_Callback *)geometry_elementary_delete_cb, (void*)0} ,
+      {"Translate", (Fl_Callback *)geometry_elementary_translate_cb, (void*)0} ,
+      {"Rotate",    (Fl_Callback *)geometry_elementary_rotate_cb, (void*)0} ,
+      {"Scale",     (Fl_Callback *)geometry_elementary_scale_cb, (void*)0} ,
+      {"Symmetry",  (Fl_Callback *)geometry_elementary_symmetry_cb, (void*)0} ,
+      {"Extrude",   (Fl_Callback *)geometry_elementary_extrude_cb, (void*)0} ,
       {"Coherence", (Fl_Callback *)geometry_elementary_coherence_cb} ,
       {0} 
     };  
         Context_Item menu_geometry_elementary_add[] = {
           {"0Geometry>Elementary>Add", NULL} ,
-          {"New",       (Fl_Callback *)geometry_elementary_add_new_cb} ,
-          {"Translate", (Fl_Callback *)geometry_elementary_add_translate_cb} ,
-          {"Rotate",    (Fl_Callback *)geometry_elementary_add_rotate_cb} ,
-          {"Scale",     (Fl_Callback *)geometry_elementary_add_scale_cb} ,
-          {"Symmetry",  (Fl_Callback *)geometry_elementary_add_symmetry_cb} ,
+          {"New",       (Fl_Callback *)geometry_elementary_add_new_cb, (void*)0} ,
+          {"Translate", (Fl_Callback *)geometry_elementary_add_translate_cb, (void*)0} ,
+          {"Rotate",    (Fl_Callback *)geometry_elementary_add_rotate_cb, (void*)0} ,
+          {"Scale",     (Fl_Callback *)geometry_elementary_add_scale_cb, (void*)0} ,
+          {"Symmetry",  (Fl_Callback *)geometry_elementary_add_symmetry_cb, (void*)0} ,
           {0} 
         };  
             Context_Item menu_geometry_elementary_add_new[] = {
               {"0Geometry>Elementary>Add>New", NULL} ,
-              {"Parameter",     (Fl_Callback *)geometry_elementary_add_new_parameter_cb} ,
-              {"Point",         (Fl_Callback *)geometry_elementary_add_new_point_cb} ,
-              {"Straight line", (Fl_Callback *)geometry_elementary_add_new_line_cb} ,
-              {"Spline",        (Fl_Callback *)geometry_elementary_add_new_spline_cb} ,
-              {"B-Spline",      (Fl_Callback *)geometry_elementary_add_new_bspline_cb} ,
-              {"Circle arc",    (Fl_Callback *)geometry_elementary_add_new_circle_cb} ,
-              {"Ellipse arc",   (Fl_Callback *)geometry_elementary_add_new_ellipse_cb} ,
-              {"Plane surface", (Fl_Callback *)geometry_elementary_add_new_planesurface_cb} ,
-              {"Ruled surface", (Fl_Callback *)geometry_elementary_add_new_ruledsurface_cb} ,
-              {"Volume",        (Fl_Callback *)geometry_elementary_add_new_volume_cb} ,
+              {"Parameter",     (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Parameter"} ,
+              {"Point",         (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Point"} ,
+              {"Straight line", (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Line"} ,
+              {"Spline",        (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Spline"} ,
+              {"B-Spline",      (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"BSpline"} ,
+              {"Circle arc",    (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Circle"} ,
+              {"Ellipse arc",   (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Ellipse"} ,
+              {"Plane surface", (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Plane Surface"} ,
+              {"Ruled surface", (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Ruled Surface"} ,
+              {"Volume",        (Fl_Callback *)geometry_elementary_add_new_cb, (void*)"Volume"} ,
               {0} 
             };  
             Context_Item menu_geometry_elementary_add_translate[] = {
               {"0Geometry>Elementary>Add>Translate", NULL} ,
-              {"Point",   (Fl_Callback *)geometry_elementary_add_translate_point_cb} ,
-              {"Line",    (Fl_Callback *)geometry_elementary_add_translate_line_cb} ,
-              {"Surface", (Fl_Callback *)geometry_elementary_add_translate_surface_cb} ,
+              {"Point",   (Fl_Callback *)geometry_elementary_add_translate_cb, (void*)"Point"} ,  
+              {"Line",    (Fl_Callback *)geometry_elementary_add_translate_cb, (void*)"Line"} ,	  
+              {"Surface", (Fl_Callback *)geometry_elementary_add_translate_cb, (void*)"Surface"} ,
+              {"Volume",  (Fl_Callback *)geometry_elementary_add_translate_cb, (void*)"Volume"} , 
               {0} 
             };  
             Context_Item menu_geometry_elementary_add_rotate[] = {
               {"0Geometry>Elementary>Add>Rotate", NULL} ,
-              {"Point",   (Fl_Callback *)geometry_elementary_add_rotate_point_cb} ,
-              {"Line",    (Fl_Callback *)geometry_elementary_add_rotate_line_cb} ,
-              {"Surface", (Fl_Callback *)geometry_elementary_add_rotate_surface_cb} ,
+              {"Point",   (Fl_Callback *)geometry_elementary_add_rotate_cb, (void*)"Point"} ,  
+              {"Line",    (Fl_Callback *)geometry_elementary_add_rotate_cb, (void*)"Line"} ,	  
+              {"Surface", (Fl_Callback *)geometry_elementary_add_rotate_cb, (void*)"Surface"} ,
+              {"Volume",  (Fl_Callback *)geometry_elementary_add_rotate_cb, (void*)"Volume"} , 
               {0} 
             };  
             Context_Item menu_geometry_elementary_add_scale[] = {
               {"0Geometry>Elementary>Add>Scale", NULL} ,
-              {"Point",   (Fl_Callback *)geometry_elementary_add_scale_point_cb} ,
-              {"Line",    (Fl_Callback *)geometry_elementary_add_scale_line_cb} ,
-              {"Surface", (Fl_Callback *)geometry_elementary_add_scale_surface_cb} ,
+              {"Point",   (Fl_Callback *)geometry_elementary_add_scale_cb, (void*)"Point"} ,  
+              {"Line",    (Fl_Callback *)geometry_elementary_add_scale_cb, (void*)"Line"} ,	  
+              {"Surface", (Fl_Callback *)geometry_elementary_add_scale_cb, (void*)"Surface"} ,
+              {"Volume",  (Fl_Callback *)geometry_elementary_add_scale_cb, (void*)"Volume"} , 
               {0} 
             };  
             Context_Item menu_geometry_elementary_add_symmetry[] = {
               {"0Geometry>Elementary>Add>Symmetry", NULL} ,
-              {"Point",   (Fl_Callback *)geometry_elementary_add_symmetry_point_cb} ,
-              {"Line",    (Fl_Callback *)geometry_elementary_add_symmetry_line_cb} ,
-              {"Surface", (Fl_Callback *)geometry_elementary_add_symmetry_surface_cb} ,
+              {"Point",   (Fl_Callback *)geometry_elementary_add_symmetry_cb, (void*)"Point"} ,  
+              {"Line",    (Fl_Callback *)geometry_elementary_add_symmetry_cb, (void*)"Line"} ,	  
+              {"Surface", (Fl_Callback *)geometry_elementary_add_symmetry_cb, (void*)"Surface"} ,
+              {"Volume",  (Fl_Callback *)geometry_elementary_add_symmetry_cb, (void*)"Volume"} , 
               {0} 
             };  
+        Context_Item menu_geometry_elementary_delete[] = {
+          {"0Geometry>Elementary>Delete", NULL} ,
+          {"Point",   (Fl_Callback *)geometry_elementary_delete_cb, (void*)"Point"} ,
+          {"Line",    (Fl_Callback *)geometry_elementary_delete_cb, (void*)"Line"} ,
+          {"Surface", (Fl_Callback *)geometry_elementary_delete_cb, (void*)"Surface"} ,
+          {"Volume",  (Fl_Callback *)geometry_elementary_delete_cb, (void*)"Volume"} ,
+          {0} 
+        };  
         Context_Item menu_geometry_elementary_translate[] = {
           {"0Geometry>Elementary>Translate", NULL} ,
-          {"Point",   (Fl_Callback *)geometry_elementary_translate_point_cb} ,
-          {"Line",    (Fl_Callback *)geometry_elementary_translate_line_cb} ,
-          {"Surface", (Fl_Callback *)geometry_elementary_translate_surface_cb} ,
+          {"Point",   (Fl_Callback *)geometry_elementary_translate_cb, (void*)"Point"} ,  
+          {"Line",    (Fl_Callback *)geometry_elementary_translate_cb, (void*)"Line"} ,	  
+          {"Surface", (Fl_Callback *)geometry_elementary_translate_cb, (void*)"Surface"} ,
+          {"Volume",  (Fl_Callback *)geometry_elementary_translate_cb, (void*)"Volume"} , 
           {0} 
         };  
         Context_Item menu_geometry_elementary_rotate[] = {
           {"0Geometry>Elementary>Rotate", NULL} ,
-          {"Point",   (Fl_Callback *)geometry_elementary_rotate_point_cb} ,
-          {"Line",    (Fl_Callback *)geometry_elementary_rotate_line_cb} ,
-          {"Surface", (Fl_Callback *)geometry_elementary_rotate_surface_cb} ,
+          {"Point",   (Fl_Callback *)geometry_elementary_rotate_cb, (void*)"Point"} ,  
+          {"Line",    (Fl_Callback *)geometry_elementary_rotate_cb, (void*)"Line"} ,	  
+          {"Surface", (Fl_Callback *)geometry_elementary_rotate_cb, (void*)"Surface"} ,
+          {"Volume",  (Fl_Callback *)geometry_elementary_rotate_cb, (void*)"Volume"} , 
           {0} 
         };  
         Context_Item menu_geometry_elementary_scale[] = {
           {"0Geometry>Elementary>Scale", NULL} ,
-          {"Point",   (Fl_Callback *)geometry_elementary_scale_point_cb} ,
-          {"Line",    (Fl_Callback *)geometry_elementary_scale_line_cb} ,
-          {"Surface", (Fl_Callback *)geometry_elementary_scale_surface_cb} ,
+          {"Point",   (Fl_Callback *)geometry_elementary_scale_cb, (void*)"Point"} ,  
+          {"Line",    (Fl_Callback *)geometry_elementary_scale_cb, (void*)"Line"} ,	  
+          {"Surface", (Fl_Callback *)geometry_elementary_scale_cb, (void*)"Surface"} ,
+          {"Volume",  (Fl_Callback *)geometry_elementary_scale_cb, (void*)"Volume"} , 
           {0} 
         };  
         Context_Item menu_geometry_elementary_symmetry[] = {
           {"0Geometry>Elementary>Symmetry", NULL} ,
-          {"Point",   (Fl_Callback *)geometry_elementary_symmetry_point_cb} ,
-          {"Line",    (Fl_Callback *)geometry_elementary_symmetry_line_cb} ,
-          {"Surface", (Fl_Callback *)geometry_elementary_symmetry_surface_cb} ,
+          {"Point",   (Fl_Callback *)geometry_elementary_symmetry_cb, (void*)"Point"} ,  
+          {"Line",    (Fl_Callback *)geometry_elementary_symmetry_cb, (void*)"Line"} ,	  
+          {"Surface", (Fl_Callback *)geometry_elementary_symmetry_cb, (void*)"Surface"} ,
+          {"Volume",  (Fl_Callback *)geometry_elementary_symmetry_cb, (void*)"Volume"} , 
           {0} 
         };  
         Context_Item menu_geometry_elementary_extrude[] = {
           {"0Geometry>Elementary>Extrude", NULL} ,
-          {"Translate", (Fl_Callback *)geometry_elementary_extrude_translate_cb} ,
-          {"Rotate",    (Fl_Callback *)geometry_elementary_extrude_rotate_cb} ,
+          {"Translate", (Fl_Callback *)geometry_elementary_extrude_translate_cb, (void*)0} ,
+          {"Rotate",    (Fl_Callback *)geometry_elementary_extrude_rotate_cb, (void*)0} ,
           {0} 
         };  
             Context_Item menu_geometry_elementary_extrude_translate[] = {
               {"0Geometry>Elementary>Extrude>Translate", NULL} ,
-              {"Point",   (Fl_Callback *)geometry_elementary_extrude_translate_point_cb} ,
-              {"Line",    (Fl_Callback *)geometry_elementary_extrude_translate_line_cb} ,
-              {"Surface", (Fl_Callback *)geometry_elementary_extrude_translate_surface_cb} ,
+              {"Point",   (Fl_Callback *)geometry_elementary_extrude_translate_cb, (void*)"Point"} ,
+              {"Line",    (Fl_Callback *)geometry_elementary_extrude_translate_cb, (void*)"Line"} ,
+              {"Surface", (Fl_Callback *)geometry_elementary_extrude_translate_cb, (void*)"Surface"} ,
               {0} 
             };  
             Context_Item menu_geometry_elementary_extrude_rotate[] = {
               {"0Geometry>Elementary>Extrude>Rotate", NULL} ,
-              {"Point",   (Fl_Callback *)geometry_elementary_extrude_rotate_point_cb} ,
-              {"Line",    (Fl_Callback *)geometry_elementary_extrude_rotate_line_cb} ,
-              {"Surface", (Fl_Callback *)geometry_elementary_extrude_rotate_surface_cb} ,
+              {"Point",   (Fl_Callback *)geometry_elementary_extrude_rotate_cb, (void*)"Point"} ,
+              {"Line",    (Fl_Callback *)geometry_elementary_extrude_rotate_cb, (void*)"Line"} ,
+              {"Surface", (Fl_Callback *)geometry_elementary_extrude_rotate_cb, (void*)"Surface"} ,
               {0} 
             };  
-        Context_Item menu_geometry_elementary_delete[] = {
-          {"0Geometry>Elementary>Delete", NULL} ,
-          {"Point",   (Fl_Callback *)geometry_elementary_delete_point_cb} ,
-          {"Line",    (Fl_Callback *)geometry_elementary_delete_line_cb} ,
-          {"Surface", (Fl_Callback *)geometry_elementary_delete_surface_cb} ,
-          {0} 
-        };  
     Context_Item menu_geometry_physical[] = {
       {"0Geometry>Physical", NULL} ,
-      {"Add",    (Fl_Callback *)geometry_physical_add_cb} ,
+      {"Add",    (Fl_Callback *)geometry_physical_add_cb, (void*)0} ,
       {0} 
     };  
         Context_Item menu_geometry_physical_add[] = {
           {"0Geometry>Physical>Add", NULL} ,
-          {"Point",   (Fl_Callback *)geometry_physical_add_point_cb  } ,
-          {"Line",    (Fl_Callback *)geometry_physical_add_line_cb  } ,
-          {"Surface", (Fl_Callback *)geometry_physical_add_surface_cb  } ,
-          {"Volume",  (Fl_Callback *)geometry_physical_add_volume_cb  } ,
+          {"Point",   (Fl_Callback *)geometry_physical_add_cb, (void*)"Point" } ,
+          {"Line",    (Fl_Callback *)geometry_physical_add_cb, (void*)"Line" } ,
+          {"Surface", (Fl_Callback *)geometry_physical_add_cb, (void*)"Surface" } ,
+          {"Volume",  (Fl_Callback *)geometry_physical_add_cb, (void*)"Volume" } ,
           {0} 
         };  
 
@@ -295,7 +304,7 @@ Context_Item menu_mesh[] = {
   {"3D",           (Fl_Callback *)mesh_3d_cb} , 
   {"First order",  (Fl_Callback *)mesh_degree_cb, (void*)1 } , 
   {"Second order", (Fl_Callback *)mesh_degree_cb, (void*)2 } , 
-  {"Optimize", (Fl_Callback *)mesh_optimize_cb} , 
+  {"Optimize",     (Fl_Callback *)mesh_optimize_cb} , 
 #if defined(HAVE_NETGEN)
   {"Optimize (Netgen)", (Fl_Callback *)mesh_optimize_netgen_cb} , 
 #endif
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index a800505f5e..b3af0fe7ca 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -1,4 +1,4 @@
-// $Id: Geo.cpp,v 1.113 2008-06-10 08:37:33 remacle Exp $
+// $Id: Geo.cpp,v 1.114 2008-06-19 15:58:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -379,7 +379,7 @@ void End_Curve(Curve *c)
     else if(!v[3] && fabs((R - R2) / (R + R2)) > 0.1){
       // check cocircular pts (allow 10% error)
       Msg::Error("Control points of Circle %d are not cocircular %g %g",
-          c->Num, R, R2);
+		 c->Num, R, R2);
     }
 
     // A1 = angle first pt
@@ -618,7 +618,6 @@ Surface *Create_Surface(int Num, int Typ)
   pS->RecombineAngle = 45;
   pS->TransfiniteSmoothing = -1;
   pS->TrsfPoints = List_Create(4, 4, sizeof(Vertex *));
-  pS->Control_Points = List_Create(1, 10, sizeof(Vertex *));
   pS->Generatrices = NULL;
   pS->EmbeddedPoints = NULL;
   pS->EmbeddedCurves = NULL;
@@ -632,7 +631,6 @@ void Free_Surface(void *a, void *b)
   Surface *pS = *(Surface **)a;
   if(pS) {
     List_Delete(pS->TrsfPoints);
-    List_Delete(pS->Control_Points);
     List_Delete(pS->Generatrices);
     List_Delete(pS->EmbeddedCurves);
     List_Delete(pS->EmbeddedPoints);
@@ -897,8 +895,7 @@ void CopyCurve(Curve *c, Curve *cc)
   cc->end = c->end;
   cc->ubeg = c->ubeg;
   cc->uend = c->uend;
-  cc->Control_Points =
-    List_Create(List_Nbr(c->Control_Points), 1, sizeof(Vertex *));
+  cc->Control_Points = List_Create(List_Nbr(c->Control_Points), 1, sizeof(Vertex *));
   List_Copy(c->Control_Points, cc->Control_Points);
   if(c->Typ == MSH_SEGM_PARAMETRIC){
     strcpy(cc->functu, c->functu);
@@ -946,10 +943,6 @@ void CopySurface(Surface *s, Surface *ss)
       ss->plan[i][j] = s->plan[i][j];
   ss->Generatrices = List_Create(List_Nbr(s->Generatrices), 1, sizeof(Curve *));
   List_Copy(s->Generatrices, ss->Generatrices);
-  if(s->Control_Points) {
-    ss->Control_Points = List_Create(List_Nbr(s->Control_Points), 1, sizeof(Vertex *));
-    List_Copy(s->Control_Points, ss->Control_Points);
-  }
   End_Surface(ss);
   Tree_Insert(GModel::current()->getGEOInternals()->Surfaces, &ss);
 }
@@ -958,24 +951,44 @@ Surface *DuplicateSurface(Surface *s)
 {
   Surface *ps;
   Curve *c, *newc;
-  Vertex *v, *newv;
   int i;
 
   ps = Create_Surface(NEWSURFACE(), 0);
   CopySurface(s, ps);
-  for(i = 0; i < List_Nbr(ps->Generatrices); i++) {
+  for(int i = 0; i < List_Nbr(ps->Generatrices); i++) {
     List_Read(ps->Generatrices, i, &c);
     newc = DuplicateCurve(c);
     List_Write(ps->Generatrices, i, &newc);
   }
+  return ps;
+}
 
-  for(i = 0; i < List_Nbr(ps->Control_Points); i++) {
-    List_Read(ps->Control_Points, i, &v);
-    newv = DuplicateVertex(v);
-    List_Write(ps->Control_Points, i, &newv);
-  }
+void CopyVolume(Volume *v, Volume *vv)
+{
+  int i, j;
+  vv->Typ = v->Typ;
+  // We should not copy the meshing method (or the recombination
+  // status): if the meshes are to be copied, the meshing algorithm
+  // will take care of it (e.g. ExtrudeMesh()).
+  List_Copy(v->Surfaces, vv->Surfaces);
+  List_Copy(v->SurfacesOrientations, vv->SurfacesOrientations);
+  List_Copy(v->SurfacesByTag, vv->SurfacesByTag);
+  Tree_Insert(GModel::current()->getGEOInternals()->Volumes, &vv);
+}
 
-  return ps;
+Volume *DuplicateVolume(Volume *v)
+{
+  Volume *pv;
+  Surface *s, *news;
+
+  pv = Create_Volume(NEWVOLUME(), 0);
+  CopyVolume(v, pv);
+  for(int i = 0; i < List_Nbr(pv->Surfaces); i++) {
+    List_Read(pv->Surfaces, i, &s);
+    news = DuplicateSurface(s);
+    List_Write(pv->Surfaces, i, &news);
+  }
+  return pv;
 }
 
 void CopyShape(int Type, int Num, int *New)
@@ -983,6 +996,7 @@ void CopyShape(int Type, int Num, int *New)
   Surface *s, *news;
   Curve *c, *newc;
   Vertex *v, *newv;
+  Volume *vol, *newvol;
 
   switch (Type) {
   case MSH_POINT:
@@ -1020,6 +1034,14 @@ void CopyShape(int Type, int Num, int *New)
     news = DuplicateSurface(s);
     *New = news->Num;
     break;
+  case MSH_VOLUME:
+    if(!(vol = FindVolume(Num))) {
+      Msg::Error("Unknown volume %d", Num);
+      return;
+    }
+    newvol = DuplicateVolume(vol);
+    *New = newvol->Num;
+    break;
   default:
     Msg::Error("Impossible to copy entity %d (of type %d)", Num, Type);
     break;
@@ -1137,7 +1159,7 @@ void DeleteShape(int Type, int Num)
   case MSH_SEGM_FROM_GMODEL:
   case MSH_SURF_FROM_GMODEL:
   case MSH_VOLUME_FROM_GMODEL:
-    Msg::Error("Deletion of external CAD entities not implemented yet");
+    Msg::Error("Deletion of external CAD entities is not implemented yet");
     break;
   default:
     Msg::Error("Impossible to delete entity %d (of type %d)", Num, Type);
@@ -1556,7 +1578,7 @@ void printCurve(Curve *c)
   for(int i = 0; i < N; i++) {
     List_Read(c->Control_Points, i, &v);
     Msg::Debug("Vertex %d (%g,%g,%g,%g)", v->Num, v->Pos.X, v->Pos.Y,
-        v->Pos.Z, v->lc);
+	       v->Pos.Z, v->lc);
   }
 }
 
@@ -1616,26 +1638,11 @@ void ApplyTransformationToPoint(double matrix[4][4], Vertex *v,
       }
     }
     List_Delete(All);
-    All = Tree2List(GModel::current()->getGEOInternals()->Surfaces);
-    for(int i = 0; i < List_Nbr(All); i++) {
-      Surface *s;
-      List_Read(All, i, &s);
-      for(int j = 0; j < List_Nbr(s->Control_Points); j++) {
-        Vertex *pv = *(Vertex **)List_Pointer(s->Control_Points, j);
-        if(pv->Num == v->Num){
-          End_Surface(s);
-          break;
-        }
-      }
-    }
-    List_Delete(All);
   }
 }
 
 void ApplyTransformationToCurve(double matrix[4][4], Curve *c)
 {
-  Vertex *v;
-
   if(!c->beg || !c->end){
     Msg::Error("Cannot transform curve with no begin/end points");
     return;
@@ -1645,6 +1652,7 @@ void ApplyTransformationToCurve(double matrix[4][4], Curve *c)
   ApplyTransformationToPoint(matrix, c->end);
 
   for(int i = 0; i < List_Nbr(c->Control_Points); i++) {
+    Vertex *v;
     List_Read(c->Control_Points, i, &v);
     ApplyTransformationToPoint(matrix, v);
   }
@@ -1653,30 +1661,30 @@ void ApplyTransformationToCurve(double matrix[4][4], Curve *c)
 
 void ApplyTransformationToSurface(double matrix[4][4], Surface *s)
 {
-  Curve *c;
-  Vertex *v;
-  int i;
-
-  for(i = 0; i < List_Nbr(s->Generatrices); i++) {
+  for(int i = 0; i < List_Nbr(s->Generatrices); i++) {
+    Curve *c;
     List_Read(s->Generatrices, i, &c);
-    // FIXME: this fixes benchmarks/2d/transfo_neg_curves.geo, but is
-    // it the correct fix?
-    //ApplyTransformationToCurve(matrix, c);
     Curve *cc = FindCurve(abs(c->Num));
     ApplyTransformationToCurve(matrix, cc);
   }
-  for(i = 0; i < List_Nbr(s->Control_Points); i++) {
-    List_Read(s->Control_Points, i, &v);
-    ApplyTransformationToPoint(matrix, v);
-  }
   End_Surface(s);
 }
 
+void ApplyTransformationToVolume(double matrix[4][4], Volume *v)
+{
+  for(int i = 0; i < List_Nbr(v->Surfaces); i++) {
+    Surface *s;
+    List_Read(v->Surfaces, i, &s);
+    ApplyTransformationToSurface(matrix, s);
+  }
+}
+
 void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
 {
   Vertex *v;
   Curve *c;
   Surface *s;
+  Volume *vol;
 
   List_Reset(ListOfTransformedPoints);
 
@@ -1716,9 +1724,16 @@ void ApplicationOnShapes(double matrix[4][4], List_T *shapes)
       else
         Msg::Error("Unknown surface %d", O.Num);
       break;
+    case MSH_VOLUME:
+      vol = FindVolume(O.Num);
+      if(vol)
+        ApplyTransformationToVolume(matrix, vol);
+      else
+        Msg::Error("Unknown volume %d", O.Num);
+      break;
     default:
       Msg::Error("Impossible to transform entity %d (of type %d)", O.Num,
-          O.Type);
+		 O.Type);
       break;
     }
   }
@@ -1873,7 +1888,7 @@ void BoundaryShapes(List_T *shapes, List_T *shapesBoundary)
       break;
     default:
       Msg::Error("Impossible to take boundary of entity %d (of type %d)", O.Num,
-          O.Type);
+		 O.Type);
       break;
     }
   }
@@ -2531,7 +2546,7 @@ void ExtrudeShapes(int type, List_T *list_in,
       break;
     default:
       Msg::Error("Impossible to extrude entity %d (of type %d)",
-          shape.Num, shape.Type);
+		 shape.Num, shape.Type);
       break;
     }
   }
@@ -2705,13 +2720,6 @@ void ReplaceDuplicatePoints()
   All = Tree2List(GModel::current()->getGEOInternals()->Surfaces);
   for(i = 0; i < List_Nbr(All); i++) {
     List_Read(All, i, &s);
-    for(j = 0; j < List_Nbr(s->Control_Points); j++) {
-      pv = (Vertex **)List_Pointer(s->Control_Points, j);
-      if(!(pv2 = (Vertex **)Tree_PQuery(allNonDuplicatedPoints, pv)))
-        Msg::Error("Weird point %d in Coherence", (*pv)->Num);
-      else
-        List_Write(s->Control_Points, j, pv2);
-    }
     for(j = 0; j < List_Nbr(s->TrsfPoints); j++){
       pv = (Vertex **)List_Pointer(s->TrsfPoints, j);
       if(!(pv2 = (Vertex **)Tree_PQuery(allNonDuplicatedPoints, pv)))
@@ -3083,7 +3091,7 @@ void sortEdgesInLoop(int num, List_T *edges)
         if(c2->end == c0->beg) {
           if(List_Nbr(temp)) {
             Msg::Info("Starting subloop %d in Line Loop %d (are you sure about this?)",
-                ++k, num);
+		      ++k, num);
             c0 = c1 = *(Curve **)List_Pointer(temp, 0);
             List_Add(edges, &c1->Num);
             List_PSuppress(temp, 0);
diff --git a/Geo/Geo.h b/Geo/Geo.h
index c9339ac058..a404c0c270 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -159,7 +159,6 @@ typedef struct{
   List_T *Generatrices;
   List_T *EmbeddedCurves;
   List_T *EmbeddedPoints;
-  List_T *Control_Points;
   List_T *TrsfPoints;
   List_T *RuledSurfaceOptions;
   double plan[3][3];
diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp
index fc6f826267..b81acc56a9 100644
--- a/Geo/GeoStringInterface.cpp
+++ b/Geo/GeoStringInterface.cpp
@@ -1,4 +1,4 @@
-// $Id: GeoStringInterface.cpp,v 1.23 2008-06-07 17:20:46 geuzaine Exp $
+// $Id: GeoStringInterface.cpp,v 1.24 2008-06-19 15:58:41 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -328,7 +328,6 @@ void add_bezier(int N, int *p, const char *fich)
   add_infile(text, fich);
 }
 
-
 void add_bspline(int N, int *p, const char *fich)
 {
   char text[BUFFSIZE], text2[BUFFSIZE];
@@ -383,7 +382,6 @@ void add_lineloop(List_T *list, const char *fich, int *numloop)
   add_infile(text, fich);
 }
 
-
 void add_surf(List_T *list, const char *fich, int support, int typ)
 {
   char text[BUFFSIZE];
diff --git a/benchmarks/2d/HEA100.geo b/benchmarks/2d/HEA100.geo
index 4f8061e537..d605efd448 100644
--- a/benchmarks/2d/HEA100.geo
+++ b/benchmarks/2d/HEA100.geo
@@ -1,4 +1,4 @@
-h=96;
+h = 96;
 c = 100/2;
 d = 5;
 t = 8;
diff --git a/benchmarks/2d/IPE.geo b/benchmarks/2d/IPE.geo
index cc385ea302..0c4f85bc5d 100644
--- a/benchmarks/2d/IPE.geo
+++ b/benchmarks/2d/IPE.geo
@@ -1,4 +1,4 @@
-LC   = h;
+LC   = t/2;
 LC2  = r/4;
 
 Point(1) = {-c,-h/2,0,LC};
diff --git a/doc/TODO b/doc/TODO
index 2e413a64f6..cbb1145270 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.73 2008-06-12 09:31:43 geuzaine Exp $
+$Id: TODO,v 1.74 2008-06-19 15:58:42 geuzaine Exp $
 
 ********************************************************************
 
@@ -110,10 +110,6 @@ us to do symmetries and periodic meshes
 
 ********************************************************************
 
-add transformations on volumes
-
-********************************************************************
-
 introduce Right/Left/Alternate for extruded meshes
 
 ********************************************************************
diff --git a/doc/VERSIONS b/doc/VERSIONS
index 4c6ed7058b..a8cce0fd98 100644
--- a/doc/VERSIONS
+++ b/doc/VERSIONS
@@ -1,4 +1,6 @@
-$Id: VERSIONS,v 1.409 2008-06-15 08:47:15 geuzaine Exp $
+$Id: VERSIONS,v 1.410 2008-06-19 15:58:42 geuzaine Exp $
+
+2.2.2 (): added geometrical transformations on volumes.
 
 2.2.1 (Jun 15, 2008): various small improvements (adaptive views, gui,
 code cleanup) and bug fixes (high order meshes, Netgen interface).
diff --git a/doc/texinfo/gmsh.texi b/doc/texinfo/gmsh.texi
index 39bf09308e..5bd268aa56 100644
--- a/doc/texinfo/gmsh.texi
+++ b/doc/texinfo/gmsh.texi
@@ -1,5 +1,5 @@
 \input texinfo.tex @c -*-texinfo-*-
-@c $Id: gmsh.texi,v 1.250 2008-05-01 06:56:23 geuzaine Exp $
+@c $Id: gmsh.texi,v 1.251 2008-06-19 15:58:42 geuzaine Exp $
 @c
 @c Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 @c
@@ -1723,29 +1723,28 @@ below). The syntax of the transformation commands is:
 @var{transform}:
 @ftable @code
 @item Dilate @{ @{ @var{expression-list} @}, @var{expression} @} @{ @var{transform-list} @}
-Scales all elementary entities (points, lines or surfaces) in
-@var{transform-list} by a factor @var{expression}. The @var{expression-list}
-should contain three @w{@var{expression}s} giving the X, Y and Z direction
-of the homothetic transformation.
+Scales all elementary entities in @var{transform-list} by a factor
+@var{expression}. The @var{expression-list} should contain three
+@w{@var{expression}s} giving the X, Y and Z direction of the homothetic
+transformation.
 
 @item Rotate @{ @{ @var{expression-list} @}, @{ @var{expression-list} @}, @var{expression} @}  @{ @var{transform-list} @}
-Rotates all elementary entities (points, lines or surfaces) in
-@var{transform-list} by an angle of @var{expression} radians. The first
-@var{expression-list} should contain three @w{@var{expression}s} giving the
-X, Y and Z direction of the rotation axis; the second @var{expression-list}
-should contain three @w{@var{expression}s} giving the X, Y and Z components
-of any point on this axis.
+Rotates all elementary entities in @var{transform-list} by an angle of
+@var{expression} radians. The first @var{expression-list} should contain
+three @w{@var{expression}s} giving the X, Y and Z direction of the
+rotation axis; the second @var{expression-list} should contain three
+@w{@var{expression}s} giving the X, Y and Z components of any point on
+this axis.
 
 @item Symmetry @{ @var{expression-list} @} @{ @var{transform-list} @}
-Transforms all elementary entities (points, lines or surfaces) symmetrically
-to a plane. The @var{expression-list} should contain four
-@w{@var{expression}s} giving the coefficients of the plane's equation.
+Transforms all elementary entities symmetrically to a plane. The
+@var{expression-list} should contain four @w{@var{expression}s} giving
+the coefficients of the plane's equation.
 
 @item Translate @{ @var{expression-list} @} @{ @var{transform-list} @}
-Translates all elementary entities (points, lines or surfaces) in
-@var{transform-list}. The @var{expression-list} should contain three
-@w{@var{expression}s} giving the X, Y and Z components of the translation
-vector.
+Translates all elementary entities in @var{transform-list}. The
+@var{expression-list} should contain three @w{@var{expression}s} giving
+the X, Y and Z components of the translation vector.
 
 @item Boundary @{ @var{transform-list} @}
 (Not a transformation per-se.) Returns the boundary of the elementary
@@ -1782,8 +1781,8 @@ automatically after each geometrical transformation, unless
 @code{Geometry.AutoCoherence} is set to zero (@pxref{Geometry options}).
 
 @item Delete @{ Point | Line | Surface | Volume @{ @var{expression-list} @}; @dots{} @}
-Deletes all elementary entities (points, lines, surfaces or volumes) whose
-identification numbers are given in @var{expression-list}.
+Deletes all elementary entities whose identification numbers are given
+in @var{expression-list}.
 
 @item Hide @{ Point | Line | Surface | Volume @{ @var{expression-list} @}; @dots{} @}
 Hide the entities listed in @var{expression-list}, if
diff --git a/utils/misc/variables.msvc b/utils/misc/variables.msvc
index d3eceebc27..83b89f0174 100644
--- a/utils/misc/variables.msvc
+++ b/utils/misc/variables.msvc
@@ -1,8 +1,10 @@
-# This is a pre-filled variables file for building a blackbox version
-# of Gmsh with Microsoft Visual C++ (MSVC).
+# This is a pre-filled variables file for building Gmsh with Microsoft
+# Visual C++ (MSVC).
+# 
+# The non-graphical (ENABLE_GUI=0) versions have been succesfully tested 
+# with MSVC 2003, 2005 and 2008.
 #
-# This has been tested with MSVC 2003, 2005 and 2008. See
-# doc/README.msvc for building instructions.
+# See doc/README.msvc for building instructions.
 
 ##################################################################
 
-- 
GitLab