From 5c5bb1d02d07ab55dda8ac1e5b0ed7a05d3a22e3 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 14 Oct 2007 09:51:18 +0000
Subject: [PATCH] new Mesh.MnimumCurvePoints to control min number of mesh
 points on non-straight curves

---
 Common/Context.h          |  2 +-
 Common/DefaultOptions.h   |  2 ++
 Common/Options.cpp        |  9 ++++++++-
 Common/Options.h          |  1 +
 Geo/GModelIO_F.cpp        |  2 +-
 Geo/GModelIO_MED.cpp      |  4 ++--
 Geo/GModelIO_OCC.cpp      |  8 ++++----
 Geo/OCCEdge.cpp           | 12 +++++-------
 Geo/gmshEdge.cpp          | 10 ++++++----
 benchmarks/2d/tresse2.geo |  4 ++--
 doc/TODO                  | 12 +++++++++++-
 doc/texinfo/opt_mesh.texi |  5 +++++
 12 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/Common/Context.h b/Common/Context.h
index 6dcb7ff584..858fc3e8e9 100644
--- a/Common/Context.h
+++ b/Common/Context.h
@@ -181,7 +181,7 @@ public :
     int format, nb_smoothing, algo2d, algo3d, algo_recombine;
     int order, second_order_linear, second_order_incomplete;
     int smooth_internal_edges, c1_continuity;
-    int min_circ_points;
+    int min_circ_points, min_curv_points;
     int constrained_bgmesh, lc_from_curvature;
     double normals, tangents, explode;
     int color_carousel;
diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 21571b2c14..0a9c4d0476 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -956,6 +956,8 @@ StringXNumber MeshOptions_Number[] = {
 
   { F|O, "MinimumCirclePoints" , opt_mesh_min_circ_points, 7. ,
     "Minimum number of points used to mesh a circle" },
+  { F|O, "MinimumCurvePoints" , opt_mesh_min_curv_points, 3. ,
+    "Minimum number of points used to mesh a (non-straight) curve" },
   { F|O, "MshBinary" , opt_mesh_msh_binary , 0. , 
     "Write MSH files in binary format?" },
   { F|O, "MshFileVersion" , opt_mesh_msh_file_version , 2.0 , 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 8fe9d671d1..7a53f9232e 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.364 2007-10-03 19:40:40 geuzaine Exp $
+// $Id: Options.cpp,v 1.365 2007-10-14 09:51:17 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -4865,6 +4865,13 @@ double opt_mesh_min_circ_points(OPT_ARGS_NUM)
   return CTX.mesh.min_circ_points;
 }
 
+double opt_mesh_min_curv_points(OPT_ARGS_NUM)
+{
+  if(action & GMSH_SET)
+    CTX.mesh.min_curv_points = (int)val;
+  return CTX.mesh.min_curv_points;
+}
+
 double opt_mesh_constrained_bgmesh(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
diff --git a/Common/Options.h b/Common/Options.h
index e99a647f60..2449d31589 100644
--- a/Common/Options.h
+++ b/Common/Options.h
@@ -476,6 +476,7 @@ double opt_mesh_algo3d(OPT_ARGS_NUM);
 double opt_mesh_lc_integration_precision(OPT_ARGS_NUM);
 double opt_mesh_recombine_algo(OPT_ARGS_NUM);
 double opt_mesh_min_circ_points(OPT_ARGS_NUM);
+double opt_mesh_min_curv_points(OPT_ARGS_NUM);
 double opt_mesh_constrained_bgmesh(OPT_ARGS_NUM);
 double opt_mesh_order(OPT_ARGS_NUM);
 double opt_mesh_c1(OPT_ARGS_NUM);
diff --git a/Geo/GModelIO_F.cpp b/Geo/GModelIO_F.cpp
index 5c5b75550f..42dfd8acfb 100644
--- a/Geo/GModelIO_F.cpp
+++ b/Geo/GModelIO_F.cpp
@@ -93,7 +93,7 @@ int GModel::readF(const std::string &filename)
 
 int GModel::readF(const std::string &fn)
 {
-  Msg(GERROR,"Gmsh has to be compiled with Fourier Model support to load %s",
+  Msg(GERROR,"Gmsh has to be compiled with Fourier Model support to load '%s'",
       fn.c_str());
   return 0;
 }
diff --git a/Geo/GModelIO_MED.cpp b/Geo/GModelIO_MED.cpp
index bd8f39cbc3..c7b1f4f8fc 100644
--- a/Geo/GModelIO_MED.cpp
+++ b/Geo/GModelIO_MED.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_MED.cpp,v 1.5 2007-05-03 09:07:07 geuzaine Exp $
+// $Id: GModelIO_MED.cpp,v 1.6 2007-10-14 09:51:17 geuzaine Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -381,7 +381,7 @@ int GModel::writeMED(const std::string &name)
 
 int GModel::writeMED(const std::string &name)
 {
-  Msg(GERROR,"Gmsh has to be compiled with MED support to write %s",
+  Msg(GERROR,"Gmsh has to be compiled with MED support to write '%s'",
       name.c_str());
   return 0;
 }
diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp
index c061d4673f..02638bef62 100644
--- a/Geo/GModelIO_OCC.cpp
+++ b/Geo/GModelIO_OCC.cpp
@@ -1,4 +1,4 @@
-// $Id: GModelIO_OCC.cpp,v 1.21 2007-09-04 13:47:01 remacle Exp $
+// $Id: GModelIO_OCC.cpp,v 1.22 2007-10-14 09:51:17 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -467,21 +467,21 @@ void GModel::deleteOCCInternals()
 
 int GModel::readOCCSTEP(const std::string &fn)
 {
-  Msg(GERROR,"Gmsh has to be compiled with OpenCascade support to load %s",
+  Msg(GERROR,"Gmsh has to be compiled with OpenCascade support to load '%s'",
       fn.c_str());
   return 0;
 }
 
 int GModel::readOCCIGES(const std::string &fn)
 {
-  Msg(GERROR,"Gmsh has to be compiled with OpenCascade support to load %s",
+  Msg(GERROR,"Gmsh has to be compiled with OpenCascade support to load '%s'",
       fn.c_str());
   return 0;
 }
 
 int GModel::readOCCBREP(const std::string &fn)
 {
-  Msg(GERROR,"Gmsh has to be compiled with OpenCascade support to load %s",
+  Msg(GERROR,"Gmsh has to be compiled with OpenCascade support to load '%s'",
       fn.c_str());
   return 0;
 }
diff --git a/Geo/OCCEdge.cpp b/Geo/OCCEdge.cpp
index 2e077ae935..67e1e00728 100644
--- a/Geo/OCCEdge.cpp
+++ b/Geo/OCCEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCEdge.cpp,v 1.23 2007-10-08 13:13:23 geuzaine Exp $
+// $Id: OCCEdge.cpp,v 1.24 2007-10-14 09:51:17 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -186,22 +186,20 @@ GEntity::GeomType OCCEdge::geomType() const
 
 int OCCEdge::minimumMeshSegments() const
 {
-  if(geomType() == Line || geomType() == Unknown)
+  if(geomType() == Line)
     return GEdge::minimumMeshSegments();
   else
-    return 2; // always put at least one mid-point on non-straight lines
+    return CTX.mesh.min_curv_points - 1;
 }
 
 int OCCEdge::minimumDrawSegments() const
 {
-  int n = GEdge::minimumDrawSegments();
-
   if(geomType() == Line)
-    return n;
+    return GEdge::minimumDrawSegments();
   else if(geomType() == Circle || geomType() == Ellipse)
     return CTX.geom.circle_points;
   else
-    return 20 * n;
+    return 20 * GEdge::minimumDrawSegments();
 }
 
 double OCCEdge::curvature(double par) const 
diff --git a/Geo/gmshEdge.cpp b/Geo/gmshEdge.cpp
index 502b5cde33..630467e220 100644
--- a/Geo/gmshEdge.cpp
+++ b/Geo/gmshEdge.cpp
@@ -1,4 +1,4 @@
-// $Id: gmshEdge.cpp,v 1.39 2007-10-08 13:13:23 geuzaine Exp $
+// $Id: gmshEdge.cpp,v 1.40 2007-10-14 09:51:17 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -120,11 +120,13 @@ GEntity::GeomType gmshEdge::geomType() const
 
 int gmshEdge::minimumMeshSegments () const
 {
-  if(geomType() == Circle || geomType() == Ellipse)
+  if(geomType() == Line)
+    return GEdge::minimumMeshSegments();
+  else if(geomType() == Circle || geomType() == Ellipse)
     return (int)(fabs(c->Circle.t1 - c->Circle.t2) *
 		 (double)CTX.mesh.min_circ_points / Pi) - 1;
   else
-    return GEdge::minimumMeshSegments();
+    return CTX.mesh.min_curv_points - 1;
 }
 
 int gmshEdge::minimumDrawSegments () const
@@ -132,7 +134,7 @@ int gmshEdge::minimumDrawSegments () const
   int n = List_Nbr(c->Control_Points) - 1;
   if(!n) n = GEdge::minimumDrawSegments();
 
-  if(geomType() == Line  && ! c->geometry)
+  if(geomType() == Line && !c->geometry)
     return n;
   else if(geomType() == Circle || geomType() == Ellipse)
     return CTX.geom.circle_points;
diff --git a/benchmarks/2d/tresse2.geo b/benchmarks/2d/tresse2.geo
index c10a3f0356..88949293cd 100644
--- a/benchmarks/2d/tresse2.geo
+++ b/benchmarks/2d/tresse2.geo
@@ -42,11 +42,11 @@ For jj In {1:nn}
 
    num = (2*jj-1)*10000+ii;
    Spline(num) = tab1[];
-   Extrude Line { num , {0,0,1}, {0,0,0}, nw*angm }{Layers{5,num,1};Recombine;} ;
+   Extrude Line { num , {0,0,1}, {0,0,0}, nw*angm }{Layers{5};Recombine;} ;
 
    num = (2*jj)*10000+ii;
    Spline(num) = tab2[];
-   Extrude Line { num , {0,0,1}, {0,0,0}, nw*angm }{Layers{5,num,1};Recombine;} ;
+   Extrude Line { num , {0,0,1}, {0,0,0}, nw*angm }{Layers{5};Recombine;} ;
 
 EndFor      
 
diff --git a/doc/TODO b/doc/TODO
index 77facc8a91..73c1ebd7b4 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,4 +1,10 @@
-$Id: TODO,v 1.64 2007-10-02 19:26:42 geuzaine Exp $
+$Id: TODO,v 1.65 2007-10-14 09:51:17 geuzaine Exp $
+
+********************************************************************
+
+Add a global "transparency slider" for the mesh; if value != 1, fill a
+global triangle vertex array in GModel instead of in each separate
+entity, and sort like in post-processing.
 
 ********************************************************************
 
@@ -6,6 +12,10 @@ add way to invert element orientation (per element or per surface)
 
 ********************************************************************
 
+add "make uninstall"
+
+********************************************************************
+
 Add list of recently loaded files in the GUI
 
 ********************************************************************
diff --git a/doc/texinfo/opt_mesh.texi b/doc/texinfo/opt_mesh.texi
index 683a1309b2..7322f75f1b 100644
--- a/doc/texinfo/opt_mesh.texi
+++ b/doc/texinfo/opt_mesh.texi
@@ -174,6 +174,11 @@ Minimum number of points used to mesh a circle@*
 Default value: @code{7}@*
 Saved in: @code{General.OptionsFileName}
 
+@item Mesh.MinimumCurvePoints
+Minimum number of points used to mesh a (non-straight) curve@*
+Default value: @code{3}@*
+Saved in: @code{General.OptionsFileName}
+
 @item Mesh.MshBinary
 Write MSH files in binary format?@*
 Default value: @code{0}@*
-- 
GitLab